Scott Arendt wrote:
I noticed that the actual answer did not appear in the results. I tried to guess the intent of the question, but was wrong.
There are two results that can be correct, depending on if the CHARCOL column is nullable or not. Both are among the provided alternatives.
If connecting through the native client or ODBC, the ANSI_NULL_DEFAULT_ON setting is ON after connection, so if this hasn't been explicitly changed by the connecting application, you will get the behaviour where trailing blanks are trimmed. If connecting through DB-library, however, ANSI_NULL_DEFAULT_ON will be OFF, and in that case the CHAR column will be NOT NULL, and the value will be padded with blanks to the declared size.
To quote from Books Online:
For a more reliable operation of Transact-SQL scripts that are used in databases with different nullability settings, it is better to specify NULL or NOT NULL in CREATE TABLE and ALTER TABLE statements.
Just because you're right doesn't mean everybody else is wrong.