[2005 경우]
row_number() over(order by colname)
예)
select top 10 row_number() over(order by id desc) as rownum,* from dts
union all
select top 10 row_number() over(order by id ) as rownum,* from dts
union 도 가능함...
[2000 경우]
mssql 2000에서는 select into 와 identity 사용..
일단 select into로 한번 집어넣고 사용해야 됨.
불펀함..
예)
select top 10 identity(int,1,1) as rownum, * into #temp from dts
select * from #temp
drop table #temp -- 지울때
row_number() over(order by colname)
예)
select top 10 row_number() over(order by id desc) as rownum,* from dts
union all
select top 10 row_number() over(order by id ) as rownum,* from dts
union 도 가능함...
[2000 경우]
mssql 2000에서는 select into 와 identity 사용..
일단 select into로 한번 집어넣고 사용해야 됨.
불펀함..
예)
select top 10 identity(int,1,1) as rownum, * into #temp from dts
select * from #temp
drop table #temp -- 지울때