SQL Server,nvarchar(MAX)或ntext,image还是varbinary?

时间:2021-06-01 09:24:53

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

谢谢

2 个解决方案

#1


13  

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.

新(最大)字段使得处理.NET代码中的数据变得更加容易。使用varbinary(max),只需将SqlParameter的值设置为字节数组即可完成。在图像字段中,您需要编写几百行代码来将数据流入和流出字段。

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将停止对它们的支持。

#2


3  

Once you put it in the blob, it's going to be difficult to be used for normal SQL comparison. See Using Large-Value Data Types.

一旦将它放入blob中,就很难用于正常的SQL比较。请参阅使用大值数据类型。

#1


13  

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.

新(最大)字段使得处理.NET代码中的数据变得更加容易。使用varbinary(max),只需将SqlParameter的值设置为字节数组即可完成。在图像字段中,您需要编写几百行代码来将数据流入和流出字段。

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将停止对它们的支持。

#2


3  

Once you put it in the blob, it's going to be difficult to be used for normal SQL comparison. See Using Large-Value Data Types.

一旦将它放入blob中,就很难用于正常的SQL比较。请参阅使用大值数据类型。