檢視資料庫資訊
execute sp_helpdb northwind
刪除資料庫
包括其中所有資料檔案,在不使用本資料庫的狀態下才能執行。
drop
database northwind
修改資料庫名alter
database northwind modify name=northwind_000
增添資料檔案組3alter
database northwind add filegroup g3
給檔案組3增添資料檔案alter
database northwind add file
( name=northwindg31,
filename='d:\northwind\northwindg31.ndf',
size=1,maxsize=3,filegrowth=1
),( name=northwindg32,
filename='d:\northwind\northwindg32.ndf',
size=1,maxsize=3,filegrowth=1
)to filegroup g3
給檔案組3增添日誌檔案alter
database northwind add log file
( name=northwindlog3,
filename='d:\northwind\northwind3.ldf',
size=1,maxsize=5,filegrowth=1
),( name=northwindlog4,
filename='d:\northwind\northwind4.ldf',
size=1,maxsize=5,filegrowth=1
)
修改資料檔案屬性alter
database northwind modify file
( name=northwindg31, --要修改的檔案,不可修改 filename
size=2,maxsize=6,filegrowth=2 --指定的 size 必須大於當前值
)
刪除資料檔案alter
database northwind remove file northwind2
--alter
database northwind remove file northwindlog
alter
database northwind remove file northwindlog2
alter
database northwind remove file northwindlog3
alter
database northwind remove file northwindlog4
alter
database northwind remove file northwindg31
alter
database northwind remove file northwindg32
先刪除檔案組中的檔案,再刪除檔案組alter
database northwind remove filegroup g3
alter
database northwind remove file northwindg21
alter
database northwind remove file northwindg22
alter
database northwind remove filegroup g2
alter
database northwind remove file northwindg11
alter
database northwind remove file northwindg12
alter
database northwind remove filegroup g1
sql server修改資料庫名稱
use master go 修改資料庫名稱 alter database hroa i set single user with rollback immediate goexec master.sp renamedb hroa i hp oa goalter database hp oa set ...
C 資料庫SQLServer查詢 修改資料
今天又得寫乙個資料庫sql server讀寫的小工具,主要是涉及到一些簡單的操作,沒什麼技術含量。public static sqlconnection conn static void main string args 資料庫連線 private static void connectiondb ...
修改資料庫
改資料庫庫名稱 alter database 資料庫名稱 modify name 新資料庫名稱 或exec sp renamedb 資料庫名稱 新資料庫名稱 擴大資料庫 alter database語句擴大資料庫 alter database studentsys add file name stu...