SSMS
 sql >> Database >  >> Database Tools >> SSMS

come inserire i valori nella colonna rowguid?

usa NEWID() funzione per generarne uno:

CREATE TABLE myTable(GuidCol uniqueidentifier
                    ,NumCol int)
INSERT INTO myTable Values(NEWID(), 4)
SELECT * FROM myTable

oppure puoi impostarlo come valore predefinito:

CREATE TABLE myTable(GuidCol uniqueidentifier DEFAULT NEWSEQUENTIALID()
                    ,NumCol int)
INSERT INTO myTable (NumCol) Values(4)
SELECT * FROM myTable