- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2.CreateDatabase.sql
More file actions
Latest commit
21 lines (20 loc) · 722 Bytes
/
Copy path2.CreateDatabase.sql
File metadata and controls
21 lines (20 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
if exists(select*fromsys.databaseswhere name ='DBTEST')
dropdatabase DBTEST -- First check if database exists before dropping (for learning purposes only, avoid in production)
-- Create database
createdatabaseDBTEST
on-- Data file
(
name ='DBTEST', -- Logical name
filename ='D:\SQL_DATA\DBTEST.mdf', -- Physical path
size = 5MB, -- Initial size
filegrowth = 2MB -- Growth increment (can also specify percentage)
)
log on-- Log file
(
name ='DBTEST_log', -- Logical name
filename ='D:\SQL_DATA\DBTEST_log.ldf', -- Physical path
size = 5MB, -- Initial size
filegrowth = 2MB -- Growth increment (can also specify percentage)
)
-- Simple database creation with system defaults
createdatabaseDBTEST