varchar or nvarchar

后端 未结 9 1803
走了就别回头了
走了就别回头了 2021-02-19 13:54

I am storing first name and last name with up to 30 characters each. Which is better varchar or nvarchar.

I have read that nvarchar

9条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-19 14:41

    Basically, nvarchar means you can handle lots of alphabets, not just regular English. Technically, it means unicode support, not just ANSI. This means double-width characters or approximately twice the space. These days disk space is so cheap you might as well use nvarchar from the beginning rather than go through the pain of having to change during the life of a product.

    If you're certain you'll only ever need to support one language you could stick with varchar, otherwise I'd go with nvarchar.

    This has been discussed on SO before here.

    EDITED: changed ascii to ANSI as noted in comment.

提交回复
热议问题