I am trying to move a table from SQL server to AWS Redshift. While trying to move NVARCHAR fields, I read that Redshift converts NVARCHAR to VARCHAR internally. So, a NVARCHAR(100) in SQL Server will be equivalent to VARCHAR(100) or Varchar(200) in Redshift ? If I want to define the NVARCHAR fields from SQLServer directly as VARCHAR in Redshift, do I need to double the length of fields?

  • 1
    Is this something you're unable to test with your data for some reason? – Erik Darling May 24 '17 at 18:46
  • Wow! A downvote. That is sad to see. Yes. I am new to Redshift and I don't have direct access to Redshift environment making it difficult to test it out. I am a SQL DBA and I was supposed to give the ddl to be run on Redshift. I was checking the difference in data types and came across a post about this NVARCHAR difference. – Pravs_thedataguy May 24 '17 at 20:10
  • I didn't downvote your question -- upvoted after your comment, actually -- but questions that seem 'lazy' (i.e. why not just try it yourself questions) tend to attract negative attention. – Erik Darling May 24 '17 at 21:23
  • This: flydata.com/blog/handling-utf-8-characters-in-redshift also says that using double the space is what is required.... (to my suprise - I just deleted my answer which was completely wrong and based on nothing but assumptions) – Nick.McDermaid May 26 '17 at 7:33

Got the answer from aws.

NCHAR and NVARCHAR types are converted to CHAR and VARCHAR types, respectively, and are stored in the specified number of bytes. A VARCHAR(120) column consists of a maximum of 120 single-byte characters, 60 two-byte characters, 40 three-byte characters, or 30 four-byte characters. So, if I am storing double-byte characaters in SQL using NVARCHAR(x), I can define VARCHAR(2x) in Redshift to have the same storage behavior. Following is the link for further reference: http://docs.aws.amazon.com/redshift/latest/dg/r_Character_types.html

| improve this answer | |
  • That phrase "are converted to" is really bothering me. Do they simply mean they they are synonyms? If so, wish they would say so. "converted" sounds like an active process during data store. – Elroy Flynn May 23 '18 at 23:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.