SQL Server 2008 GUID Column - All 0

I hope this is just what I did at my end ...

I have a table in my database configured like this:

column name: widget_guid
data type: uniqueidentifier
allow nulls: false
default value: newid ()
identity: false
row guid: true

When records are created (via LINQ to SQL) that the values ​​in this field are formatted as a GUID, but contain all 0

My assumption was that when a new record was created, this column would be autogenerated, as would the auto-increment identifier of the row. Is that not so? Any help would be greatly appreciated.

Thank.

+3
source share
2 answers

You need to check your properties in the GUID column - you need to make sure that:

  • Auto Generated Values True ( Linq-to-SQL, )

  • Auto-Sync OnInsert, # , context.SubmitChanges()

: GUID , , .SubmitChanges()

alt text

+7

dbml null. -nullable, LINQ , ; , NULL Guid.Empty, 0.

+1

Source: https://habr.com/ru/post/1785677/


All Articles