Execute SQL Script

⌘K

This activity executes SQL statements within SharePoint Designer workflows.

execute_sql_script_1

Note: The default provider is MS SQL Server (System.Data.SqlClient). You can use other providers like ODBC or Oracle.

The activity supports multiple batches separated by the GO command. GO is not a Transact-SQL statement; it is a command recognized by this activity. The activity interprets GO as a signal to send the current batch of Transact-SQL statements to an instance of SQL Server. The current batch of statements includes all statements entered since the last GO or since the start of the session if it is the first GO.

A Transact-SQL statement cannot occupy the same line as a GO command. However, comments can appear on the same line as GO.

Example: SQL script

execute_sql_script_2
SharePoint Workflow Designer Phrase

Execute SQL Script this SQL script using this provider name and this connection string.

Parameters

ParameterDescription
this SQL scriptSQL statements. Supports multiple batches separated by the GO command.
this provider nameThe .NET ADO Provider. The default is MS SQL Server (System.Data.SqlClient). Other providers include:
– System.Data.Odbc – ODBC Data Provider
– System.Data.OleDb – OleDb Data Provider
– System.Data.OracleClient – OracleClient Data Provider
– System.Data.SqlServerCe.3.5 – Microsoft SQL Server Compact Data Provider
Additional information about providers can be found here.
this connection stringThe connection string, e.g., Data Source=localhost\SQLExpress;Initial Catalog=test;Integrated Security=SSPI.

How can we help?