question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTML/Text module: ntext should be changed to nvarchar(max)

See original GitHub issue

Description of Problem

The table HtmlText still uses ntext in 2 columns - this might cause performance issues

Proposed Solution Option 1

Change ntext to nvarchar(max)

Affected version

  • 9.3.0
  • 9.2.2
  • 9.2.1
  • 9.2
  • 9.1.1
  • 9.1
  • 9.0

Possible Issues

Just altering the type of the columns does not help. ntext is stored in the BLOB space of SQL Server, as nvarchar(max) is stored in the data space. Just altering the type of the column leaves the data in the BLOB space as long as it is not updated. New records will be written to the data space.

The solution is either to run a script like

UPDATE {databaseOwner}{objectQualifier}HtmlText SET Content = Content, Summary = Summary

after altering the type, or create a temporary table, copy the data from the original table, delete the original table and rename the temporary table. Constraints and indexes have to be rebuilt. There are also two stored procedures that are affected, these have to be altered as well. I did that in the attached file. Feel free to use it.

Module_HtmlText_Change_ntext_to_nvvarcharmax.SqlDataProvider.txt

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:23 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
valadascommented, Jun 17, 2021

Done

0reactions
stale[bot]commented, Mar 30, 2022

This issue has been closed automatically due to inactivity (as mentioned 14 days ago). Feel free to re-open the issue if you believe it is still relevant.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should I store HTML as nvarchar(MAX) or ntext? - sql
Microsoft recommends replacing them with nvarchar(max) , varchar(max) and varbinary(max) respectively. Use nvarchar(max) , therefore. Reference:.
Read more >
NVARCHAR(MAX) vs NTEXT Datatype
Second part of my question, would running the "convert all NTEXT columns to NVARCHAR(MAX) script", affect any future upgrades.
Read more >
Replaced deprecated types (text, ntext) with Varchar(max) ...
in 500 tables, on thousands of columns in all databases on entire server, I have. replaced deprecated datatypes (text, ntext) with ...
Read more >
Don't use deprecated TEXT,NTEXT and IMAGE data types
Avoid using these data types in new development work, and plan to modify applications that currently use them. Use nvarchar(max), varchar(max), and varbinary( ......
Read more >
The ntext data type cannot be selected as DISTINCT ...
Hoping i can get some help with this error I'm receiving on SQL management studio: "The ntext data type cannot be selected as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found