Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2005

    Unanswered: SQLserver 2005 -data length 'max'

    Hi all,

    I ve few queries regarding SQLServer 2005, kindly help me to understand the things,

    1. Datatypes like nvarchar, varchar, varbinary use 'max' to define their datalength,

    a. is this 'max' always has the value of 2^31-1 ?
    b. what other data types in sqlserver 2005 can use 'max' to define their datalength?

    2. I defined a table (say 't') with a column 'name' of datatype nvarchar(max), now tried to execute the below query in the SQLServer client,

    select column_name, data_type, character_maximum_length from information_schema.columns where table_name='t'
    the result is,

    | column_name  | data_type  | character_maximum_length |
    | name         | nvarchar   | -1                       |
    The question is why the datatype length is returned as -1, what happened to 'max'?
    is there any other way to retrieve the actual data length (ie., 'max') from the table definition?


  2. #2
    Join Date
    May 2004

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts