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
结果: