--> 测试数据:# if object_id('tempdb.dbo.#') is not null drop table # create table #(COL varchar(11)) insert into # select '123155AA' union all select '511881B' union all select '513213BDDSF'select COL=left(COL,len(COL)-2), COL1=right(COL,2) from #/* COL COL1 ----------- ---- 123155 AA 51188 1B 513213BDD SF */
if object_id('tempdb.dbo.#') is not null drop table #
create table #(COL varchar(11))
insert into #
select '123155AA' union all
select '511881B' union all
select '513213BDDSF'select COL=left(COL,len(COL)-2), COL1=right(COL,2) from #/*
COL COL1
----------- ----
123155 AA
51188 1B
513213BDD SF
*/