I am looking for what is hopefully something easily achievable without a ton of coding.
I have a stored procedure that does some work and has about 20 optional parameters:
CREATE PROCEDURE dowork
@param1_1=NULL,
@param1_2=NULL
.....@Param1_30=NULL
I am implementing another procedure, that will call that one, and ideally, I want to offer all the parameters, but only use those that have been set:
CREATE PROCEDURE CallWork
@param1=NULL,
@param2=NULL
.....@Param30=NULL
AS BEGIN
--Do some stuff
EXEC dowork
@param1_1=@param1,
@param1_2=@param2
.....@Param1_30=@Param30
Will the above example work as is, or do I need to create a variable of some sort to hold all the 'set' parameters for example?
The parameters are static. I have used number 1 to 30 as an example, but they are all static. Examples: @StartTime
, @EndTime
, @Type
, @Location
etc.
Currently dowork, processes a batches based on the input from the parameters. For certain workloads, I need it to process each batch, one at a time, instead of all at the same time.
By creating an abstracting procedure, I am planning to create a table variable to hold a row for each batch, and then pass them through one by one, allowing more control over each batch that we require in certain circumstances. This will then leave the original procedure to function as it did when required for mass batch jobs.