473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

SQL Image Fields

I need a second opinion from someone out there. I have a database with about
20 tables. Each of these tables need to store one or maybe more images for
each record. I cannot use a varchar field to point to an image file on the

Therefore, I am trying to figure out if its better for me to put an image
field in each table OR make a table called IMAGES that has multiple Nullable
Foreign keys and use one table for all images. My dilemma is that each
record will have a lot of Null values because I will only be using one of
the foreign key fields for each record in the IMAGES table.

For example, an IMAGES table with the following fields:
ImageId int PK
FK1 int Nullable
FK2 int Nullable
FK3 int Nullable
FK4 int Nullable
FK5 int Nullable
ImageData image

Please help if you have some experience in storing images and files in a SQL
image field type.

Peter A.
Jul 20 '05 #1
2 5688
Peter A. (pe*****@insightbb.com) writes:
Therefore, I am trying to figure out if its better for me to put an
image field in each table OR make a table called IMAGES that has
multiple Nullable Foreign keys and use one table for all images.

The latter solution is definitely something you should stay away from.
What if you need to add one more table? Then you must change this table
to add one more FK column.

If you want a central table for images, a better option would be to
have an imgid in all tables, and then to have that imgid point to
the images table. I'm not particularly enthusiastic about this either,
from a general data-modelling perspective, but it is possible that it
could have some merits for blobs.

Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
Jul 20 '05 #2
what about adding one more table to deal with the nulls ?
in the new table you'll enter the foreign keys to the tables where the
corresponding image is needed and foreign keys to Images table to
point the image.
that way the nulls will disappear.

hope it works for you :)
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: matthiasjanes | last post by:
Hi, Maybe someone of you can help me. I'm trying to display an image in memory(open file) with an cgi script - but it want work proberly: I'm running an Cgi webserver (CgiServerGui.py). ...
by: Bob | last post by:
Hello: I've tried showing an image field from an MS SQL Server 2000 image field on an ASP page but All I get is this http://http://new.confectioneryhouse.com/glutenfree/about.asp I added the...
by: | last post by:
I am hoping a mixed ASP- Javascript programmer could help me with this scenario: I have a list box populated with randomized records (NewID()) from a Broker (Salesperson) sql server table. ...
by: matt tagliaferri | last post by:
We have remote users running MSDE entering information into a database. To send the data back to the home office, we've written some routines that export the data into SQL Scripts in text files: ...
by: BATISTA | last post by:
Hi , I am working in c# with crystal report XI. I read an example about dynamic image location .. 1) In that we have a xml xchema file with two fields n amed country--datatype is string,...
by: J Sahoo | last post by:
Hi, I have a browse page where I am showing few fields from my SQL Server table. One of the field is Image type, all the fields are bound to a single table. I want to show the image from the...
by: ACaunter | last post by:
Hi there, I was wondering if there was a way to crop a peice of an ASP.Net Image, allowing the user to zoom in on only a section of the picture?? any help would be appreciated!! thanks --...
by: Coby Herd | last post by:
I have a content mgmt page that allows a user to update products in his store - (actually a used car lot). All of the fields work perfectly - when he puts content in.changes prices, etc it writes...
by: Paul H | last post by:
I have a very simple database containing one table called "tblProducts". The fields are: ProductID, Description, Price. I have a folder on my PC that contains image files. The image file names...
by: tavares | last post by:
(Our apologies for cross-posting. We appreciate if you kindly distribute this information by your co- workers and colleagues.) ...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.