It's 6:30 AM and you've made my day :-) Thank you
---------------
Best regards
- Hans -
---------------
[quoted text, click to view] "Uri Dimant" wrote:
> Hans
> Take a look at INFORMATION_SCHEMA.TABLE_CONSTRAINTS view
>
>
> "Hans [DiaGraphIT]" <hans.arsjo@sshf.no> wrote in message
> news:ABFCB48A-590E-4C05-B308-A40C67ED3C41@microsoft.com...
> > 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 -
> > ---------------
>
>