SQL Server,nvarchar(MAX)或ntext,图像还是varbinary? [英] SQL Server, nvarchar(MAX) or ntext, image or varbinary?
问题描述
我什么时候应该选择一个?关于空间和(全文本)索引有什么含义?
When should I choose one or the other? What are the implications regarding space and (full-text) indexing?
顺便说一句:我目前正在使用SQL Server 2005,打算在接下来的几个月中升级到2008.
BTW: I'm currently using SQL Server 2005 planing to upgrade to 2008 in the following months.
谢谢
推荐答案
新的(max)字段使处理.NET代码中的数据变得更加容易.使用varbinary(max)
,您只需将SqlParameter
的值设置为字节数组就可以了.在图像字段中,您需要编写几百行代码才能将数据流传输到字段中和从字段中流出来.
The new (max) fields make it a lot easier to deal with the data from .NET code. With varbinary(max)
, you simply set the value of a SqlParameter
to a byte array and you are done. WIth the image field, you need to write a few hundred lines of code to stream the data into and out of the field.
此外,不推荐使用image/text字段,而推荐使用varbinary(max)
和varchar(max)
,并且Sql Server的将来版本将不再支持它们.
Also, the image/text fields are deprecated in favor of varbinary(max)
and varchar(max)
, and future versions of Sql Server will discontinue support for them.
这篇关于SQL Server,nvarchar(MAX)或ntext,图像还是varbinary?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!