Generate new GUID in SQL Server if one is not provided

后端 未结 2 776
一整个雨季
一整个雨季 2021-01-17 12:06

I am updating my database to have a column for a GUID for each record in a table.

This table is populated by several different sources and some of them will not pr

2条回答
  •  被撕碎了的回忆
    2021-01-17 12:43

    You can set the default value for the column to NEWID(). Then a GUID will be created and assigned only if one hasn't already been.

提交回复
热议问题