由于Rtrim只能去除半角的空格 declare @Str varchar(500)set @Str='1 3 'select @Str=substring(@Str,patindex('%[^ ]%',@Str),len(@Str)-patindex('%[^ ]%',reverse(rtrim(@Str)))-patindex('%[^ ]%',@Str)+2) select datalength(@Str),@Str
本文共 291 字,大约阅读时间需要 1 分钟。
由于Rtrim只能去除半角的空格 declare @Str varchar(500)set @Str='1 3 'select @Str=substring(@Str,patindex('%[^ ]%',@Str),len(@Str)-patindex('%[^ ]%',reverse(rtrim(@Str)))-patindex('%[^ ]%',@Str)+2) select datalength(@Str),@Str
转载于:https://www.cnblogs.com/refactor/archive/2012/05/28/2521407.html