· 6 years ago · Mar 09, 2019, 03:32 PM
1use master
2go
3
4if exists (select name from sys.databases where name = N'TestDB')
5drop database [TestDB]
6go
7
8create database [TestDB] on primary (
9 name = 'TestDB_Data',
10 filename = '$PathTestDB_Data.mdf',
11 size = 40MB,
12 maxsize = 2GB,
13 filegrowth = 20MB
14)
15
16use [TestDB]
17go
18
19create table dbo.Posts
20(
21 Id int identity not null,
22 Body nvarchar (max) null
23);
24
25using (SqlConnection connection = new SqlConnection(connectionString)) {
26 connection.Open();
27 connection.Execute(sqlQuery);
28}
29
30select '
31GO ' GO from [GO]