Constraint Names Problem

  • Hi Gurus,

    I want to migrate DB schema changes to various sites running SQL 2000. My script drops some existing constraints and creates new ones.

    The problem is when the constraints were created in past no name was provided to them and now the constraints on the same table across different databases/servers have different names (given by sql server). Now I can't have one generic db update script for all sites.

    Please help with some workarounds... I can provide more details and examples if required..

    Thanks,

    Harman

  • Are you dropping all existing costraints on a table or selective ones. If all then you should be able to write a cursor to use the sys tables (i think sysobjects) to get the names for each and loop thru to drop them.

  • Thanks for the reply... I am only dropping the constraint on some tables...for eg if I want to move the PK to some other column, I would have to drop the PK constraint on the table and then add a new constraint on the new column.

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

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