Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Don't know how to create simple trigger

Status
Not open for further replies.

ckevin

MIS
Jul 22, 2003
8
US
Hi all, I am a new guy for MS SQL server, and I have a question on how to create a trigger.

I have one table PO, there are 4 columns: rowid, creater, modifier and PO_detail

What I want to do is to check out all the modification did by user "ELLEN" during last week. (12/8 - 12/12). Of course, it is update statement and his name are recorded at "modifier" column.

Just wondering what's the best way to do so.

Thank you very much

Best regard,
Kevin Chan

 
Hi Kevin,

Using an Insert or Update trigger, you query the Fake Table called "Inserted" to get the info you wish.

Declare @Modifiedby varchar(50)
Select @Modifiedby =modifier from inserted
If @Modifiedby = "Ellen"
--Do something

Happy Hollidays
MikeD


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top