日期:2014-05-17 浏览次数:20567 次
if object_id('[TB]') is not null drop table [TB]
go
create table [TB] (col1 nvarchar(2),col2 nvarchar(2),col3 int)
insert into [TB]
select 'a','b',4 union all
select 'c','d',1 union all
select 'e','f',2
select * from [TB]
SELECT col1,col2
FROM dbo.TB
INNER JOIN master..spt_values M ON TB.col3>M.number AND M.type = 'P'
/*
col1 col2
a b
a b
a b
a b
c d
e f
e f*/