EXEC SP_ATTACH_SINGLE_FILE_DB @dbname = '' '% s' ', @physname =' '% s' '; EXEC SP_ATTACH_DB @dbname =' '% s' ', @ filename1 =' '% s', @ filename2 = '' % s' ''
DBNAME: Database name
Filename1: Database file 1 (MDF)
FileName2: Database File 2 (LDF)
PhysName: Database Main File (MDF)
Such as: dbname = 'master'
Filename1 = 'c: / program files / microsoft sql server / mssql / data / master.mdf'
Filename2 = 'c: / program files / microsoft SQL Server / MSSQL / DATA / MASTLOG.LDF'
PhysName = 'c: / program files / microsoft SQL Server / MSSQL / DATA / MASTER.MDF'