如何在SQL Server 2008 R2中存储图像和字符串值? [英] How can I store both Image and string values in SQL Server 2008 R2?

查看:186
本文介绍了如何在SQL Server 2008 R2中存储图像和字符串值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!全部,

我陷入了一种情况,我使用ASP.net Ajax HTMLEditorExtender来插入图像和文本,现在我正试图将这些数据保存到我的SQL Server中,其中列数据类型是nvarchar(MAX),有没有其他数据类型我可以存储文本和图像并检索它们。



谢谢。

Hi! All,
I'm stuck at a situation where I have used ASP.net Ajax HTMLEditorExtender to insert images and text as well, now I'm trying to save this data into my SQL Server where Column datatype is nvarchar(MAX), is there any other datatype where I can store both Text and Image and retrieve them as well.

Thanks.

推荐答案

停止!切勿将多个值放在一行中的单个列中。它可以但不应该这样做。这是违反1NF原则的。在关系数据库设计中,每一行都不能有一个具有多个值的列,更不用说不同数据类型的值,这是混合文本和图像的情况,它们应存储在适当数据类型的不同列中。

了解详情: ten-common-数据库设计错误/ [ ^ ]
Stop! Never put multiple values in a single column in a row. It can but should not be done. It is against 1NF principle. In relational database design, every row must not have a column that takes more than one value, not to mention values of different data types, which is your case of mixing text and image, They should be stored into different columns of appropriate data types.
Read more: ten-common-database-design-mistakes/[^]






是的还有一些其他数据类型可能帮助你



text,ntext和image但你应该避免使用这些数据类型,因为它们很快就会被弃用。



那么数据类型是什么。



你可以使用: xml [ ^ ]



但是它将快速增加您的数据库大小
Hi,

Yes there are some other datatypes which may help you

text,ntext and image but you should avoid those data types because they are going to deprecated very soon.

so what would be the data type.

you ca use : xml[^]

but it will increase your DB size rapidly


您可以使用数据类型图像在sql server 2008中存储图像,请参阅此链接 [ ^ ]
you can use datatype image to store image in sql server 2008 , please refer this link[^]


这篇关于如何在SQL Server 2008 R2中存储图像和字符串值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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