Sitee.in

Get A responsive website for Free , mobile-first projects on the web.

How to: Create trigger for auto update date with SQL Server 2008

By : amit

2016-03-17 07:01:24

How to: Create trigger for auto update date with SQL Server 2008

Let's try to create a trigger that auto-updates the Trans_Date column in my SQL Server table:


Table Name - Tbl_User_Master
1. UID (PK)
2. UserName
3. UserID
4. Password
5. Trans_date

I have a AFTER Insert trigger to update the Trans_Date column.

Trigger code:

Create TRIGGER Trg_Trans_Date
ON elect.Tbl_UserMaster
After INSERT
AS
update tbl_UserMaster set trans_date = getdate() where UID in (select distinct UID from Inserted)

Read More

--

Comment*
Website
Name*
Email*

*Required Field.

© 2015 blog.sitee.in