Solved

SQL Script Dependencies and Contraints -> OUT to pull into modified db

Posted on 2008-06-24
6
299 Views
Last Modified: 2012-06-21
I have 2 databases... One original and one modified (they are UGLY) :)  
My issue is that after the modification to the 'modified' one, alot of the contraints/dependencies seem to have been exluded or rearranged....
150+ tables datatype change from int to varchar(30) was the modification (dont ask, as I inherited this with much resistance... :))
What I would like to be able to do:
1. script the contraints and foriegn key stuff (I am not a sql dba at all) from the original
2. change the script if needed to reflect the varch(30)
3. run the cript on the modified db....

Any suggestions/solutions/tools / ???????

Thanks for your time....
0
Comment
Question by:William
  • 3
  • 3
6 Comments
 
LVL 45

Accepted Solution

by:
Vitor Montalvão earned 500 total points
ID: 21864603
You can generate scripts by right-clicking over databbase name in SQL Server Enterprise Manager (SQL Server 2000) or in SQL Server Management Studio (SQL Servr 2005) and then choose "Generate SQL Scripts...".
After you generate script use a file editor and with a simple find/replace modify it.
Save it and run it over new DB.

Good luck
0
 
LVL 11

Author Comment

by:William
ID: 21865642
WHat kind of script...  create/drop/etc... ????
0
 
LVL 45

Expert Comment

by:Vitor Montalvão
ID: 21865676
Just script all objects and don't worry. :)
SQL Server will do the rest for you.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 11

Author Comment

by:William
ID: 21866089
Will this allow me to keep the data in the modified db?
0
 
LVL 45

Expert Comment

by:Vitor Montalvão
ID: 21866705
No. You'll need to import all data again.
0
 
LVL 11

Author Closing Comment

by:William
ID: 31470418
I had to learn quite a bit here...     All said it was worth not having a hand holding mine!!!   Thanks for direction!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now