I have the following
CREATE TABLE [MyTable] ( [ID] [bigint] PRIMARY KEY NOT NULL, [Title] [nvarchar](64) NOT NULL ) CREATE SEQUENCE MyTableID START WITH 1 INCREMENT BY 1 NO CACHE ; GO
I want to insert new records on MyTable and set the ID to the next value of the sequence. How can I do it? A trigger perhaps, or is there some other way? How?
As I am using SQL Server 2012, I don't want to use Identity because of the gap bug.