图像和设备 [英] Images and Equipment

查看:77
本文介绍了图像和设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个表,一个是设备图像,另一个是设备描述(包括公司,分公司,设备编号,VIN)。每张设备记录都有可能有6张照片。照片是分开的,我试图弄清楚如何将它们与设备表联系起来。

我能够使用(SELECT * FROM OPENROWSET(BULK N'''+ @imgString +''' ',SINGLE_BLOB)as tempImg))'使用SET WHILE语句迭代图像列表和文件名

这给了我一个包含ImageID,ImageDescription(从路径中提取文件名)的表,和图像。在我的装备表上,我有6个字段,可能有6个图像,名称是文件名。我想知道如何将这两者联系起来。并非每个设备都有图像。

I have two tables one with images of equipment and another with description of the equipment (which includes Company, Branch, Equipment number, VIN). Each equipment record has a potential to have 6 photos. The photos are separate and I am trying to figure out how to relate them to the equipment table.
I was able to use (SELECT * FROM OPENROWSET(BULK N''' + @imgString + ''', SINGLE_BLOB) as tempImg))' With a SET WHILE statement to iterate through a list of images and the filename
This gives me a table with ImageID, ImageDescription(extracting the filename from the path), and the Image. On my Equipment table I have 6 fields with a potential to have 6 images and the names are the filename. I am wondering how to link the two. Not every equipment has an image.

推荐答案

我这样做的方法是拥有一个ID列在你的设备行上,并用另一行链接到你的图像表:

The way I would do it is to have an ID column on your equipment row, and link that to your images table with another row:
Equip Table:
id, name, part no, description




Images Table:
id, immageData, EquipId

然后您可以使用设备ID返回所有具有简单查询的设备的相关图像。

You can then use the Equipment ID to return all the relevant images for a piece of equipment with a trivial query.


这篇关于图像和设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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