方法一:
database-->所有任务——>attach database
方法二:
EXEC sp_attach_db @dbname = N'new_db',
@filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf',
@filename2 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.ldf
自动创建一系列数据库和用户
create dababase db1
use master
exec sp_addlogin 'username','password',’db1’
use db1
go
exec sp_adduser ‘username’,’db1’,'db_owner’