create table tb(col varchar(10))
insert into tb values('1/2/3')
insert into tb values('1/2/3')
insert into tb values('1/2/3')
go
我想得到的结果是
one two three
-------- -------- ------
1 2 3
1 2 3
1 2 3
create table tb(col varchar(10))
insert into tb values('1/2/3')
insert into tb values('1/2/3')
insert into tb values('1/2/3')
go
select PARSENAME(replace(col , '/' , '.'),3) one,
PARSENAME(replace(col , '/' , '.'),2) two,
PARSENAME(replace(col , '/' , '.'),1) three
from tb
drop table tb
select substring(col,1,1) as one,substring(col,3,1) as two,substring(col,5,1) as three from tb
select left(col,1) as one, substring(col,3,1) as two,right(col,1) as three
from tb