Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2001
    Posts
    5

    Unanswered: cursor on results from stored procedure?

    I am working on a stored procedure that needs to pass through the results of another procedure, using a cursor. Any idea why this isn't working? The exec statement works fine when I try it on it's own.

    DECLARE myCursor CURSOR
    FOR (exec sp_splitstring @array = @searchstr, @separator = ' ')
    OPEN myCursor

  2. #2
    Join Date
    Oct 2001
    Location
    England
    Posts
    426
    Why not create a temp table instead of using a cursor.

    create table #a
    insert #a exec sp_...

    This looks like you are processing csv strings - I usually do this by

    create table #csvint (id int identity, myid int, value int)
    exec spProcCsvint myid = 1, csv =@csv

    In this way you can hold a lot of array values in the same table identified by the myid value.
    You can loop through the values using id - but usually you would just join to it.

Posting Permissions

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