I want to set a variable equal to a value in a table that is at a certain row number. I don't need an OVER (ORDER BY...) clause, because I want the order to be the order that the values were entered into the table (as if using an ID, but my table does not have an id column, so need to use ROW_NUMBER()). This doesn't work:
WHILE @c < @totalrows
BEGIN
SET @variable = (SELECT Variable FROM @thisTable WHERE ROW_NUMBER() = @c)
(more code to manipulate values)
SET @c = @c + 1
END
Gina