Should I store HTML as nvarchar(MAX) or ntext?

后端 未结 3 1074
太阳男子
太阳男子 2021-02-19 20:23

I don\'t know if there\'s a limit to the number of characters if I choose nvarchar(MAX), and I\'m not sure how many characters I would need anyways.

What\'s the standard

3条回答
  •  名媛妹妹
    2021-02-19 20:42

    The default setting for NVARCHAR(MAX) is to store its text value in the table structure, unless the text is over 8,000 bytes (which is 4000 double-byte chars), at which point it behaves like an NTEXT and stores the text value in the LOB, and stores a pointer to the text in the table - which gives much worse performance.

    In short, go for NVARCHAR(4000), as long as it's OK to lose bytes over 8K long.

提交回复
热议问题