Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TRIGGER dbo.TrgUpnInsert
- ON [CNLH Security Authentication].dbo.DateTimestamp
- AFTER INSERT,
- INSERT INTO [CNLH Security Authentication].dbo.EntranceInformation (DateTimestamp) Values (CURRENT_TIMESTAMP);
- CREATE TRIGGER ModDate
- ON TableX
- AFTER INSERT
- AS
- BEGIN
- UPDATE X
- SET ModifiedDate = CURRENT_TIMESTAMP
- FROM TableX X
- JOIN inserted i ON X.key = i.key -- change to whatever key identifies
- -- the tuples
- END
- ALTER TABLE myTable
- ADD CONSTRAINT CONSTRAINT_NAME
- DEFAULT CURRENT_TIMESTAMP FOR myColumn
- IF OBJECT_ID('tempdb..#temp') IS NOT NULL
- DROP TABLE #temp
- CREATE TABLE #temp (
- col1 VARCHAR(10)
- ,col2 DATETIME
- )
- ALTER TABLE #temp ADD CONSTRAINT ConstraintForTemp DEFAULT CURRENT_TIMESTAMP
- FOR col2
- INSERT INTO #temp (col1)
- VALUES ('abc')
- SELECT *
- FROM #temp
Add Comment
Please, Sign In to add comment