SELECT replace(ltrim(rtrim(Realname)),' ','') AS Realname FROM UserInfo WHERE replace(ltrim(rtrim(Realname)),' ','') ='张飞' Sql Server 2005 去掉字段中的空格,布布扣,bubuko.com
SELECT TRIM(' 去除前后空格 ') FROM DUAL; SELECT REPLACE(' 去除 任意位置的空格 ', ' ', '') FROM DUAL; 扩展: 1,both, trailing, leading (1)默认为删除空格 --结果:<test> SELECT TRIM(BOTH FROM ' test ') FROM DUAL; --结果:< test> SELECT TRIM(TRAILING FROM ' test ') FROM DUAL; -