SQL函数之:截断字符串

截断字符串

SELECT
ccode_equal,
REVERSE(PARSENAME(REPLACE(REVERSE(ccode_equal) ,',', '.'), 1))  as one,
REVERSE(PARSENAME(REPLACE(REVERSE(ccode_equal) ,',', '.'), 2)) as two,
REVERSE(PARSENAME(REPLACE(REVERSE(ccode_equal) ,',', '.'), 3))  as three,
SUBSTRING(REVERSE(PARSENAME(REPLACE(REVERSE(ccode_equal) ,',', '.'), 1)), 0, 7) as xx_ccode
FROM
GL_accvouch
WHERE
iYPeriod>'202101' AND (ccode LIKE '112202'  OR ccode LIKE '112203'  )and md!=0 

结果:

 

posted @ 2021-11-30 15:58  优秀的进度条  阅读(529)  评论(0编辑  收藏  举报