简体   繁体   English

SQL Server,nvarchar(MAX)或ntext,image还是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? 对空间和(全文)索引有什么影响?

BTW: I'm currently using SQL Server 2005 planing to upgrade to 2008 in the following months. 顺便说一句:我目前正在使用SQL Server 2005计划在接下来的几个月内升级到2008年。

Thanks 谢谢

The new (max) fields make it a lot easier to deal with the data from .NET code. 新(最大)字段使得处理.NET代码中的数据变得更加容易。 With varbinary(max) , you simply set the value of a SqlParameter to a byte array and you are done. 使用varbinary(max) ,只需将SqlParameter的值设置为字节数组即可完成。 WIth the image field, you need to write a few hundred lines of code to stream the data into and out of the field. 在图像字段中,您需要编写几百行代码来将数据流入和流出字段。

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. 此外,不推荐使用图像/文本字段以支持varbinary(max)varchar(max) ,并且未来版本的Sql Server将停止对它们的支持。

Once you put it in the blob, it's going to be difficult to be used for normal SQL comparison. 一旦将它放入blob中,就很难用于正常的SQL比较。 See Using Large-Value Data Types . 请参阅使用大值数据类型

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM