views:

141

answers:

2

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?

+1  A: 

Replace the obsolete type NTEXT with the more appropriate NVARCHAR(MAX) and use the UPDATE SET column.Write syntax, see Using Large-Value Data Types.

The old type NTEXT supports the UPDATETEXT, but is obsolete now.

Remus Rusanu
A: 

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.

gbn
I have tested with nvarchar(max), and it works fine. There must be some intermediate variable causing the prob in the proc.Thanks for the help.