SQL Server的VARBINARY(最大值):从VARBINARY字段中选择字节的一个子集 [英] SQL Server Varbinary(max): select a subset of bytes from the varbinary field

查看:723
本文介绍了SQL Server的VARBINARY(最大值):从VARBINARY字段中选择字节的一个子集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是从VARBINARY(MAX)场(不使用文件流)的SQL Server 2008中读取的二进制数据只是一部分,最有效的方法是什么?

What is the most efficient way of reading just part of the binary data from a varbinary(MAX) field (not using FileStreams) in SQL Server 2008?

当将数据写入列VarBinary.Write()函数是在T-SQL可用,允许字节被写入场递增,但似乎没有可用类似的功能,用于读的数据。

When writing data to the column the VarBinary.Write() function is available in T-SQL, allowing bytes to be written to the field incrementally, but there doesn't appear to be a similar function available for reading data.

我知道DataReader.GetBytes()方法,在.net中,将仅选择你要求的字节,但是这是否携带性能开销呢? IE浏览器将在SQLSERVER选择读取所有字节的数据库,然后给getBytes()构造方法,所有的这些字节,它把从他们请求的字节子集?

I know of the DataReader.GetBytes() method in .Net which will select just the bytes you ask for, but does this carry a performance overhead with it? i.e. will the select in sqlserver read all of the bytes in the database, and then give the getBytes() method all of these bytes for it to take the subset of bytes requested from them?

感谢您的帮助。

推荐答案

您使用 SUBSTRING 。这读取一个片段从varbinary数据在服务器上,并且只返回片段给客户端。

You use SUBSTRING. This reads a snippet from your varbinary data on the server, and only returns the snippet to the client.

这篇关于SQL Server的VARBINARY(最大值):从VARBINARY字段中选择字节的一个子集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆