Description
Executes a SQL query and returns the value in the first column of the first row in the result set. Similar to the SQLQUERY function, except that two values may be passed in. The first value replaces any %1, and the second value replaces any %2.
Syntax
SQLQUERY2 ( TextSourceField1, TextSourceField2, "connection", "sqlStatement" )
Parameter | Description |
---|---|
TextSourceField1 | The first source value used in the SQL statement. |
TextSourceField2 | The seconf source value used in the SQL statement. |
connection | The connection for the database to run the query against. If the connection is Scribe Internal Database, the SCRIBE user must have at least SELECT privileges on any table referenced in the SQL statement. |
sqlStatement | The SQL statement to execute. |
Remarks
Use %1 and %2 inside of the query to send two values from the source. If the source data type is text, use '%1' or '%2'.
If the database was configured as <table>.dbo.<fieldname> then you must include dbo. in the query. See SQLQUERY for more information.
Example
If source fields (S2 and S10) are text, and the connection name is Target:
SQLQUERY2( S2, S10, "Target", "select accountid from account where AccountName='%1' and Phone='%2'" )
See Also