Drop Consatraint

  • Hello Everyone

    Hope that everyone is well today.

    I am working on some database code. Imagine that.......

    I am need to drop a constraint, I have the syntax for that, no problem. I am using "Alter Table". If anyone has something better or something else. I do not know of anything else.

    I am wanting to check the existence of the Constraint before trying to drop it. Just like you would before you drop a procedure or a table. In what system table does a constraint exist that I can query before dropping

    Thanks

    Andrew SQLDBA

  • this will give you all constraint in particular database.

    select * from sys.objects where type_desc like '%_CONSTRAINT'

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • Cool

    Thanx

  • There are additional system views if you are looking for a particular type of constraint.

    See Object Catalog Views

    Examples include:

    sys.check_constraints

    sys.default_constraints

    sys.key_constraints

    Paul

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply