Donate

Create A New SQL Server Database Basing From A Renamed DB (mdf/ldf) Files

I recently created a copy of Northwind database and called it NorthwindBootstrap. This database has a built-in membership tables added to it. The copy includes both of mdf and ldf files. My next step is to create a new database based from the recently copied/renamed files in which I have no idea on how to do it. After doing some research, I stumbled upon a t-sql script based from my requirement.
USE [master]  
 GO  
 CREATE DATABASE [NorthwindBootstrap] ON   
 ( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\NorthwindBootstrap.mdf' ),  
 ( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\NorthwindBootstrap.ldf' )  
 FOR ATTACH  
 GO  

Cheers! :)

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.