1.去除查询字段左边的空格方法
select ltrim(字段名) from 表名
select ltrim(aaa) from table_name
2.去除查询字段右边的空格方法
select rtrim(字段名) from 表名
select rtrim(aaa) from table_name
3.去除查询字段中间的空格方法
select Replace(aaa,' ','') from table_name
sql中char类型是固定长度,不足的会补英文半角空格。
业务中字符建议优先使用varchar,nvarchar。
如果使用char,查询语句中最好trim下,防止业务中出现不必要的错误。