数据库
首页 > 数据库> > 执行脚本附加sqlserver数据库.mdf 、.ldf

执行脚本附加sqlserver数据库.mdf 、.ldf

作者:互联网

1.在数据库中新建查询,NewFile是数据库名称(可更改),.mdf,.ldf放在对应得C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA对应得数据文件下,执行脚本即可

USE master;
GO
CREATE DATABASE NewFile
ON (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\db_NetShop.mdf'),
(FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\db_NetShop_log.ldf')
FOR ATTACH;
GO

标签:Files,ldf,sqlserver,MSSQLSERVER,mdf,Program,DATA
来源: https://www.cnblogs.com/wwzz/p/14505557.html