Friday, February 24, 2012

How can I get or set a foreign key's 'on update cascade' or 'on insert cascade' by SQLDMO?

Hello,everyone!
I have a problem with sqldmo's KEY object,please help me!
When creating a foreign key constraint with 'on update cascade ' or 'on delete no action ' by T-SQL,we can do like this:
ALTER TABLE [dbo].[myForeignTableName] with nocheck
ADD CONSTRAINT [FK_mykeyname] FOREIGN KEY
([myForeignColumn])
REFERENCES [dbo].[myPrimaryTableName]
([myPrimaryKeyColumn])
on delete no action on update cascade

But,how can I set or get ' on delete no action on update cascade ' by SQLDMO's KEY object?

Thank you very much!
Toly.

DMO does not support cascaded delete. SMO however, does support it.|||

A thousand thanks for Michiel Wories's help! Your answer is very very heplful to me!

Koly.

No comments:

Post a Comment