|
Maybe the C drive does not have permission to write, change a drive, D drive
use master
go
xp_cmdshell'mkdir d:\project', NO_OUTPUT - create a folder project, xp_cmdshell is a system stored procedure
--Check whether the database exists, if it is true, delete this database -
IF EXISTS(SELECT NAME FROM master.dbo.SYSDATABASES WHERE NAME=N'test')
DROP DATABASE stuDB
GO
--Create database--
CREATE DATABASE test
ON
(NAME=N'stuDB',
FILENAME='d:\project\testDB.mdf',
SIZE=1mb,
MAXSIZE=10mb,
FILEGROWTH=15%)
LOG ON
(NAME=N'stuDB_log',
FILENAME='d:\project\testDB.ldf',
SIZE=1mb,
MAXSIZE=4mb,
FILEGROWTH=15%)
GO |
|