473,394 Members | 1,802 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,394 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
server.

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 5687
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
http://www.microsoft.com/sql/techinf...2000/books.asp
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

9
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). ...
2
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...
2
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. ...
4
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: ...
0
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,...
2
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...
3
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 --...
1
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...
1
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...
0
by: tavares | last post by:
(Our apologies for cross-posting. We appreciate if you kindly distribute this information by your co- workers and colleagues.) ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
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 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.