看看系统存储过程的用法: sp_attach_single_file_db [ @dbname = ] 'dbname', [ @physname = ] 'physical_name'Examples This example detaches pubs and then attaches one file from pubs to the current server.EXEC sp_detach_db @dbname = 'pubs' EXEC sp_attach_single_file_db @dbname = 'pubs', @physname = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf'先备份好mdf文件.
This example detaches pubs and then attaches one file from pubs to the current server.EXEC sp_detach_db @dbname = 'pubs'
EXEC sp_attach_single_file_db @dbname = 'pubs',
@physname = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf'先备份好mdf文件.