能用语句不?USE [master] GO CREATE DATABASE [Test] ON ( FILENAME = N'D:\Local\Test.mdf' ) FOR ATTACH GO
不能create database , 因空間已create了, 自没有内容.
这样也不成 : sp_attach_single_file_db 'new_db_name', 'mdf_file_location'Replace "new_db_name" with the name of the new SQL database. Replace "mdf_file_location" with the physical location of the MDF file. This is the full physical path such as "C:\directory\mdf_file.MDF."
GO
CREATE DATABASE [Test] ON
( FILENAME = N'D:\Local\Test.mdf' )
FOR ATTACH
GO
sp_attach_single_file_db 'new_db_name', 'mdf_file_location'Replace "new_db_name" with the name of the new SQL database. Replace "mdf_file_location" with the physical location of the MDF file. This is the full physical path such as "C:\directory\mdf_file.MDF."