How can I make it so that I can store the top 2 results in 2 variables?
create table t(id int);
insert into t (id) values (1),(2),(3),(4);
declare @id1 int
declare @id2 int
select top 2 @id1 = first id, @id2 = next id
Is there a way to make this happen in one query without using a loop?
September 19, 2013 1:14 PM
September 19, 2013 3:28 PM