I have a table with 100 records with no PK.
I need to add random GUID to it. Before:
First Name Last Name GUID
John Smith
Alex Smith
etc
After:
First Name Last Name GUID
John Smith 34234234gyerfw
Alex Smith werwer32r23r
etc
Currently I can do it by:
Creating an identity column with values, then make a while loop and generate newid().
Any option on how to do this without a loop?
Add the GUID column as
NOT NULLwith a default ofNEWID()This will automatically populate the existing rows, an you will not need to specify a guid when inserting records.