Solved

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

Posted on 2008-06-24
6
303 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 47

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 47

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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 11

Author Comment

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

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sql 2014,  lock limit 5 32
SQL Update trigger 5 18
VB.NET 2008 - SQL Timeout 9 24
delete the first occurence of a duplicate row in sql 5 26
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
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.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how the fundamental information of how to create a table.

777 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