日期:2014-05-17 浏览次数:20585 次
with tb(a) as(
select '08-04-aa-bb'),
tbb (a)as (
select RIGHT(a,len(a)-CHARINDEX('-',a))from tb
),
tbbb(a)as(
select RIGHT(a,len(a)-CHARINDEX('-',a))from tbb
),
tbbbb(a)as(
select RIGHT(a,len(a)-CHARINDEX('-',a))from tbbb
)
select LEFT(a,charindex('-',A)-1) from tb union all
select LEFT(a,charindex('-',A)-1) from tbb union all
select LEFT(a,charindex('-',A)-1) from tbbb union all
select * from tbbbb
with tb(a) as( select '08-04-aa-bb'),
tbb (a)as ( select RIGHT(a,len(a)-CHARINDEX('-',a))from tb ),
tbbb(a)as( select RIGHT(a,len(a)-CHARINDEX('-',a))from tbb ),
tbbbb(a)as( select RIGHT(a,len(a)-CHARINDEX('-',a))from tbbb )
select LEFT(tb.a,charindex('-',tb.A)-1)n1,n2,n3,tbbbb.a n4 from tb left join
(select LEFT(tbb.a,charindex('-',tbb.A)-1)n2 from tbb)b on 1=1 left join
(select LEFT(tbbb.a,charindex('-',tbbb.A)-1)n3 from tbbb)c on 1=1 left join
tbbbb on 1=1