Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to import database files to SQL server

Author  Topic 

arthiasha
Starting Member

40 Posts

Posted - 2012-08-17 : 08:26:14
I have some SQL server query files, which i need to add it my local SQL server management studio express 2005.

The file contains all the scripts of creating tables, many stored procedures. I FTP it from the server and now i have to add the whole schema into my machine and execute it... i.e i need to import the database into mine... please help to do with steps

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-08-17 : 08:53:55
You should be able to open SQL Server Management Studio, open or copy each file into a query window and execute them (from the top menu Query -> Execute) to execute them. HOWEVER:

Before you do that, look through the files to see what they do. They may need to be run in specific order; for example if one file creates a database and another creates tables in that database, you will need to run the first file before running the second.

If you have a test environment, run them in the test environment to make sure that they are doing what you expect them to do.

Also, after you run each, look carefully at the output and message windows to see if any errors were generated.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-17 : 10:09:26
if you attempt is to import database why not take a backup and restore it to your server? that would be easiest thing to do to get an exact replica of db. Unless db has some sensitive info which you shouldnt be getting access to that would be best way I guess.
If not possible, as Sunita suggested you need to analyse and determine sequence of scripts before you apply them.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -