Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
I am trying to add code to my update trigger to calculate a annual, hourly and pay freq amount to store back to the table. After I calculate the values I have to following update:
update ee_job set
salary = @salary,
hour_rate = @hour_rate,
freq_rate = @freq_rate
where job_id = (select job_id from inserted)
This works fine if I am updating a sinlge record... but, if I try to run a select like...
update ee_job set mode = mode
to get the data in all records updated, I am told that the subquery returns more than one record. How can I limit the select into inserted to match the record that I am working with in the trigger?
Thanks,
BOb
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement