views:

150

answers:

4
+1  A: 

Try NVARCHAR instead of NCHAR.

Guillaume
+4  A: 

You're using an nchar(255), which is a static length of 255. Try changing the column to nvarchar(255).

An nchar(255) will always give you 255 characters. Those that aren't used are filled in by whitespace (0x20 in ASCII aka a space). nvarchar(255) will allocate 255 characters when initialized, but only use the characters necessary.

In this case, you want nvarchar(255), since you have a variable-length string.

Eric
Thank you very much!
ShdNx
+1  A: 

NCHAR is a fixed length field. Using NVARCHAR as your data type would keep you from getting the spaces.

Brian Schantz
Thank you! Unfortunately, Eric gave the most detailed answer, so I accepted his answer, but you got a +1 as well.
ShdNx
A: 

Use nvarchar instead of fixed length field type.

adatapost