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   


Enter the name of the database (1) and choose the location to save it (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


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

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

for attach


Attached existing database files (Graphical view)

Right-click on Databases tree in Management studio

Select Attach…


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



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  


1st Floor, Cradock Square, 169 Oxford Road,
Rosebank, Johannesburg, 2196, South Africa

Get Direction
Contact details

Phone: +27-11-759-4048


Open Hours

Monday - Friday: 8 AM - 5 PM


Contact Us 

Copyright © 2024. GDS Consulting. 

DMC Firewall is developed by Dean Marshall Consultancy Ltd