Sql Server2000建库

来源:互联网 发布:杨辉三角java代码递归 编辑:程序博客网 时间:2024/06/05 23:56

USE master
GO
--检查某一数据库testDB是否存在
if exists(select * from sysdatabases where name='testDB')
    drop database testDB
GO

--建库
exec xp_cmdshell 'mkdir D:/testDB'

CREATE DATABASE testDB
ON
(
  NAME='testDB_dat',
  FILENAME='D:/testDB/testdb.mdf', --主数据文件
  SIZE=100MB,
  FILEGROWTH=10MB
),
(
  NAME='testDB_dat1',
  FILENAME='D:/testDB/testdb.ndf', --次数据文件
  SIZE=50MB,
  FILEGROWTH=10MB
)
LOG ON
(
  NAME='testDB_log',
  FILENAME='D:/testDB/testdb.ldf', --日志文件
  SIZE=100MB,
  FILEGROWTH=10MB
)
GO

原创粉丝点击