views:

23

answers:

1

Hi There!

I am making a CMS of sorts and, of course, it will have a blog. So, this might be a pretty noob question, but, from a database optimization point of view, would you use a varchar(max) or a varbinary(max) to store the body of a blog post?

+4  A: 

I would use an NVarChar(MAX) myself, to account for Unicode too; but you can certainly use VarChar(MAX) if you don't need Unicode. VarBinary would be more for if you had non-text data. You could also use Text or NText, but those have been deprecated since sql2005.

Andrew Barber
is there not any significant storage size advantage if you convert the string to binary?
Vintharas
Unless you are compressing it no, there is not. The VarChar(MAX) data type (which, by the way, is totally different from the regular VarChar(x) type) is made for storing and retrieving lots of text.
Andrew Barber
Aha! Great, thank you! That was very useful!
Vintharas