Is there a way of using different sets of parameters in one stored procedure?
Posted on 2005-03-18
Suppose I have the following code
CREATE PROC procMyProcedure
--Is the following the only place in which you can introduce parameters to a stored procedure or can you do it anywhere in code?
Declare @MyVariable Int
If @Flag = 'I'
INSERT INTO MyTable
SELECT @MyVariable = @@IDENTITY
How can I add the following code which relies on completely different set of parameters?
I am trying to establish an update pattern that can take different sets of parameters.
Declare @MyVariableb Int
If @Flag = 'Ib'
INSERT INTO MyOtherTable
VALUES (@Param1b,@Param2b,@Param3b,@Param4b)-- These parameters don't exist but how can I make them exist?
SELECT @MyVariableb = @@IDENTITY
Is it possible to alter this procedure such that it can use different parameters?
Hope this is clear