MSSQL-实用小工具

1.创建查询辅助表

create table nums (n int not null)
alter table nums add constraint PK_NUMS primary key clustered(n)

;with cte as
(
select 1 as n
union all
select n+1 from cte
where n<=99
)
insert into nums
select (a.n-1)*10000+(b.n-1)*100+c.n
from cte a
inner join cte b on 1=1
inner join cte c on 1=1
order by 1

 

posted @ 2016-11-30 14:55  踏叶乘风  阅读(179)  评论(0编辑  收藏  举报