Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using a varchar(MAX) or a varbinary(MAX) to store an length-undefined string within SQL Server

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?

like image 450
Vintharas Avatar asked Oct 08 '10 16:10

Vintharas


1 Answers

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.

like image 140
Andrew Barber Avatar answered Nov 15 '22 05:11

Andrew Barber