I have created a shadow table and two triggers to send relevant
information to this table. I want the shadow table to generate an auto
number for me as a primary key (orderID), but when I run my trigger
code, it says that I can't insert NULLs into my identity field. Can
someone please review the following SQL for errors?

Thank you in advance,

Greg Friedman



CREATE TABLE object_updates (orderID numeric(5,0) identity, objname
varchar(255), objid varchar(15), action varchar(255))
go

CREATE TRIGGER t89_insert_trigger ON T89
FOR INSERT AS
BEGIN
INSERT INTO object_updates (objname,objid,action)
SELECT 'DN',INSERTED.C1,'add'
FROM INSERTED
WHERE INSERTED.C1 LIKE 'DN%'
END
go

CREATE TRIGGER t89_update_trigger ON T89
FOR UPDATE AS
BEGIN
INSERT INTO object_updates (objname,objid,action)
SELECT 'DN',DELETED.C1,'change'
FROM DELETED, INSERTED
WHERE DELETED.C536870924 != INSERTED.C536870924
AND DELETED.C1 LIKE 'DN%'
END
go