I have a database that was recently migrated from Oracle to SQL Server 2017. Whoever initially setup the database set all the foreign keys to be system generated names. In other words if I look at the foreign keys in a table they are named (
SYS_C005272). I would prefer to have these all renamed to:
I would like to setup a script that will change all of the foreign keys to the approprite name. Is there a way to do this without having to go into each key to see it's definition and then renaming it by hand?
Note: I now realize after running Aaron Bertrand's script, I also need this for primary keys.