Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 488
Raj Avatar asked Jun 28 '26 21:06

Raj


1 Answers

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.

like image 144
TLiebe Avatar answered Jun 30 '26 10:06

TLiebe