开发者

.Net Compression and SQL Server 2005 NVARCHAR(MAX)

开发者 https://www.devze.com 2022-12-13 02:46 出处:网络
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

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消