I am using SQL Server 2005 and 2008 R2 databases, and I need to store large string which may contains over 50 thousands characters. Currently I am using the data type nvarchar(max) to store larger string.
My problem with nvarchar(max) is it takes more storage space in database. I have tested with 100000 records and it takes around 10 GB memory to store 100000 records.
Here, one good point is, I don't use this column for SQL Where query purpose, so that I have decided to store the data as BLOB data type - nvarbinary(max). In this way the storage memory decreased 50%, it means, it takes around 5 GB memory to store 100000 records.
So my question, since I am not going to use this string data for SQL Where query purpose, I would like to store it in any other better way, so that the database size will be reduced below 5 GB.
Hope, someone will give better idea!
Varbinary- this is just too cumbersome. If storing it as varbinary seems to reduce storage space by 50%, I'm assuming this is non-Unicode text that would easily fit intovarchar(max).nvarchardatatype is a Unicode string - each character uses 2 bytes of storage. If you usevarcharinstead, each character uses only 1 byte of storage (but you won't be able to store Arabic, Hebrew, Chinese, Japanese, Korean etc. texts in such a column)