
July 3rd, 2003, 03:59 PM
|
|
Junior Member
|
|
Join Date: Jun 2003
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
SQL DMO + Foreign Keys
I have table1 that has a Foriegn Key to table2, using the sql dmo i am able to get the script from Table1 to create the Foreign key with Table2 no problem
Set objTable = objDatabase.Tables("table1")
strSQLScript = objTable.Script(SQLDMOScript_DRI_ForeignKeys)
strSQLScript Now = "ALTER TABLE [TABLE1] ADD CONSTRAINT [FK_TABLE1] FOREIGN KEY ( [Table2Id] ) REFERENCES [TABLE2] ( [Table2Id] ) NOT FOR REPLICATION"
My question is: Is thier any way to do this backwards, I want to use the DMO and Table2 to
find out if any relationships exist.
Thus returning TABLE1 and the script as noted above.
thanks in advance.
|