Sql – Inserting a GUID to each existing row


question concerning SQL Server:

I have added a column with type uid to a table with already existing data.

How can I insert a guid in each row of this existing table?

(I mean without reading out the data with a dataadapter, adding a guid for each row and the updating the table [unless there is a method to automatically generate the update command])

Best Solution

Do it in SQL by running a query against your database. You could use SQL Server Management Studio.

UPDATE table_name
SET column_name = newid()