Solved

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

Posted on 2008-06-24
6
302 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 46

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 46

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 11

Author Comment

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

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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.

911 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

15 Experts available now in Live!

Get 1:1 Help Now