开发者

Storing article-length blocks of text and markup in SQL Server

I'm implementing a quick and dirty CMS for a content-heavy website and am unsure of how to store the text and markup for "articles," blocks of formatted text that will generally run under 4,000 characters in length, but could theoretically run to 40,000 in unusual circumstance. I have several questions:

  1. Is it practical to store text this length in varchar? If not, what should I use?

  2. Is there a best practice for storing markup separately from the text it's marking up?开发者_C百科

  3. Is there a commonly-accepted protocol for storing markup in formats other than HTML? In this case, I want to allow bold, italic, code blocks, and the marking of paragraphs as header, subhead or "byline," which would be handled in a predefined way.

  4. Is there a practical way to handle pagination once and store the information?


  1. Sure. Use varchar(MAX) or nvarchar(MAX) for UNICODE. I believe SQL Server has an 8k page limit, so there may be a performance impact for very large text fields.

  2. Why do you want to separate it? You could just store the HTML.

  3. See #2.

  4. I think this is impractical since pagination would vary based on how the markup is to be displayed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜