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

Update trigger to update another table

Status
Not open for further replies.
Joined
Jun 27, 2001
Messages
837
Location
US
I have an update trigger which fires from a transactiion table to update a parent record in another table. I am getting no errors, but also no update. Any help appreciated (see script below)

create trigger tr_cmsUpdt_meds on dbo.medisp for UPDATE as

if update(pstat)
begin
update med
set REC_FLAG = 2
from deleted dt
where med.uniq_id = dt.uniq_id
and dt.pstat = 2
and dt.spec_flag = 'kop'
end
 
Look like you may be missing a table name in your FROM statement. maybe it should look more like :

if update(pstat)
begin
update med
set REC_FLAG = 2
from deleted dt , med
where med.uniq_id = dt.uniq_id
and dt.pstat = 2
and dt.spec_flag = 'kop'
end
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top