Click here to Skip to main content
15,849,494 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How To Rename Foreign Key Constraint using Sql SCript.

I have 2 tables Pord & POrdRev
PordRev has POrdID Column having Foreign Key Constraint with Pord.
Name of the foreign key:FK_Pord_PordRev

Now Without Dropping this constraint i want to rename it with FK_PordRev_Pord.
How can i do it?

1 solution

Try the sp_rename procedure:
sp_rename 'FK_Pord_PordRev','FK_ProdRev_Pord'
But if it's a one off, I'd probably do it in SSMS...
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900