简体   繁体   中英

store newsletter in sql server database - best practice?

I'm looking for the best way of making an archive for newsletters to be stored in a SQL Server database. What would be the easiest way to do that? I was thinking I could store the newsletters as pdf:s, but what data type should I use in the database? Anything else I should have in mind? Thankful for help!

It depends on the original format. If you want to store PDF's, you probably best use VARBINARY(MAX), which has a limit of 2GB. I don't think you'll be able to search through newsletters later on if you want to.

We store the contents of our newsletters in XML (it is parsed using XSL before sending out), and SQL Server has an XML datatype which allows only valid XML, so that might be more useful. If it's HTML, use VARCHAR(MAX) or NVARCHAR(MAX). (NVARCHAR allows unicode characters, but each character takes up twice as much as with VARCHAR, so the limit is half that of VARCHAR).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM