I made test table:
create table tmp (id BIGINT NOT NULL IDENTITY PRIMARY KEY)
Now I want to insert a value:
insert into tmp () values();
and it complains:
SQL Error [102] [S0001]: Incorrect syntax near ')'.
I cannot insert ID, because it fails with:
insert into tmp (id) values(1);
-- SQL Error [544] [S0001]: Cannot insert explicit value for identity column
-- in table 'tmp' when IDENTITY_INSERT is set to OFF.
DEFAULT syntax for VALUES is also forbidden:
insert into tmp values(default);
-- SQL Error [8101] [S0001]: An explicit value for the identity column in table 'tmp'
-- can only be specified when a column list is used and IDENTITY_INSERT is ON.
tmptable supposed to be used as some sort of counter?...because there already are objects that exist to be used as counters, such as Sequences. – J.D. Jun 22 '23 at 12:28alter ... default 0 not nulland needed the simplest temporary table signature. – gavenkoa Jun 22 '23 at 13:09IDENTITYisn't special, it's just another type ofDEFAULTconstraint. The same thing can be done with any table with defaults on all columns (evenNULLas the default). – Charlieface Jun 22 '23 at 13:31