Procedure:
- Create your table with a column for your GUID field. Let's call it MyGUID.
- Set the Data Type as uniqueidentifier.
- Set the Default Value or Binding to NewID().
- Save your changes.
If you need to retroactively set the values you can run a SQL statement such as:
INSERT INTO tableName DEFAULT VALUES
NOTE: Of course this will set the default values for all fields that need it if they are null.
Or more selectively only change those that are null:
UPDATE tableName SET MyGUID=NEWID() WHERE MyGUID=null
0 comments:
Post a Comment