This content is part of a third party extension that is not supported by the Cake project.
For more information about this extension see
Cake.SqlServer.
Summary
Execute any SQL command.
Syntax
public static void ExecuteSqlCommand(this ICakeContext context, SqlConnection connection, string sqlCommands)
Examples
#addin "nuget:?package=Cake.SqlServer"
Task("Sql-Operations")
.Does(() =>
{
using (var connection = OpenSqlConnection(@"Data Source=(localdb)\MSSqlLocalDb;Initial Catalog=MyDatabase"))
{
ExecuteSqlCommand(connection, "create table [CakeTest].dbo.[CakeTestTable] (id int null)");
ExecuteSqlCommand(connection, "...");
}
});
Attributes
Type |
Description |
CakeMethodAliasAttribute |
|
Parameters
Name |
Type |
Description |
context |
ICakeContext |
The Cake context. |
connection |
SqlConnection |
The connection to use. The connection must be open. See Cake.SqlServer.SqlServerAliases.OpenSqlConnection(Cake.Core.ICakeContext,System.String) . |
sqlCommands |
string |
SQL to be executed |
Return Value