新建HYGC_new,直接执行如下sql语句即可,原理即为将HYGC.bak直接还原到文件mdf与ldf中
//HYGC.bak为备份过来的文件;HYGC_new为新建的数据库
RESTORE FILELISTONLY FROM DISK = N'E:\nbdatabase\HYGC.bak'
RESTORE DATABASE HYGC_new
FROM DISK = 'E:\nbdatabase\HYGC.bak'
WITH MOVE 'HYGC' TO 'E:\software\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\HYGC_new.mdf',
MOVE 'HYGC_log' TO 'E:\software\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\HYGC_new_log.ldf'