SQL Server 2008中的BLOB [英] sql server 2008 BLOBs

查看:61
本文介绍了SQL Server 2008中的BLOB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于Web的asp.net项目,目前我使用图像"类型存储图像.我的朋友告诉我,斑点比图像类型更有效.任何人都知道blob,请帮助我.

谢谢
Elk Cloner

I have a web based asp.net project, currently i use ''image'' type to store images. My friends told me, blob i more efficent than image type. Anyone know about the blob please help me.

Thank you
Elk Cloner

推荐答案

是的,BLOB只是以二进制格式保存数据.您可以在表中包含varbinary列,并且可以在其中保存图像/文件.

请参阅样本表.

创建表uploadtest
(
id int主键,
文件名varchar(500),
文件内容varbinary(max)
)


我在下面的线程中附有一个示例工作解决方案以进行演示.


http://www.c- sharpcorner.com/Forums/Thread/179342/how-to-upload-and-retrieve-files-from-database.aspx [
Yes BLOB is just saving data in binary format. You can have column varbinary in your table and you can save your images/files there.

Please see the sample table.

create table uploadtest
(
id int primary key,
filename varchar(500),
filecontent varbinary(max)
)


I have attached a sample working solution for demo purposes in the below thread.


http://www.c-sharpcorner.com/Forums/Thread/179342/how-to-upload-and-retrieve-files-from-database.aspx[^]


For demo purposes i have set to upload and download one file only.

Also i have used Entity framework, if you are using stored procedures, create a class with the above columns as properties and set the values or directly pass the stored proc content to filename and file content

Please dont forget to mark my answer as accepted if it works.


Blob是Binary Large OBject的缩写.

Blob数据类型对于从SQL Server存储图像数据特别有用.要存储长度不确定的任何类型的二进制数据(例如ASCII文本,可执行文件(.exe)或字节流),我们使用Blob数据类型.
有关BLOB的详细信息:
MSDN:Blob数据类型 [ ^ ]

图像"数据类型是在SQL Server中定义的用于存储的 OLD类型. SQL Server 2012将不再提供该版本.Microsoft已弃用并且不再建议使用它.参考: MSDN:SQL Server 2012中不推荐使用的数据库引擎功能 [
Blob is abbreviated for Binary Large OBject.

Blob data types are particularly useful for storing Image data from SQL Server. To store binary data of any kind, such as ASCII text, an executable (.exe) file, or a stream of bytes, and with indeterminate length, we use the Blob data type.
Details about BLOB: MSDN: Blob Data Type[^]

''Image'' datatype is an OLD type defined in SQL server for storage. It will no longed be available from SQL server 2012. Microsoft is deprecating and is not suggesting usage of it anymore. Refer: MSDN: Deprecated Database Engine Features in SQL Server 2012[^]

Reason of Image datatype being deprecated should be enough indication on blob to be used as image storage datatype.


blob只是二进制数据.我怀疑这有什么不同.
A blob is just binary data. I doubt it''s any different.


这篇关于SQL Server 2008中的BLOB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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