I am trying to put together a stored procedure with a dynamic execution path based on criteia it collects.
I am using a cursor to get the basic OrderID information and an 'Ordertype'. Ther type determines which other tables we need to access for scheduling and dispatching. These will be within separate stored procedures.
Below is what I have so far with the psuedocode that I am looking for.
My other option is to put this into the apps code and call the SPR's from the app.
Thanks.
zemp
I am using a cursor to get the basic OrderID information and an 'Ordertype'. Ther type determines which other tables we need to access for scheduling and dispatching. These will be within separate stored procedures.
Below is what I have so far with the psuedocode that I am looking for.
Code:
DECLARE @OID int,
@OT tinyint
DECLARE OrdCur CURSOR STATIC LOCAL FOR
SELECT top 10 OrderID, OrderType FROM THDIS.dbo.Orders WHERE (PostDate<='12/31/2006')
OPEN OrdCur
Fetch first from OrdCur into @OID,
while @@fetch_status = 0
BEGIN
-- psuedocode for what I am looking for.
CASE @OT
when 1 then SPR1 @OID
when 2 then SPR2 @OID
when 3 then SPR3 @OID
else SPR4 @OID
END
-- end of psuedo
-- Fetch the next record.
FETCH NEXT FROM OrdCur into @OID, @OT
END
CLOSE OrdCur
DEALLOCATE OrdCur
My other option is to put this into the apps code and call the SPR's from the app.
Thanks.
zemp