Groups | Blog | Home
all groups > sql server programming > november 2005 >

sql server programming : how do I check if constraints exists?



Hans [DiaGraphIT]
11/23/2005 9:01:01 PM
Hi!

I want to create constraints, but I want to check if the constraint exists
first. How do I do that?

I think something like following example would work for me, but I'm not sure
how to check... filling the space between ...exists (...)

IF NOT EXISTS (.......)
ALTER TABLE UserTable
ADD CONSTRAINT Language_UserTable FOREIGN KEY (fk_LanguageID) REFERENCES
Language (LanguageID) ON DELETE CASCADE ON UPDATE CASCADE
GO

Please help
---------------
Best regards
- Hans -
Hans [DiaGraphIT]
11/23/2005 9:34:03 PM
It's 6:30 AM and you've made my day :-) Thank you
---------------
Best regards
- Hans -
---------------


[quoted text, click to view]
Uri Dimant
11/24/2005 12:00:00 AM
Hans
Take a look at INFORMATION_SCHEMA.TABLE_CONSTRAINTS view


[quoted text, click to view]

AddThis Social Bookmark Button