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:
Is it practical to store text this length in varchar? If not, what should I use?
Is there a best practice for storing markup separately from the text it's marking up?开发者_C百科
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.
Is there a practical way to handle pagination once and store the information?
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.
Why do you want to separate it? You could just store the HTML.
See #2.
I think this is impractical since pagination would vary based on how the markup is to be displayed.
精彩评论