Results 1 to 1 of 1
Nov 24, 2004, 15:05 #1
- Join Date
- Jul 2004
- 0 Post(s)
- 0 Thread(s)
MS SQL Server: Calling a stored proceedure from a trigger
i have a trigger that responds to a column level update.
I also would want to run a stored proceedure from the trigger to update a certain table. Am using the following code, but doesnt seem to work. What is wrong and
2. HOw do i pass the variables from the trigger accross to the stored proceedure ?
Trigger is below
CREATE TRIGGER [PO_AGREEMENT_UPDATE] ON [dbo].[e_invoice]
IF UPDATE (STATUS)
declare @email varchar (50), @purse_2 money
@email = (select email from inserted) -- Only one row could be inserted here
@purse_2 = convert(money,'45000')
-- I have edited the unecessary code here
exec update_wallet @email, @purse_2
Stored proceedure being called is :
CREATE PROCEDURE [dbo].[update_wallet]
AS UPDATE [com_sql].[dbo].[e_wallet]
SET [purse] = @purse_2
( [email] = @email)
I would prefer to leave the code below as a SP 'cos its being called by other applications to update the same table, whenever a transaction is completed.
One last question, my web host gave me a login as SQLuser, would it be advisable to create my Stored proceedures as dbo or SQLuser ?
Please advice on the above ?