.Net Compression and SQL Server 2005 NVARCHAR(MAX)
Can I safely store a .Net compressed memory stream (System.IO.Compression) in an SQLServer 2005 NVARCHAR(MAX) f开发者_StackOverflow社区ield? SQLServer 2008 is not an alternative.
Use VARBINARY(MAX) for binary data - VARCHAR(MAX) and NVARCHAR(MAX) are for character-data (strings).
You'd be better off using varbinary(max)
I would think varbinary(max) is more suitable. Remember that there is a max size of 2GB.
A Stream is just a pointer to data, so you cannot store the stream into SQL Server, you can store the data that this stream points to. As you mention the System.IO.Compression
namespace I suppose you mean either DeflateStream or GZipStream which both contain binary data. The appropriate type to store binary data in SQL is VARBINARY(MAX)
.
精彩评论