分类: Mysql/postgreSQL
2008-04-21 13:29:06
create table tb(f_qymc varchar(20))
insert into tb values('2/33/351/8')
insert into tb values('3/33/351/8')
insert into tb values('4/33/351/8')
insert into tb values('5/33/351/8')
insert into tb values('6/33/351/8')
go
select
PARSENAME(replace(f_qymc,'/','.'),4) col1,
PARSENAME(replace(f_qymc,'/','.'),3) col2,
PARSENAME(replace(f_qymc,'/','.'),2) col3,
PARSENAME(replace(f_qymc,'/','.'),1) col4
from tb
drop table tb
/*
col1 col2 col3 col4
---- ----- ------ ----
2 33 351 8
3 33 351 8
4 33 351 8
5 33 351 8
6 33 351 8
(所影响的行数为 5 行)
*/