SQL Server, nvarchar(MAX) or ntext, image or varbinary?

旧城冷巷雨未停 提交于 2019-12-01 15:00:46

问题


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.

Thanks


回答1:


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.

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.




回答2:


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.



来源:https://stackoverflow.com/questions/47203/sql-server-nvarcharmax-or-ntext-image-or-varbinary

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!