Rename of Foreign key/Default name

  • Hi All,

    I need to rename Foreign key/Default constraint name.

    With SP_RENAME I can rename primary key name but not Foreign key/Default name.

    Please suggest how I can get this.

    Thanks

    KD

  • You could probably drop and recreate the FK constraint with the new name.

    Also take a look at http://qa.sqlservercentral.com/scripts/Miscellaneous/30924/ which renames all FK constraints; but should give you some ideas for renaming just the one constraint.

    HTH,

    Rob

  • i just renamed a foreign key no problem...

    sp_rename 'FK__SFPLGRP__SFGROUP__000BC426','FK_SFPLGRP_to_SFGROUP'

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Thanks a lot

    without table name its works.............................................

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

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