存储weblinks的最佳数据类型 [英] best datatype to store weblinks

查看:77
本文介绍了存储weblinks的最佳数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我正在创建一个数据库,其中包含一个包含mp3文件的字段的表格。



我正在使用C#创建一个程序,当用户点击一个按钮时,它会打开mp3文件。



那么我应该存储什么数据类型mp3文件为?



我在sql server 2008版本中找不到BLOB数据类型...



那么替代方案是什么?



谢谢

Hi there,

I am creating a database that has a table with a field which contains mp3 files.

I am creating a program using C# that when the user clicks on a button , it opens the mp3 file.

So what datatype should I store the mp3 file as?

I cannot find "BLOB" datatype in sql server 2008 version...

so whats the alternative?

thanks

推荐答案

你可以使用VarBinary(max)tom存储文件像音频,视频,图像...



但是你必须在将数据发送到数据库之前将其转换为字节
You can use VarBinary(max) tom store files like audio, video, images...

But you have to convert your fils to bytes before sending it to database


进一步解决方案2



SQL 2008中有一个 image 数据类型,您可能会遇到 - 不要 想要使用它 - 在这里看到原因 [ ^ ]。 VarBinary(MAX)是更好的解决方案。



您可能还会发现这篇文章很有用在sql server中监控图像和BLOB文件 [ ^ ] - 它定位早期版本的sql server,但也链接到在SQL 2008中使用 FILESTREAM 存储blob。



但是,如果您打算在数据库中存储指向该文件的链接,请使用 nvarchar
Further to solution 2

There is an image datatype in SQL 2008 that you might come across - don't be tempted to use it - see why here[^]. VarBinary(MAX) is the better solution.

You might also find this article useful Storing Images and BLOB files in sql server[^] - it targets earlier versions of sql server but also links to storing of blobs using FILESTREAM in SQL 2008.

If however, you are just intending to store a link to the file on your database then use nvarchar


这篇关于存储weblinks的最佳数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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