I've read all about varchar versus nvarchar. But I didn't see an answer to what I think is a simple question. How do you determine the length of your nvarchar column? For varchar it's very simple: my Description, for example, can have 100 characters, so I define varchar(100). Now I'm told we need to internationalize and support any language. Does this mean I need to change my Description column to nvarchar(200), i.e. simply double the length? (And I'm ignoring all the other issues that are involved with internationalization for the moment.)
Is it that simple?
Generally it is the same as for varchar
really. The number is still the maximum number of characters not the data length.
nvarchar(100)
allows 100 characters (which would potentially consume 200 bytes in SQL Server).
You might want to allow for the fact that different cultures may take more characters to express the same thing though.
An exception to this is however is if you are using an SC
collation (which supports supplementary characters). In that case a single character can potentially take up to 4 bytes.
So worst case would be to double the character value declared.
You can get the answer with a simple experiment, by executing the code below.
DECLARE @a varchar(4); SET @a = '123456'; SELECT @a;
DECLARE @b nvarchar(4); SET @b = '123456'; SELECT @b;
来源:https://stackoverflow.com/questions/21259726/determining-nvarchar-length