HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Migrating from NTEXT to NVARCHAR(MAX)

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
ntextnvarcharmigratingmaxfrom

Problem

I have table with the columns of type NTEXT. And for some peculiar reasons, the client wants to migrate the column type to NVARCHAR(MAX).

While doing so, what all potential threat should I be careful about?

Is there any possibility of data loss for the NVARCHAR(MAX) limitations?

Solution

No. You can alter your tables (Sql 2005+) cf this.

Or, for your convenience:

alter table my_table alter column my_ntext_column nvarchar(max);


Or you can supply a view which casts the ntext columns to nvarchar(max) to make the client happy and leave your database unchanged.

Code Snippets

alter table my_table alter column my_ntext_column nvarchar(max);

Context

StackExchange Database Administrators Q#1298, answer score: 6

Revisions (0)

No revisions yet.