原来sql还有个stuff的函数,很强悍。

一个列的格式是单引号后面跟着4位的数字,比如’0003,’0120,’4333,我要转换成3,120,4333这样的格式,就是去掉单引号和前导的0,用以下语句就可以。

SELECT stuff(substring([当前组织],2,4),1,patindex('%[^0]%',substring([当前组织],2,4))-1,''),人员编码

FROM dbo.orgusermap$

where 人员编码 is not null

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-01
  • 2021-10-27
  • 2022-02-18
  • 2021-09-19
  • 2021-08-30
  • 2022-01-21
相关资源
相似解决方案