Dropping a constraint

  • Hi folks

    I want to write generic code which will drop a given column from a given table. However I need a way to find out if there is a constraint on the column and if so drop this first and then drop the constraint.

    I am new to sql server and could do with some help...

    Thanks.

  • Hi,

    This query will list all constraints on a given table.

    select *

    from sysobjects

    where parent_obj in (select id from sysobjects where name = '<TableName>') and type = 'C'

    Clive Strong

    clivestrong@btinternet.com

Viewing 2 posts - 1 through 1 (of 1 total)

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