MS SQL Server Text Datatype Maxlength = 65,535?

Posted by craigmj on Stack Overflow See other posts from Stack Overflow or by craigmj
Published on 2010-06-09T17:30:06Z Indexed on 2010/06/09 17:42 UTC
Read the original article Hit count: 236

Filed under:
|
|

Software I'm working with uses a text field to store XML. From my searches online, the text datatype is supposed to hold 2^31 - 1 characters. Currently SQL Server is truncating the XML at 65,535 characters every time. I know this is caused by sqlserver, because if I add a 65,536th character to the field directly in Management Studio, it states that it will not update because characters will be truncated.

Is the Maxlength really 65,535 or could this be because the database was designed in an earlier version of MS SQL Server (2000) and it's using the legacy text datatype instead of 2005's?
If this is the case, will Altering the datatype to Text in sql server 2005 fix this issue?

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about text