While trying to clean up some of the html code in a third party news articles module using REPLACE SQL statement, have discovered that the text column is in NTEXT datatype, hence it did not accept the REPLACE statement.
What really surprised me that many of the core DNN tables have columns in NTEXT datatype.
Without going into the merits of NVARCHAR datatype vs. NTEXT, the latter is likely to be deprecated in the near future as announced by Microsoft in favor of NVARCHAR(MAX) (please see bottom below).
Going back to the issue of using the REPLACE statement to clean up the text colum, I had to run a script to change the datatype of the entire database from NTEXT to NVARCHAR(MAX) using a script I found on:
How to quickly convert all NTEXT columns to NVARCHAR(MAX) in a SQL Server database
My question why would DNN core development team still cling to an datatype that will be removed in the near future as per Microsoft announcement, in addition to the limitations of NTEXT datatype?
Second part of my question, would running the "convert all NTEXT columns to NVARCHAR(MAX) script", affect any future upgrades. I executivbed the script on a public clone of my existing installation with no apparent changes or issues other than a noticeable increase in performance of the clone installation.
The script was successfully executed on a core installation of the DNN CE 7.3.4 with the below results:
ALTER TABLE [dbo].[aspnet_Membership] ALTER COLUMN
[Comment] NVARCHAR(MAX) NULL;
UPDATE [dbo].[aspnet_Membership] SET [Comment] =
[Comment];
ALTER TABLE [dbo].[ScheduleHistory] ALTER COLUMN
[LogNotes] NVARCHAR(MAX) NULL;
UPDATE [dbo].[ScheduleHistory] SET [LogNotes] =
[LogNotes];
ALTER TABLE [dbo].[Packages] ALTER COLUMN [License]
NVARCHAR(MAX) NULL;
UPDATE [dbo].[Packages] SET [License] = [License];
ALTER TABLE [dbo].[Packages] ALTER COLUMN
[Manifest] NVARCHAR(MAX) NULL;
UPDATE [dbo].[Packages] SET [Manifest] =
[Manifest];
ALTER TABLE [dbo].[Packages] ALTER COLUMN
[ReleaseNotes] NVARCHAR(MAX) NULL;
UPDATE [dbo].[Packages] SET [ReleaseNotes] =
[ReleaseNotes];
ALTER TABLE [dbo].[EventLog] ALTER COLUMN
[LogProperties] NVARCHAR(MAX) NOT NULL;
UPDATE [dbo].[EventLog] SET [LogProperties] =
[LogProperties];
ALTER TABLE [dbo].[Profile] ALTER COLUMN
[ProfileData] NVARCHAR(MAX) NOT NULL;
UPDATE [dbo].[Profile] SET [ProfileData] =
[ProfileData];
ALTER TABLE [dbo].[SystemMessages] ALTER COLUMN
[MessageValue] NVARCHAR(MAX) NOT NULL;
UPDATE [dbo].[SystemMessages] SET [MessageValue] =
[MessageValue];
ALTER TABLE [dbo].[HtmlText] ALTER COLUMN [Content]
NVARCHAR(MAX) NULL;
UPDATE [dbo].[HtmlText] SET [Content] = [Content];
ALTER TABLE [dbo].[HtmlText] ALTER COLUMN [Summary]
NVARCHAR(MAX) NULL;
UPDATE [dbo].[HtmlText] SET [Summary] = [Summary];
ALTER TABLE [dbo].[ProfilePropertyDefinition] ALTER
COLUMN [DefaultValue] NVARCHAR(MAX)
NULL;
UPDATE [dbo].[ProfilePropertyDefinition] SET
[DefaultValue] = [DefaultValue];
ALTER TABLE [dbo].[Vendors] ALTER COLUMN [KeyWords]
NVARCHAR(MAX) NULL;
UPDATE [dbo].[Vendors] SET [KeyWords] = [KeyWords];
ALTER TABLE [dbo].[EventQueue] ALTER COLUMN [Attributes]
NVARCHAR(MAX) NOT NULL;
UPDATE [dbo].[EventQueue] SET [Attributes] =
[Attributes];
(2 row(s) affected)
(1095 row(s) affected)
(119 row(s) affected)
(119 row(s) affected)
(119 row(s) affected)
(74 row(s) affected)
(1 row(s) affected)
(0 row(s) affected)
(3 row(s) affected)
(3 row(s) affected)
(45 row(s) affected)
(0 row(s) affected)
(15 row(s) affected)
EXECUTE sp_refreshview '[dbo].[vw_Lists]';
EXECUTE sp_refreshview
'[dbo].[vw_MessagesForDispatch]';
EXECUTE sp_refreshview
'[dbo].[vw_CoreMessaging_Messages]';
EXECUTE sp_refreshview
'[dbo].[vw_aspnet_Applications]';
EXECUTE sp_refreshview '[dbo].[vw_Users]';
EXECUTE sp_refreshview '[dbo].[vw_aspnet_Users]';
EXECUTE sp_refreshview '[dbo].[vw_Portals]';
EXECUTE sp_refreshview
'[dbo].[vw_PortalsDefaultLanguage]';
EXECUTE sp_refreshview '[dbo].[vw_Files]';
EXECUTE sp_refreshview '[dbo].[vw_PublishedFiles]';
EXECUTE sp_refreshview
'[dbo].[vw_aspnet_MembershipUsers]';
EXECUTE sp_refreshview '[dbo].[vw_TabModules]';
EXECUTE sp_refreshview '[dbo].[vw_Modules]';
EXECUTE sp_refreshview '[dbo].[vw_Tabs]';
EXECUTE sp_refreshview
'[dbo].[vw_ContentWorkflowStatePermissions]';
EXECUTE sp_refreshview '[dbo].[vw_Profile]';
EXECUTE sp_refreshview '[dbo].[vw_UserRoles]';
EXECUTE sp_refreshview '[dbo].[vw_DesktopModules]';
EXECUTE sp_refreshview
'[dbo].[vw_DesktopModulePermissions]';
EXECUTE sp_refreshview
'[dbo].[vw_FolderPermissions]';
EXECUTE sp_refreshview
'[dbo].[vw_ModulePermissions]';
EXECUTE sp_refreshview '[dbo].[vw_TabPermissions]';
EXECUTE sp_refreshview '[dbo].[vw_ExtensionUrlProviders]';
Microsoft has stated:
Important |
ntext , text, and image data types will be removed in a future version of Microsoft SQL Server. 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(max) instead.
|
reference link:
ntext, text, and image (Transact-SQL)