Hi,
I'm trying to put the results of a SELECT
into a variable and loop through the results to manipulate that data, all in the same stored proceedure... Here's what I have so far:
DECLARE @i int
@Result = (SELECT * FROM UserImport)
SET @i = 0
WHILE @i < (SELECT Count(@Result) As Count)
BEGIN
/* Do Stuff */
END
I know I'm way off because it's saying @Result
was not declared, but I'm not sure how to declare a variable to be able to hold the results of a SELECT
statement.
Can anyone tell me where i'm going wrong and how to fix it?
Thanks,
Matt