Q
Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Disable SQL query optimizer tool that removes trailing blanks

When working with the length function used in a WHERE or ORDER BY clause, disable the DB2 SQL query optimizer from removing trailing blanks by changing the variable length optimization settings.

Why does the length function used in a WHERE or ORDER BY clause remove the trailing blanks from a VARCHAR column but does not remove them in a SELECT column?

Is this a bug?

No, this is done by design to provide the DB2 query optimizer more flexibility when picking the fastest implementation for your SQL query request. If you want to disable this query optimizer technique, you can create a QAQQINI options file and set the VARIABLE_LENGTH_OPTIMIZATION attribute to *NO.
This was last published in March 2009

Dig Deeper on DB2 UDB (universal databases)

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close