create function fn_Getquanpin (@str varchar(100)) returns varchar(8000) as begin declare @re varchar(8000),@crs varchar(10) declare @strlen int select @strlen=len(@str),@re='' while @strlen>0 begin set @crs= substring(@str,@strlen,1) select @re= case