求一个英文字符的前置字符

if object_id('[tb]') is not null drop table [tb]
go
create table [tb]([col] varchar(5))
insert [tb]
select '0101X' union all
select '0102Y' union all
select '0103Z' union all
select '0104A'

select
case when right([col],1)<>'a' then left([col],4)+char(ascii(right([col],1))-1) else [col] end [col]
from [tb]

col
------
0101W
0102X
0103Y
0104A

(
4 行受影响)

你可能感兴趣的:(Go)