Search code examples
sqlsql-servert-sqlntext

Modifying value of ntext column


I have a column in ntext which holds large unicode strings longer than 4000 chars in length. I need to update/modify the data of the rows of the column in sql but I have no clue how to do so. I have tried nvarchar(max) as a buffer but it truncates the data into 4000 chars.

Could anyone help me give me a hint or an idea or a workround solution, because I'm really lost in this one?


Solution

  • nvarchar(max) does not truncate.

    You have an intermediate nvarchar(4000) (or shorter) somewhere, usually a string constant. See my answer for more info: For Nvarchar(Max) I am only getting 4000 characters in TSQL?

    If you can cast to nvarchar(max), then it means you can change your columns too... As Remus said, ntext is deprecated.