What is the best column type for URL?

前端 未结 4 2015
清歌不尽
清歌不尽 2020-12-24 01:03

What is the best column type for a URL field for SQL Server?

Type: VARCHAR or NVARCHAR?

Length?

Similar question for MySQL.

4条回答
  •  醉话见心
    2020-12-24 01:33

    Will you be storing multilingual URLs? If so, use nvarchar, otherwise use varchar.

    Edit: As for length, since IE limits URLs to being 2,083 characters you could use that as the maximum length of your field. In cases like these you want to use the lower common denominator as your URLs should be usable in all browsers. Really this is a practical cap on a field that most likely will never contain data the will get anywhere close to even IE's limits.

提交回复
热议问题