Apr 10, 2006 #1 mbcmike Programmer Joined Sep 9, 2005 Messages 34 Location US I want to execute a procedure depending on whether or not a paramater is in a particular table: execute procedure where not exists (select * from table where ssn = @p_ssn ) Obviously I am doing something wrong here...
I want to execute a procedure depending on whether or not a paramater is in a particular table: execute procedure where not exists (select * from table where ssn = @p_ssn ) Obviously I am doing something wrong here...
Apr 10, 2006 1 #2 SQLBI IS-IT--Management Joined Jul 25, 2003 Messages 988 Location GB Hi, Declare an int variable and assign its value based on the result of your query, then execute your proc based on the variable value. Code: DECLARE @var int IF NOT EXISTS (SELECT * FROM Table WHERE ssn = @p_ssn) BEGIN SET @var = 0 END ELSE SET @var = 1 IF @Var = 1 EXEC pr_YourProc Or something similar... Hope this helps. Cheers, Leigh Sure, if it has a microchip in it, it must be IT... Now what seems to be the problem with your toaster...? Upvote 0 Downvote
Hi, Declare an int variable and assign its value based on the result of your query, then execute your proc based on the variable value. Code: DECLARE @var int IF NOT EXISTS (SELECT * FROM Table WHERE ssn = @p_ssn) BEGIN SET @var = 0 END ELSE SET @var = 1 IF @Var = 1 EXEC pr_YourProc Or something similar... Hope this helps. Cheers, Leigh Sure, if it has a microchip in it, it must be IT... Now what seems to be the problem with your toaster...?
Apr 10, 2006 Thread starter #3 mbcmike Programmer Joined Sep 9, 2005 Messages 34 Location US That's it, thanks! Upvote 0 Downvote