Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use Sql script from Development Db in Live Db

Status
Not open for further replies.

afeets

Technical User
Dec 8, 2003
12
GB
This is my first real project in SQL, so I could do with some advice in the best way forward for future reference.

I have created two SQL database's one live, one development. All the design work has been done on the Development Db, I now want to create the tbl's, views etc in the Live Db. However when I generate the SQL Script, the syntax is ok, but the order of creation is wrong. I.e it tries to create a view based on a table that the script hasn't run yet.

Obviously I can go through the whole script and cut and paste it into the correct order, but I am sure it is not meant to be this awkward.

Can you help??
 
I have 8 text documents

0. Drop Table
1. CREATE TABLE
2. ALTER TABLE
3. INSERT STATEMENTS
4. UPDATE STATEMENTS
5. CREATE VIEWS
6. ALTER VIEWS
7. CREATE SP
8. ALTER SP

i put the relevant scripts in each of these and then run them in that order.

occasionally i need to do something else, so i add that as a seperate file at the begining, i find this order works 90% of the time.




Chance,

F, G + Its official, its even on a organisation chart et all
 
you could generate the various script types seperately...

however, would it not be easier to just copy the database onto the live server? detach/attach or backup/restore?

it would be quite easy to write a general script to delete and clean up all the tables...

--------------------
Procrastinate Now!
 
Chance and Crowley thanks for your response, both suggestions are more than acceptable. However I just thought that there might have been a way to bypass SQL script errors.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top