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

passing variables to a Trigger

Status
Not open for further replies.

ronmon

IS-IT--Management
Feb 25, 2002
66
0
0
IE
How would i go about passing a varibale from a stored procedure to a trigger. I want to pass a stock code from a make order stored proc to a trigger which will check that stock code quantity against its reorder level and fire if its below
 
If you're accessing a Trigger through a sP why don't you just use the sp to do it all???

dlc
 
I wan to use a trigger because the table is being updated through replication
 
You cannot pass a variable from a stored procedure to a trigger. Triggers operate onthe table level and are fired even when someone changes the table manually through Enterprise Manager or witha SQL statement from a user interface or Query Analyser ora a stored procedure. Thus it makes sense mnot to try to get a value from a stored procedure into a trigger or it will not always work. If you need the value to do the trigger processing, you need to add a field to the table and store it. YOu can run a stored procedure from within a trigger, but someother process would have to trigger the trigger first, so you still would not be passing the value from your insert or update or delete stored procedure. Suggest you need to truly evaluate the process by which you want the processing to occur and decide then if you should add a field and poopulate it from the calling stored procedure or handle all the processing in a stored procedure or call a separate stored procedure from the trigger. Just be sure that you think about how your process will affect data integrity if an alternate method of affecting the table is used.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top