Home All Groups Group Topic Archive Search About

Scripting foreign key relationship on a table

Author
1 Dec 2005 7:15 PM
Mike
I have created a couple of new foreign key relationship on my table using
enterprise manager. I want to script these changes and send it to my client
so that they can update the relationships on their end. how can I do it?

Author
1 Dec 2005 7:35 PM
Trey Walpole
Look up ALTER TABLE in BOL.

e.g.

ALTER TABLE <table>
   ADD CONSTRAINT <FK constraint name> FOREIGN KEY (<FK column1>,<FK
column2>,...)
   REFERENCES <referenced table> ( <key column1>, <key column2>, ...)

you can get this from Query Analyzer as well, by going to the table in
the object browser, opening the Constraints folder, right click on the
constraint, select Script Object to <target> As \ Create

Mike wrote:
Show quote
> I have created a couple of new foreign key relationship on my table using
> enterprise manager. I want to script these changes and send it to my client
> so that they can update the relationships on their end. how can I do it?
>
>

AddThis Social Bookmark Button