备份恢复数据库
BACKUP DATABASE TestDb TO DISK='d:\aaa.bak' // 备份数据库
RESTORE DATABASE TestDb FROM DISK='d:\aaa.bak'
WITH REPLACE,
MOVE 'TestDb' TO 'd:\TestDb_Data.mdf',
MOVE 'TestDb_log' TO 'd:\TestDb_Log.ldf'//恢复数据库并把数据库文件放到指定的地方
RESTORE FILELISTONLY FROM DISK='d:\aaa.bak'//默认数据库的地方恢复
SET IDENTITY_INSERT tablename ON//打开主键的插入,插入数据后记得关闭