.mdf和.ldf还在的话
用sp_attach_db 恢复
sp_attach_db [@dbname =] 'dbname',
[@filename1 =] 'filename_n' [,...16]
Arguments
[@dbname =] 'dbname'
Is the name of the database to be attached to the server. The name must be unique. dbname is sysname, with a default of NULL.
[@filename1 =] 'filename_n'
Is the physical name, including path, of a database file. filename_n is nvarchar(260), with a default of NULL. There can be up to 16 file names specified. The parameter names start at @filename1 and increment to @filename16. The file name list must include at least the primary file, which contains the system tables that point to other files in the database. The list must also include any files that were moved after the database was detached.
Return Code Values
0 (success) or 1 (failure)
注意打全路径