A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
This presumes that all procedures have the same parameter profile:
DECLARE @DRIVERTABLE TABLE
(
SP_Name VARCHAR(50),
Country VARCHAR(50),
SELLCLAS VARCHAR(50),
SELLID VARCHAR(50),
CustomerNo VARCHAR(50),
SelectionBIT INT
)
DECLARE @cur CURSOR,
@SP sysname,
@Country varchar(50),
@SELLCLAS varchar(50),
@SELLID varchar(50),
@CustomerNo varchar(50),
@selectionBIT int
SET @cur = CURSOR STATIC FOR
SELECT SP_Name, Country, SELLCLAS, SELLID,
CustomerNo, SelectionBIT
FROM @DRIVERTABLE
OPEN @cur
WHILE 1 = 1
BEGIN
FETCH @cur INTO @SP, @Country, @SELLCLAS, @SELLID,
@CustomerNo, @selectionBIT
IF @@fetch_status <> 0
BREAK
EXEC @SP @Country, @SELLCLAS, @SELLID,
@CustomerNo, @selectionBIT
END