Raj
Raj

Reputation: 4010

blank spaces in sql server data

HI ALL,

I am using sql server express to store some data but it also store spaces with data. for example if a have a nchar(20) column in a table and i store "computer" (8 characters) to this column, then remaining character (20-8=12) is filled with blank spaces. Is there any way to over come this problem. Because when I shows this data to flow document (center alignment), then it produces alignment error.

Thanks for help

Upvotes: 3

Views: 3255

Answers (1)

TLiebe
TLiebe

Reputation: 7986

You can use the NVARCHAR data type instead. The NVARCHAR type is a variable length data type and will only store the actual data.

If you don't have control over the data types then you'll need to trim off any extra characters manually. In T-SQL you can do this with the RTRIM command.

Upvotes: 8

Related Questions