With the “Execute SQL” action you can execute SQL statements from within SharePoint Designer workflows.
The action is included in my SharePoint Designer Actions 1.0 release on CodePlex. Source code is available.
Configuration in SharePoint Designer
- Provider: The .NET ADO Provider. Default is MS SQL Server (System.Data.SqlClient). You can use other providers like ODBC, Oracle…
- Connection: The connection string e.g. “Data Source=localhost\SQLExpress;Initial Catalog=test;Integrated Security=SSPI”
- SQL: The SQL statement you want to execute. You can use Lookups to parameterize the statement. You can also use stored procedures e.g. “EXEC [test_Proc] @var1=N’test’ ”
- Result: The variable where you want to store the first column of the first row of the result from the SQL statement. Actual the result variable is mandatory. If you don’t need it you have to use dummy variable.
NOTE: The action runs under the user account of the application pool