Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing ON DELETE of FK constraint
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01514140
Message ID:
01514144
Views:
39
>Hi,
>
>I want to create the following foreign key constraint:
>
>
>alter table [dbo].[table1] add constraint [FK_table1_building]
>foreign key ([building],[site_no])
>references [dbo].[buildings] ([building],[site_no])
>on delete set null
>on update cascade
>
>
>But the above constraint requires that the table Table1 has column SITE_NO (int) as NULL. But I want that the SITE_NO to be NOT NULL. That is, when the entry is deleted from Buildings table I want the column Building in Table1 to be set to NULL but leave the SITE_NO column left without change. Is this possible? Can I modify the ON DELETE part of the above syntax to make it work as I want it? TIA.

That's job for trigger :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform