求删除字符串左右两边空,空格,其它不可见乱码的语句
RT
[解决办法]
ltrim()rtrim() 最后句不知道什么意思
[解决办法]
去空格可以用 ltrim 和 rtrim 分别是左右
[解决办法]
create function delstr(@t varchar(100))returns varchar(100)asbeginselect @t=stuff(@t,number,1,CHAR(32)) from master..spt_values where type='p' and number between 1 and len(@t) and number in(charindex(char(9),@t,number),CHARINDEX(char(10),@t,number),CHARINDEX(char(13),@t,number),CHARINDEX(char(28),@t,number),CHARINDEX(char(29),@t,number),CHARINDEX(char(30),@t,number),CHARINDEX(char(31),@t,number),CHARINDEX(char(127),@t,number))return replace(@t,CHAR(32),'')endgoselect dbo.delstr(' fasdfas'+CHAR(9)+'dfsdf sadf ')/*----------------------------------------------------------------fasdfasdfsdfsadf(1 行受影响)*/godrop function dbo.delstr