日期:2014-05-18 浏览次数:20550 次
if object_id('[tb]') is not null drop table [tb]
go
create table [tb]([col] varchar(16))
insert [tb]
select 'VD-1106B' union all
select 'VG-0806F' union all
select 'VK-16A' union all
select 'VD-1106B床头柜' union all
select 'VG-0806F五门路轨' union all
select 'VK-16A方几'
go
select left(col+'吖',patindex('%[吖-咗]%',col+'吖')-1) as col from tb
/**
col
------------------
VD-1106B
VG-0806F
VK-16A
VD-1106B
VG-0806F
VK-16A
(6 行受影响)
**/
------解决方案--------------------