here is what I have and I want to loop through this set
select value from fxsplitint('1223,123,123',',')
fxsplitint is a function created to split the string on a delimiter
I want to say print each value after I do something with it
here is what I have and I want to loop through this set
select value from fxsplitint('1223,123,123',',')
fxsplitint is a function created to split the string on a delimiter
I want to say print each value after I do something with it
You could use a temp table to iterate through all the values in your list returned by the function.
DECLARE @rowcount int;
DECLARE @i int;
DECLARE @value int;
SET i = 0;
SELECT id = identity(int, 1,1), a.* INTO #yourtemptable FROM (
SELECT value FROM fxsplitint('1223,123,123',',')
)
WHILE (@i <= @rowcount)
BEGIN
SET @value = value FROM #yourtemptable WHERE id = @i;
SELECT @value; --output your value
SET @i = @i + 1
END
DROP TABLE #yourtemptable;