1

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?

gbn
  • 394,550
  • 75
  • 549
  • 647
user247759
  • 13
  • 3

2 Answers2

1

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
  • 273,340
  • 38
  • 408
  • 539
1

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.

Community
  • 1
  • 1
gbn
  • 394,550
  • 75
  • 549
  • 647
  • 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. – user247759 Jan 11 '10 at 06:44