exec sp_attach_db ‘bookstore‘,‘E:\homework\bookstore_Data.MDF‘,‘E:\homework\bookstore_Log.LDF‘
EXEC sp_attach_db @dbname = ‘bookstore‘, @filename1 = ‘E:\homework\bookstore_Data.MDF‘, @filename2 = ‘E:\homework\bookstore_Log.LDF‘
原文:http://www.cnblogs.com/tk55/p/6101717.html