Choosing SEQUENCE instead of IDENTITY? Watch your step.

On the nice sunny day getting this error message can be really frustrating. In fact, it is frustrating on any day. Especially if you are doing something really simple. Most of you at this moment yell at your monitor “DDL Trigger!!!!” . Yes. I have a simple DDL trigger for auditing purposes. If you use the script below for the auditing table, any DDL statement will get pretty red notification to discard the results. CREATE DATABASE TestDB ; USE TestDB ; CREATE SEQUENCE GetNextNumber AS int START WITH 1 INCREMENT BY 1 ; CREATE TABLE dbo . TestAuditTable ( ID int NOT NULL DEFAULT NEXT VALUE FOR GetNextNumber PRIMARY KEY , ChangeDate datetime , ...