Strange Result Set with a string

  • Hi we are wondering why when we do a simple search on a table that has extra padding ( We did a data conversion which the types went from Char to Varchar). That when we query that table we'll still get the same result set even though the actual string in the table is different.

    example:

    we want to search for all the 'PA' in a column.

    The Data in the varchar column is fixed 6 characters long (due to the db conversion) so the actual table column is 'PA '

    When we do a select * from Table1 where column1 ='PA' we'll get all the rows back instead of none. the question is why does this happen? Shouldn't the extra space bring back no rows.

  • Basically I'm answering my own question... the answer is because the ANSI SQL92 configuration for ANSI PADDING... we have it set to be on. The article below accurately describes how to go about this issue.

    http://www.sqlservercentral.com/articles/Administering/understandingtheimplicationsofansisql92setoptions/482/

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply