nchar is normally for fixed length string, it is naturally to have
空格, but nvarchar shouldn'tyou should do a trim on your string before insert them into the databaseor you can doUPDATE YourTableName SET YourColumnName=RTRIM(YourColumnName)
空格, but nvarchar shouldn'tyou should do a trim on your string before insert them into the databaseor you can doUPDATE YourTableName SET YourColumnName=RTRIM(YourColumnName)
update yourTable set 列= rtrim(列)
nvarchar不会,它是变长的,不会加空格。
nchar会这样的
取出来时
select rtrim(列) from yourtabledeclare @a table(a char(10))
declare @b varchar(100)
insert @a values('aaa')
insert @a values('bbb')set @b=''
select @b=@b+rtrim(a) from @a
print @b --------aaabbb
set @b=''
select @b=@b+a from @a
print @b --------aaa bbb