Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE [dbo].[table] (
- tableID [int] IDENTITY(1,1) NOT NULL
- , DatumCreate [datetime] DEFAULT GetDate() NOT NULL,
- , other values ....
- , CONSTRAINT pk_FactuurID PRIMARY KEY (FactuurID)
- )
- GO
- CREATE TRIGGER my_trigger
- ON my_table
- AFTER INSERT, UPDATE, DELETE
- AS
- BEGIN
- if exists(select * from inserted)
- -- we're covering just insert cases here..
- begin
- insert into my_table(col1, col2, col3, ..., col_timestamp)
- select inserted.col1, inserted.col2...., CURRENT_TIMESTAMP from inserted
- end
- END
- GO
Add Comment
Please, Sign In to add comment