Home > Contents > Index >
Template Tag TOC  |   Alpha TOC  |   Tag Family TOC  |   Purpose TOC  |   Annotated TOC  |   Index 

 

SELECTTO

Executes a simple query from a table.

Syntax

Parameters

FROM (required)
Name of the Content Server table to query. The table must be registered in the SystemInfo table. This table verifies security and caches result sets when the cc.cacheResults property is enabled.

WHAT (optional)
List of columns to return. The format of WHAT_CRITERIA is a comma-separated list of column names.

LIST (required)
Name of the list to contain the resultset.

WHERE (optional)
Comma-separated list of table columns to select against. For each item in the WHERE string, the value of the corresponding variable is used to construct a SQL WHERE clause. All the elements in the comma-separated list must be variables. When you specify a datetime field in the WHERE_CRITERIA, Content Server uses the cc.datepicture property to convert the supplied datetime to the proper format.

ORDERBY (optional)
Orders the rows returned by the query. The format of ORDERBY_EXPRESSION is a comma-separated list of column names. You can also override the default sort order by specifying ascending/descending with a (potentially) database specific command like:

ORDERBY="colname1 desc,colname2 asc"

LIMIT (optional)
Maximum number of rows to return.

Note that if the LIMIT parameter is omitted or is less than or equal to 0, then no limit exists and the entire recordset is returned.

Description

The SELECTTO tag executes a simple query from a table. The results are stored in a list.

errno

The possible values of errno include:

Value
Description
-101
No search results.
-106
One of the elements in the WHERE clause was not a variable. (All elements in the WHERE clause must be variables.)

Example

The following example selects all columns from the SystemInfo table and puts the results into a list called RS for later use.

The next example demonstrates a comma-separated list. It selects records in the visitor table where firstname = Fred and lastname = Smith. It then loops through the list if the list is created and has records.

See Also

CALLSQL
EXECSQL
SQLEXP

  Home > Contents > Index >

FatWire XML Tag Reference
Copyright 2005 by FatWire Software
All rights reserved.