ExecuteSql
From STIQ
Generic example:
- | executeSql | SQL command | |
Real world example:
The following STIQ snippet queries for username and temporary password for a contact of a client with federal tax id equal to the randomly generated federal tax id.
Note: This snippet is shown as it would be entered into the test pane in STIQ.
- | executeSql | select username, temporarypassword from staging_contents a inner join staging_contactcollections b on a.id = b.contactid and b.contactroleid = 1 and b.contacttypeid = 1 and b.entitytypeid = 2 inner join staging_clients c on c.id = b.entityid where c.federaltaxid = !-${federalTaxId} | |
- | storeQueryValue | 0:temporarypassword | temppassword |
- | storeQueryValue | 0:username | client_username |
Rendered in the Test Pane as
| executeSql | select username, temporarypassword from staging_contents a inner join staging_contactcollections b on a.id = b.contactid and b.contactroleid = 1 and b.contacttypeid = 1 and b.entitytypeid = 2 inner join staging_clients c on c.id = b.entityid where c.federaltaxid = ${federalTaxId} | client_username |
| storeQueryValue | 0:temporarypassword | temppassword |
| storeQueryValue | 0:username | client_username |
Stepping through the above example:
- Row 1 (executeSql) - executes the SQL command
- Row 2 (storeQueryValue) - stores the SQL result data from row (or record) number 0 into temppassword (STIQ variable).
- Row 3 (storeQueryValue) - stores the SQL result data from row (or record) number 0 into client_username (STIQ variable).
Note: If you're having problems with intermittent executeSql failures, please see Internet_Explorer_Cache
See also SqlServerIntegration
