Database design : preferred field length for file paths

前端 未结 7 931
南笙
南笙 2021-01-04 02:49

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

7条回答
  •  隐瞒了意图╮
    2021-01-04 03:25

    The field should be the same length as the length of a box of string.

    As asking the length of a filename is like asking the length of a bit of string, asking the length of a path is like asking the length of all bits of string in a box of unknown size.

    So the only sensible option given no other information is not to limit the length e.g. NVARCHAR(MAX)

提交回复
热议问题