We can add by using wizard also by right clicking on DB ->Attach->Choose Physical Loaction ->remove log file and clikc ok .
AdventureDB Link : https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks2008r2
But the manual process is quick and easy..
Method 1&2 :
Method 2:
AdventureDB Link : https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks2008r2
But the manual process is quick and easy..
Method 1&2 :
USE [master] GO-- Method 1: I use this methodEXEC sp_attach_single_file_db @dbname='TestDb',@physname=N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\TestDb.mdf'GO-- Method 2:CREATE DATABASE TestDb ON(FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\TestDb.mdf')FOR ATTACH_REBUILD_LOG
GO
Method 2:
CREATE DATABASE TestDb ON( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\TestDb.mdf')FOR ATTACH
GO
No comments:
Post a Comment