Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Inserting Images in Table

Author  Topic 

aturner
Starting Member

29 Posts

Posted - 2004-08-02 : 10:50:08
I have two tables called Employee and Location. I need the ability to store photos in the database that displays in my web application with information pulled from the Location table.

My Location table includes:

PRID
PRTitle
PRDate
PRLocation
PRRegOwner
PRLeaseOwner
PRDetails
EmpID
PREntryDate

The employee table has basic information, i.e., EmpID, EmpFName, EmpLName, EmpPwd, etc.. Can I insert the photos within the Location table using DataType (image) or should I create a second table and reference it to the PRID field? The photos have to tie in with the specific PRID field.

JasonGoff
Posting Yak Master

158 Posts

Posted - 2004-08-02 : 11:13:05
How many photos can you have per PRID ?

If 1, only 1, and always 1, then stick it in the Location table as you suggest.

If you can 0 or more than 1 photo, then normalise and have a Photo table with the PRID and the photo in it.
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-08-02 : 11:25:35
And, I'm sure you've heard this a million times. You really should store the photos on a file share and just have the location and filename stored in the database.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

MuadDBA

628 Posts

Posted - 2004-08-02 : 14:02:29
yeah, what is it iwth everyone storing images in the database lately?
Go to Top of Page

aturner
Starting Member

29 Posts

Posted - 2004-08-02 : 14:05:39
I wasn't sure if posting images in a database was the best route. Is there a way to tie the PRID field to an image not stored in a table?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-02 : 14:07:15
quote:
Originally posted by aturner

I wasn't sure if posting images in a database was the best route.


It isn't:

http://www.sqlteam.com/item.asp?ItemID=986

Tara
Go to Top of Page

aturner
Starting Member

29 Posts

Posted - 2004-08-02 : 14:10:34
I noticed in the example link you provided, it has a field called ImageURL. How does the user insert or update the location of image, if it is found on your server in an image directory?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-02 : 14:11:30
You don't let the user control that. The application controls it.

Tara
Go to Top of Page

aturner
Starting Member

29 Posts

Posted - 2004-08-02 : 14:22:40
Thanks.
Go to Top of Page

aturner
Starting Member

29 Posts

Posted - 2004-08-02 : 14:22:51
Thanks.
Go to Top of Page
   

- Advertisement -