# dbselect

### (PRO) dbselect(connector, queryString, appendString, dispMessages)

Execute a SQL SELECT statement. This can be using the source or target connector.

## Arguments

Argument | Data Type | Description
connector | string | The Connector to use for the query. "S" - source connector "T" - target connector "connector name" - use another connector from the connector manager
queryString | string | SQL SELECT statement
seperatorString | boolean | If the select statement is returning more than one field, use this to specify the separator between the field values
dispMessages | string | If TRUE, display an error message if the SELCT generates an error; if false, just reutrn an empty string

## Returns

The value that is the result of the query as a string.

## Description

Performs the query passed into the function. You will normally need to build up the SQL SELECT statement using strings concatenated with field values.

If the SELECT statement returns more than one row, no results will be returned.

NOTE: You no longer need to do string concatenation to include a field in the statement. Instead of doing this:

> "SELECT tableField FROM myTable WHERE primKey = '" & #myField & "'"

> you can do this:

> "SELECT tableField FROM myTable WHERE primKey = '#myField'"

Inaport will parse the SQL and find the #myField; this will be replaced with the value of the field. If you really need to include a '#' character in your SQL, replace it with '##'.

Note that if you are using a function or expression as a string parameter to the SQL, you will need to surround it with single quote characters as shown below:

> "SELECT tableField FROM myTable WHERE primKey = '" & left(#myField, 5) & "'"

## Examples

Example | Description
--- | ---
dbeselectl("T", "SELECT pers_personid FROM person WHERE pers_source = '#myField'") | Select the personid field from the person table, using the contents of the field myField
dbselectl("T", "SELECT pers_firstname, pers_lastname FROM person WHERE pers_source = '#myField'", ":") | Select the first name and last name fields from the person table where the source field equals the contents of the incoming myField. The first name and last name will be separated by ":".

## See Also

dblookup(), dbinsert(), dbupdate()