Q
Problem solve Get help with specific problems with your technologies, process and projects.

The maximum length of a VARCHAR item

What is the maximum length of a VARCHAR item?

The maximum length of a VARCHAR column is dependent upon the page size used by the table size for the table having the VARCHAR column. For 4K pages -- usually the bulk of your table spaces -- the maximum VARCHAR column is 4046 bytes. For 8K pages it is 8128 bytes, for 16K pages it is 16320 bytes and for 32K pages it is 32704 bytes. These maximum record sizes indicate the maximum length of a VARCHAR column if that column is the only column in the table. If there are other columns, of course, the maximum size of the VARCHAR is reduced by the amount of space required for the other columns. Of course, you have to keep in mind that any VARCHAR defined to be greater than 255 defines a long string column. And, there are restrictions on how long string columns can be used. For example, they cannot be used in GROUP BY or ORDER BY clauses, a CREATE INDEX, a SELECT DISTINCT or within a subselect of a UNION without the ALL key word.

Editor's note: Do you agree with this expert's response? If you have more to share, post it in one of our .VO7aaqqaAFk.0@/search390>discussion forums.

This was last published in May 2004

Dig Deeper on IBM DB2 management

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.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchAWS

SearchContentManagement

SearchOracle

SearchSAP

SearchSQLServer

Close