开发者

how to store text and image in the same column?

开发者 https://www.devze.com 2023-04-05 15:34 出处:网络
I have a table i开发者_Python百科n SQL server 2008 R2 where I am storing values of translations.

I have a table i开发者_Python百科n SQL server 2008 R2 where I am storing values of translations. The translated values can be a text or it can be an image also. We want to use same column for storing the image and text so when we do a search we don't have to give 2 queries based on type of data. my question:- 1. Can I store image and text in the same column? 2. should I do that? or should i have 2 different columns? (one with varbinary and other simple nvarchar)?


As to 1 - you can... just use a varbinary and handle everything else on the client side...

As to 2 - you SHOULD NOT use 1 column for both... but 2 columns (one varchar, one varbinary) !

0

精彩评论

暂无评论...
验证码 换一张
取 消