views:

48

answers:

2

Hi, question concerning MS-SQL:

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])

+3  A: 

I think this would work:

   Update mytable 
   Set idcolumn = newid()
brendan
+2  A: 

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()
Baddie
Or, for a smaller download, LinqPad: http://www.linqpad.net/
Martinho Fernandes