Skip to content

M$_SQL autoincrement and GUID

Ovidiu edited this page Mar 19, 2022 · 1 revision

Auto-increment

An autoincrement field is specified as

fieldname int IDENTITY NOT NULL

To reset the increment counter:

DBCC CHECKIDENT ('tablename', RESEED, 0);

RowGuid

-- rowguid uniqueidentifier ROWGUIDCOL  NOT NULL,
rowguid uniqueidentifier DEFAULT newid() NOT NULL,
CONSTRAINT constraintname PRIMARY KEY (rowguid)

Clone this wiki locally