• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 79
  • Last Modified:

Changing from varchar to nvarchar

We are using MS SQL 2012R2.  One of our tables has a field which is varchar(MAX), we are changing it to nvarchar(MAX) in order to allow non-latin characters to be entered.

We already tested and worked fine. My question is:  For all the entries we already have in that varchar field, will they be affected in ANY way if we change the field to nvarchar?
0
Aleks
Asked:
Aleks
1 Solution
 
Brian CroweDatabase AdministratorCommented:
No, The VARCHAR character set is a subset of the NVARCHAR character set

Some reference material: http://www.dbafire.com/2015/06/21/convert-varchar-column-to-nvarchar-techniques-and-best-practices/
0
 
AleksAuthor Commented:
That is great news!  Thank you.
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
As Brian says, No, but you'll take a minor performance hit.
  • nvarchar's take 2 bytes per character, so the table size on disk will increase, which could be a big deal if there are 1000's of characters (and page splits too) in the values and a bajillion rows.
  • (I've been told, haven't fully tested to verify this statement) When queries execute they need to pre-store the expected return set size, and nvarchar's will make that bigger, which could be a big hit if your return set is huge.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now