Declare @a nt
,@b nvarchar(6)
SET @A = (SELECT MIN(A) FROM #DataToload)
while @A is not null
begin
Set @B = (select MIN(B) FROM #DataToload)
while @B is not null
begin
Select * from [XYZ].[dbo].[FactTbl]
WHERE
A = @A and B = @B
set @B = (select MAX(B) from [#DataToload]
where B> @B)
END
set @A = (Select MAX(A) from [#DataToload]
where A> @A)
END
Above query is generating two sets of data, one with @A and other one @B.
All I want it to pass both the variable in a loop and insert the data. Is it possible to define two variables in WHERE clause.