GDS Consulting

Creating the right data management policies, procedures, and processes to ensure it remains accurate, secure, accessible, and usable for analytics insights should be a top priority.

  Tuesday, 7 August  2018 By Fred Mintah

Creating a new or attaching a database

Once you have established connection to your LocalDB server, you may want to attached an existing database files or create new ones.(If you don't know how to connect to the LocalDB, please follow this link Connecting to Microsoft SQL Server LocalDB )

To do this, you have a number of options.

  1. Create a new database
  2. Attached existing database files (graphical and scripting)
  3. Restore a backup file

Creating a new database

     Right-Click on the Databases tree in Management Studio and select New Database   

           1

Enter the name of the database (1) and choose the location to save it (2)    

           2      

 

Attached existing database files (scripting)

  1. Locate the location hosting the database files
  2. Open New Query in SQL Management Studio
  3. Use the Create database syntax to attached a database

create database MyLocalDB2

on

(filename = 'C:\Temp\LocalDB\LocalDB.mdf'),

(filename = 'C:\Temp\LocalDB\LocalDB.Ldf')   

for attach

           3

Attached existing database files (Graphical view)

Right-click on Databases tree in Management studio

Select Attach…

          4

From here, browse for the source location of the data file of the database files to be attached.

Double click ( .mdf file) to open or select, then click OK button to attach

          5     

 

Restore Database from a backup file

  The process to restore a database file is the same as attaching a database but the extention of the restore file is a .bak file extention  

Location

4th Floor, The Firs, Cnr Bierman & Cradock Avenue,
Rosebank, Johannesburg, 2196, South Africa

Get Direction
Contact details

Phone: +27-11-759-4048

 

Email: info@gdsconsulting.africa
Open Hours

Monday - Friday: 8 AM - 5 PM

 

Contact Us 

Copyright © 2019. GDS Consulting.