创建数据库
USE master; GO CREATE DATABASE ToyUniverse ON ( NAME = ToyUniverse_Data, FILENAME = 'F:\Project Files\SQL Server\DATA\ToyUniverse_Dat.mdf', SIZE = 10, MAXSIZE = 50, FILEGROWTH = 5 ) LOG ON ( NAME = ToyUniverse_Log, FILENAME = 'F:\Project Files\SQL Server\DATA\ToyUniverse_Log.ldf', SIZE = 5MB, MAXSIZE = 25MB, FILEGROWTH = 5MB ) ; GO
删除数据库
DROP DATABASE ToyUniverse
修改数据库
ALTER DATABASE ToyUniverse ADD FILE ( NAME = ToyUniverse_Data2, FILENAME = 'F:\Project Files\SQL Server\DATA\ToyUniverse_Data2.mdf', SIZE = 10, MAXSIZE = 50, FILEGROWTH = 5 )
--增加一个数据库日志文件 ALTER DATABASE ToyUniverse ADD FILE ( NAME = ToyUniverse_Log2, FILENAME = 'F:\Project Files\SQL Server\DATA\ToyUniverse_Log2.mdf', SIZE = 10, MAXSIZE = 50, FILEGROWTH = 5 )
修改后:
使用SQL语句查看数据库
SELECT DATABASEPROPERTY('ToyUniverse','Version')
结果:
使用存储过程查看数据库
sp_helpdb
结果: