写个
函数 自己调用处理
就行了CREATE FUNCTION `NewProc`(format_vale VARCHAR(100)) RETURNS varchar(100)BEGINDECLARE dec_number VARCHAR(4000) DECLARE dec_number_vale VARCHAR(4000) SET dec_number = '' SET dec_number_vale = CAST(format_vale AS CHAR) WHILE dec_number_vale IS NOT NULL DO -- 剪切
字符串SET dec_number = right(dec_number_vale,1) IF dec_number = '0' || dec_number= '.' THEN SET dec_number_vale = LEFT(dec_number_vale ,LENGTH(dec_number_vale)-1) ELSERETURN dec_number_vale END IF END WHILEENDDECLARE @i INT DECLARE @n INT DECLARE @t VARCHAR(20) SET @t='' SET @i=0 SELECT @n=len(sr1) FROM ts_2 --PRINT @n WHILE @i写个函数 自己调用处理就行了
CREATE FUNCTION `NewProc`(format_vale VARCHAR(100))
RETURNS varchar(100)
BEGIN
DECLARE dec_number VARCHAR(4000)
DECLARE dec_number_vale VARCHAR(4000)
SET dec_number = ''
SET dec_number_vale = CAST(format_vale AS CHAR)
WHILE dec_number_vale IS NOT NULL DO
-- 剪切字符串
SET dec_number = right(dec_number_vale,1)
IF dec_number = '0' || dec_number= '.' THEN
SET dec_number_vale = LEFT(dec_number_vale ,LENGTH(dec_number_vale)-1)
ELSE
RETURN dec_number_vale
END IF
END WHILE
END
评论列表(0条)