|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Trigger, selecting value from row.
Hi,
I am not sure how to use a value from a row that is being updated, i.e. a cell in that row is updated, and I need to use a value from another cell in the trigger query. How do I get this value? Longer explanation: I update someone's pointsbalance and need to get their teamID in the trigger that occurs after the update has suceeded. The teamID is not part of the original query and therefore isn't recognised in FROM UPDATED, but is a column in that table..... |
|
#2
|
|||
|
|||
|
Hopefully this makes it a bit clearer:
Code:
CREATE TRIGGER trig_UpdateTeamPoints ON UserLogin FOR UPDATE AS DECLARE @TeamID VARCHAR(7) IF UPDATE(UserLoginPointsBalance) BEGIN SELECT @TeamID = (****HAVE TO GET THE TEAMID FROM THE AFFECTED ROW****) **UPDATE A ROW IN ANOTHER TABLE BASED ON @TeamID** END |
|
#3
|
|||
|
|||
|
Nevermind...I worked it out myself.
It is indeed possible to use JOINS in the query.... |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Trigger, selecting value from row. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|