From 002fd39e882630124ff44680c74fae915358988f Mon Sep 17 00:00:00 2001 From: Eric Kang Date: Thu, 10 Nov 2016 17:55:46 -0800 Subject: [PATCH] drop database snippet change to prevent command failure (#317) * drop database change to prevent comman failure * fixed insert snippet missing comma * simplified create table snippet * reverted Identity column definition and fixed insert snippet --- snippets/mssql.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/snippets/mssql.json b/snippets/mssql.json index 2afec1d00e..afc0251156 100644 --- a/snippets/mssql.json +++ b/snippets/mssql.json @@ -43,6 +43,8 @@ "-- Connect to the 'master' database to run this snippet", "USE master", "GO", + "-- Uncomment the ALTER DATABASE statement below to set the database to SINGLE_USER mode if the drop database command fails because the database is in use.", + "-- ALTER DATABASE ${DatabaseName} SET SINGLE_USER WITH ROLLBACK IMMEDIATE;", "-- Drop the database if it exists", "IF EXISTS (", " SELECT name", @@ -66,11 +68,10 @@ "-- Create the table in the specified schema", "CREATE TABLE ${SchemaName}.${TableName}", "(", - " ${TableName}Id INT NOT NULL, -- primary key column", + " ${TableName}Id INT NOT NULL PRIMARY KEY, -- primary key column", " Column1 [NVARCHAR](50) NOT NULL,", " Column2 [NVARCHAR](50) NOT NULL", " -- specify more columns here", - " CONSTRAINT PK_${TableName} PRIMARY KEY (${TableName}Id)", ");", "GO" ], @@ -138,10 +139,10 @@ ")", "VALUES", "( -- first row: values for the columns in the list above", - " Column1_Value, Column2_Value, Column2_Value", - ")", + " Column1_Value, Column2_Value, Column3_Value", + "),", "( -- second row: values for the columns in the list above", - " Column1_Value, Column2_Value, Column2_Value", + " Column1_Value, Column2_Value, Column3_Value", ")", "-- add more rows here", "GO"