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
 Database Design and Application Architecture
 Relationship Script

Author  Topic 

Fishy
Starting Member

5 Posts

Posted - 2009-02-02 : 12:08:32
Hi,

I have a database that was created by a third-party. It has no table relationships.

I'm adding relationships in SQL Server Managment.

Is there a way to generate a script of just the relationships and then appy that script at a later date>

If I can't do this then when a new database is created I will have to manually add the relationship again.

Thanks,

Fishy

mfemenel
Professor Frink

1421 Posts

Posted - 2009-02-02 : 12:15:30
When you add the relationships via management studio you should have an icon available to you to save that change as a script. I would keep a running file of your changes, save it and then apply it when a new db is created.

Mike
"oh, that monkey is going to pay"
Go to Top of Page

Fishy
Starting Member

5 Posts

Posted - 2009-02-04 : 18:40:02
Thank you for your suggestion. I also set it to automatically create a script file when changes are made.

What a hassle, you would think there would be a better way.
Go to Top of Page

Fishy
Starting Member

5 Posts

Posted - 2009-02-04 : 19:17:26
I found that I could use the Generate Script Wizard and generate a script for the entire database. The relationships are at the end of the generated file.
Go to Top of Page
   

- Advertisement -