varchar or nvarchar

If you got here is because you had the same problem as me… you are probably trying to define the data type for a table column in your preferred database and you saw these two possibilities for variable length text columns. I will save you time, picking the best answer out there (IMHO) from Stack Overflow:

varchar: Variable-length, non-Unicode character data. The database collation determines which code page the data is stored using.

nvarchar: Variable-length Unicode character data. Dependent on the database collation for comparisons.

Armed with this knowledge, use whichever one matches your input data (ASCII v. Unicode).

There is plenty of information on the topic, but this (in my case) convinced me of using nvarchar.

Leave a Reply

Your email address will not be published. Required fields are marked *