I have to store file paths in a DB field (/tmp/aaa/bbb
, C:\\temp\\xxx\\yyy
, etc.). I can\'t really tell how long they could be.
Given this
You can use VARCHAR(MAX)
or NVARCHAR(MAX)
.
These are variable length fields meaning they are designed to store values of different length. There is no extra overhead for longer values over shorter values.
Defining MAX
means the field can be up to 2GB.
From MSDN (varchar), nvarchar has similar documentation:
Use varchar when the sizes of the column data entries vary considerably.
Use varchar(max) when the sizes of the column data entries vary considerably, and the size might exceed 8,000 bytes.