Execute SELECT Query on a SQL Database
The Execute SELECT Query on a SQL Database action allows you to execute a SQL SELECT statement (a query) on a remote SQL database (or Excel spreadsheet) to retrieve one or more record(s). Alpha Anywhere will use AlphaDAO (Alpha Data Access Objects) to connect to the remote database.
Once you have executed the query, you can:
preview the data in a window
generate sample code to show how to loop through the rows of returned data
save the result to a variable in the form of a CR-LF delimited list
perform other actions
Enter the required connection string into the Options > Connection string property. If you do not have a ready-made connection string, you may click to display the Connection String dialog.
1. Optionally, select a named connection string from the drop-down list.
2. Optionally, select Specify a connection string and click Build to display the Create SQL Connection String dialog.
3. Click OK to return to the Script Genie.
Make a selection from the Options > SQL Statement type list. The options are:
" Portable " - the generic, multi-database version of SQL that allows use of the SQL Genie.
"Native SQL Syntax" - appropriate for the database you selected
"Stored Procedure" - the name of a stored SQL procedure to run
If you selected "Portable" or "Native SQL Syntax" in step 2, click '...' in the Options > SQL Statement property to display the SQL Genie. Otherwise, enter the name of the SQL stored procedure to run.
Optionally, click '...' in the Options > Arguments property to display the Define/Edit Arguments dialog. Arguments provide values to use in filter and order expressions. Argument values may come from variables or from user selections at run time.
Optionally, click in the Options > Arguments property to display the Define/Edit Arguments dialog. Arguments provide values to use in filter and order expressions. Argument values may come from variables or from user selections at run time.
"Open Window to Preview Result"
"Generate code to loop over rows"
"Dump results to a variable"
Optionally, click Preview Records. Note that this function does not use any defined arguments.
Click Next >.
Optionally, enter a comment that describes the action.
If you selected "Generate code to loop over rows" in step 5, right click on the action and select View Xbasic.
Desktop Applications Only