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
 General SQL Server Forums
 Database Design and Application Architecture
 SQL 2005 image field

Author  Topic 

tomislavg
Yak Posting Veteran

51 Posts

Posted - 2010-01-28 : 03:37:54
Hi,

I created the db which among other data uses 3 fields as image. It is all good when the image is bmp but when I put JPG then the application does not see it. It just shows name of the file and the extension.

What can I do since JPG is much smaller then bmp?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-01-28 : 05:03:56
You can start using VARBINARY(MAX) columns instead of IMAGE.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-01-28 : 06:57:21
Why storing Image in the Database, rather than storing the Path / Filename and putting the image file on the Disk?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-28 : 07:05:16
As Peso pointed out image is deprecated in SQL 2005 so you need to use varbinary(max) instead.

from bol


ntext, text, and image data types will be removed in a future version of Microsoft SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use nvarchar(max), varchar(max), and varbinary(max) instead. For more information, see Using Large-Value Data Types.
Go to Top of Page

tomislavg
Yak Posting Veteran

51 Posts

Posted - 2010-01-28 : 08:09:09
Well I was checking few options also the path to the image but I do not want to give users access to the folder on the server, actually they will be using the frontend application to do the input so it is easier for the administration (myside) that they do the input of the image.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-01-28 : 08:18:54
Pros and Cons of putting images in the DB here:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=138862
Go to Top of Page

tomislavg
Yak Posting Veteran

51 Posts

Posted - 2010-01-28 : 08:26:20
I changed the field into varbinary(max) and imported images again but still I can not see image, I see only name and extension of the file and the file size is around 20-30 kb, so not that big.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-01-28 : 08:29:14
You CAN'T "SEE" the image in Management Studio. It is just a stream of binary values.
You will have to pull the information out to your client and build the stream to a picture there.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

tomislavg
Yak Posting Veteran

51 Posts

Posted - 2010-01-28 : 08:41:32
quote:
Originally posted by Peso

You CAN'T "SEE" the image in Management Studio. It is just a stream of binary values.
You will have to pull the information out to your client and build the stream to a picture there.

Hi Peso, I know, I tried to see it thru our application and it didn't work..... I am not that fresh


N 56°04'39.26"
E 12°55'05.63"


Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-01-28 : 09:00:08
When do you mean with "the application does not see it"?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

tomislavg
Yak Posting Veteran

51 Posts

Posted - 2010-01-28 : 11:44:39
Well, in the application I have an linked SQL table, which should show the image, it shows the BMP but not JPG.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-01-28 : 12:19:04
Which "application"?
Don't you think it's better to give us the full picture (no pun intended) instead of having us guess our way to a solution?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

tomislavg
Yak Posting Veteran

51 Posts

Posted - 2010-01-28 : 13:17:54
quote:
Originally posted by Peso

Which "application"?
Don't you think it's better to give us the full picture (no pun intended) instead of having us guess our way to a solution?



N 56°04'39.26"
E 12°55'05.63"




Sure no problem, I am using MS Access as a frontend and SQL as a backend. I created application as Microsoft Access Project and everything is fine except the image field.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-01-28 : 15:20:05
And to continue the guessing, where are you displaying the image/picture? On a report? On a form?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-01-28 : 15:21:14
And which version of MS Access are you using?


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

tomislavg
Yak Posting Veteran

51 Posts

Posted - 2010-01-29 : 01:43:46
I am using 2007 Office and displaying the image on the form.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-01-29 : 04:03:40
This is a MS Access problem, not a SQL Server problem.
You need to choose a control which is capable of displaying JPG, and not only BMP.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

tomislavg
Yak Posting Veteran

51 Posts

Posted - 2010-01-29 : 05:07:32
Ok but when I use the form in Access I just drag the field from the table, I do not choose the control. Also the table in Access it is actually showing the SQL table with all the properties from the SQL.

I had also same problem with another application some time ago. It was showing BMP but not JPG, it wasn't Access.
Go to Top of Page

tomislavg
Yak Posting Veteran

51 Posts

Posted - 2010-02-02 : 04:04:23
Hi Peso, I did some additional tests and you were right, it is an Access issue. I am trying to find the solution.
Thanks
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-02-02 : 04:19:45
I'm happy for you.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -