Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 System Date in trigger

Author  Topic 

Habibjee
Starting Member

2 Posts

Posted - 2006-05-15 : 03:15:40
What is the script to insert system date in a table at insertion time using trigger.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-15 : 03:20:11
Insert into yourTable (datecol) Select Getdate()

Otherwise define that column to have getdate() as default value

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2006-05-15 : 03:21:54
Why use a trigger ?

Why not just add GetDate() as a default value ?



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

Habibjee
Starting Member

2 Posts

Posted - 2006-05-15 : 05:05:52
Just to get an Idea that how values to be inserted using triggers
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-15 : 05:50:32
Read about Triggers in sql server help file

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -