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 myCursorWhy 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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment