miércoles, 2 de febrero de 2011

SQL Server: NVARCHAR versus VARCHAR

I've never used NVARCHAR until now, where the sql server coding standards demands me to use nvarchar in most cases. So I was thinking "What's the difference?". Googling around I found a satisfactory answer. Let me quote it:

SQL Server provides both datatypes to store character information. For the most part the two datatypes are identical in how you would work with them within SQL Server or from an application. The difference is that nvarchar is used to store unicode data, which is used to store multilingual data in your database tables. Other languages have an extended set of character codes that need to be saved and this datatype allows for this extension. If your database will not be storing multilingual data you should use the varchar datatype instead. The reason for this is that nvarchar takes twice as much space as varchar, this is because of the need to store the extended character codes for other languages


Source(s):
A WebLogs post

No hay comentarios:

Publicar un comentario