Results 1 to 2 of 2

Thread: Cursor with parameters

  1. #1
    Zoraya Guest

    Cursor with parameters

    Hi everybody!
    I need your help.
    I want to do a store procedure with a cursor that looks like this
    CREATE PROCEDURE dbo.stp_JubiiTopDubletter @pr varchar(255)
    AS
    DECLARE
    cur_Dubletter
    CURSOR FOR
    SELECT * FROM discounts where id in (@pr)
    OPEN cur_Dubletter
    FETCH
    cur_Dubletter
    INTO
    @pr
    CLOSE cur_Dubletter
    DEALLOCATE cur_Dubletter

    for instance @pr='1,2,3'

    Somebody know how make the cursor variable??
    thank you for help
    Regards
    Zoraya

  2. #2
    IVO Guest

    Cursor with parameters (reply)

    YES ! )
    And can you guess maximum number of possible values in the @pr variable ?
    I guess that there is max. 88 integer values, if there are no spaces.
    So you could create up to 88 variables and write a little primitive parser to fill it, or create 88 parameters of stored procedure )


    ------------
    Zoraya at 7/30/01 3:06:21 PM

    Hi everybody!
    I need your help.
    I want to do a store procedure with a cursor that looks like this
    CREATE PROCEDURE dbo.stp_JubiiTopDubletter @pr varchar(255)
    AS
    DECLARE
    cur_Dubletter
    CURSOR FOR
    SELECT * FROM discounts where id in (@pr)
    OPEN cur_Dubletter
    FETCH
    cur_Dubletter
    INTO
    @pr
    CLOSE cur_Dubletter
    DEALLOCATE cur_Dubletter

    for instance @pr='1,2,3'

    Somebody know how make the cursor variable??
    thank you for help
    Regards
    Zoraya

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •