views:

171

answers:

1

I don't really know how to explain this one. I've taken a table, created a copy of it with a specific column as varchar instead of char. Then I've copied the data from one table into the new one. However, when I then programmatically add a new value to the table, the column that was previously char(200) is still being padded with space up to the 200 characters. I've tried doing a cast on the insert, a convert, and even RTrim(CAST([MynCharColumn] As nVarChar)) as found on another question on here, but no matter what I do the value keeps being padded as if it were still a char.

A: 

Wild guess: if you are using some form of ORM the ORM code might still have the column as char(200) and insert it as char. Or, if you are using a stored procedure, did you change the datatype there?

edosoft
That was exactly it. My stored procedure (which someone else had written) was still passing the value as char(200). I updated that and the padding was not inserted on new values. Thanks!
poppyq
Glad to be of help
edosoft