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 Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trigger for update and insert with select condition

Status
Not open for further replies.

fredong

IS-IT--Management
Sep 19, 2001
332
US
Hi,
I have a table below

Table A

ID ModDate InputDate Type
1 12/1/05 12/3/05 2
2 1/13/06 1/30/06 5
3 2/14/06 2/23/06 4

and I need to create a trigger to capture only if there is an Update on 'ModDate' with the 'Type' = 5 or an Insert row with the Type ='5'. The trigger will trigger to B table. Please advise. Thanks
 
It will be easier if you do this as two triggers. One for inserts and one for updates. For the update trigger use the UPDATE() function to findout which columns were updated.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top