Reputation: 2219
I'm working with VS2010 and asp.net and build a SQL Server Database with some int and char values.
My problem is, that the char(50) automatically fills the unused chars with whitespaces like:
"foo "
What can i do to get only "foo"?
Upvotes: 1
Views: 254
Reputation: 32740
It's not Visual Studio that's adding the white spaces, but your datatype.
Char is fixed-length, while varchar is variable length. Char will pad the remaining text with spaces up to your field length.
You can see more information about SQL datatypes here.
Upvotes: 2
Reputation:
Change it to varchar(50). The char(50) data type will fill the remaining characters of the field with spaces.
Upvotes: 7