Is there a way to write a script that examines each table in the database, looking for a uniqueidentifier column named ID, and then add a DEFAULT constraint of NEWID() to the column if a DEFAULT constraint does not exist?
Is there a way to write a script that examines each table in the
Share
Edited per OP’s commented clarification
This script creates a
DEFAULTconstraint ofNEWID()on anyuniqueidentifiercolumns namedIDthat do not already have aDEFAULTconstraint.