user247759
user247759

Reputation: 13

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?

Upvotes: 1

Views: 1823

Answers (2)

gbn
gbn

Reputation: 432657

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.

Upvotes: 1

Remus Rusanu
Remus Rusanu

Reputation: 294437

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.

Upvotes: 1

Related Questions