Unable to create varchar column size 35000

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nsimhag
    New Member
    • Oct 2012
    • 2

    Unable to create varchar column size 35000

    Hi,
    I am unable to create tables or add columns to
    existing tables if I specify VARCHAR(35000). If I try I
    get the following error:

    DB21034E The command was processed as an SQL statement because it was
    not a
    valid Command Line Processor command. During SQL processing it
    returned:
    SQL0604N The length, precision, or scale attribute for column,
    distinct type,
    structured type, attribute of structured type, function, or type
    mapping
    "VARCHAR(35000) " is not valid. SQLSTATE=42611

    Any help would be greatly appreciated.
    Thanks,
    Simha.
  • surk16
    New Member
    • Apr 2013
    • 7

    #2
    By using VARCHAR(MAX) you are basically telling SQL Server "store the values in this field how you see best", SQL Server will then choose whether to store values as a regular VARCHAR or as a LOB (Large object). In general if the values stored are less than 8,000 bytes SQL Server will treat values as a regular VARCHAR type.

    So, give as VARCHAR(MAX)

    Comment

    • nsimhag
      New Member
      • Oct 2012
      • 2

      #3
      I am using this in DB2 v9.7 database.

      Comment

      • surk16
        New Member
        • Apr 2013
        • 7

        #4
        Variable length long character data
        The varying-length long character string data type is also used to store string data that varies in length. This data type is used to store character string data that is less than or equal to 32 700 characters long in a table that resides in a table space that uses 4K pages. In other words, when the varying-length long character string is used, the page size/character string data length restrictions that apply to varying-length character string data are not applicable.
        The term LONG VARCHAR is used to declare a varying-length long character string column in a table definition. The amount of storage space needed to store a varying-length character string value can be determined by using this equation: (string length x 1) + 24 = bytes of space required. The LONG VARCHAR and LONG VARGRAPHIC data types are deprecated and might be removed in a future release. When choosing a data type for a column, use data types such as VARCHAR, VARGRAPHIC, CLOB, or DBCLOB since these will continue to be supported in future releases and are recommended for portable applications.

        Comment

        • vijay2082
          New Member
          • Aug 2009
          • 112

          #5
          Hi,

          Below is the SQL Limit for Varchar and long varchar in DB2 V9.7 . Try to use clob if your requirement is to store data beyond limits of varchar.

          Maximum length of VARCHAR (in bytes) : 32672
          Maximum length of LONG VARCHAR (in bytes) : 32700



          Cheers, Vijay

          Comment

          Working...