SQL Server/T-SQL/Database/Create Database — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 13:46, 26 мая 2010
Create a database: simplest statement
1> CREATE DATABASE myDatabase;
2> GO
1>
2> Drop database myDatabase;
3> GO
1>
Create database by setting the mdf file, size, maxsize and file growth rate
1> CREATE DATABASE Database_2
2> ON PRIMARY
3> (NAME = Database_2_dat,
4> FILENAME = "c:\dat.mdf",
5> SIZE = 2MB,
6> MAXSIZE = 20,
7> FILEGROWTH = 10%)
8> LOG ON
9> (NAME = Database_2_log,
10> FILENAME = "c:\log.ldf",
11> SIZE = 4MB,
12> MAXSIZE = 10MB,
13> FILEGROWTH = 20%)
14> GO
1>
2> -- EXEC sp_helpdb Database_2
3> GO
1> DROP DATABASE Database_2
2> GO
1>
Create database from mdf file
CREATE DATABASE your_database_name
ON PRIMARY (FILENAME = "C:\dat.mdf")
FOR ATTACH
GO
drop database your_database_name
GO