What is the best way to store a large amount of text in a SQL server table?

前端 未结 8 468
日久生厌
日久生厌 2020-12-15 15:19

What is the best way to store a large amount of text in a table in SQL server?

Is varchar(max) reliable?

8条回答
  •  北海茫月
    2020-12-15 15:43

    Use nvarchar(max) to store the whole chat conversation thread in a single record. Each individual text message (or block) is identified in the content text by inserting markers.

    Example:

    {{UserId: Date and time}}. 
    

    On display time UI should be intelligent enough to understand this markers and display it correctly. This way one record should suffice for a single conversation as long as size limit is not reached.

提交回复
热议问题