Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Posts
    5

    Unanswered: rename column with check constraints

    I want to change the name of a column. I tried to use sp_rename but i get the message:
    "Object 'table2.TelNoMob' cannot be renamed because the object participates in enforced dependencies."

    I think this is because the specific column has check constraint.

    Is there a way of changing the column's name?

  2. #2
    Join Date
    Oct 2001
    Location
    England
    Posts
    426
    You will have to drop the constraint and add it it again afterwards.

    This will give you the constraint name to drop

    select object_name(constid) from sysconstraints where id = object_id('tblname')
    and colid = (select colid from syscolumns where id = object_id('tblname') and name = 'colname')

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •