The Muffin Man
The Muffin Man

Reputation: 20004

Does nvarchar always take twice as much space as varchar?

Nvarchar is used to store unicode data which is used to store multilingual data. If you don't end up storing unicode does it still take up the same space?

Upvotes: 6

Views: 2374

Answers (2)

marc_s
marc_s

Reputation: 754598

YES.

See MSDN Books Online on NCHAR and NVARCHAR.

NCHAR:

The storage size is two times n bytes.

NVARCHAR

The storage size, in bytes, is two times the number of characters entered + 2 bytes

Upvotes: 6

Joel Coehoorn
Joel Coehoorn

Reputation: 415881

Sort of. Not all unicode characters use two bytes. Utf-8, for example, is still just one byte per character a lot of the time, but rarely you may need 4 bytes per character. What nvarchar will do is allocate two bytes per character.

Upvotes: 1

Related Questions