--> 生成测试数据表:tbIf not object_id('[tb]') is null Drop table [tb] Go Create table [tb]([id] char(9)) Insert tb Select 'A0907001' union all Select 'AB0907002' Go --Select * from tb-->SQL查询如下: --考虑字段类型为CHAR select right(rtrim(id),7) from tb /* --------- 0907001 0907002(2 行受影响)*/
/*--------
907001(所影响的行数为 1 行)*/
Drop table [tb]
Go
Create table [tb]([id] char(9))
Insert tb
Select 'A0907001' union all
Select 'AB0907002'
Go
--Select * from tb-->SQL查询如下:
--考虑字段类型为CHAR
select right(rtrim(id),7) from tb
/*
---------
0907001
0907002(2 行受影响)*/
2,说的是广东话