December 23, 2003 at 10:47 am
How can i store images in a database,
i heard that it is poosble through 'image' datatyppe, but i don't know how it can use.
Suppose i have a image file called 'abc.gif'
how can i store it in the database and how can i retrieve it
please suggest
December 23, 2003 at 10:58 am
You need to build an application. You can't use query analyzer to retrieve an image. However, you can insert an image as an array of bytes and retrieve it the same way.
December 23, 2003 at 10:13 pm
You may be better off storing the file location of the image in the database and getting your application to go to this file location rather than storing the actual image in the database. Storing images in databases leads to the database growing very large.
Angela
December 24, 2003 at 6:40 am
We looked into it, and decided to store the file location in the db, and the image outside. Easier! But you can store the image in the database if you want- use image data type
From Books on Line
Data in an image data is stored as a string of bits and is not interpreted by SQL Server. Any interpretation of the data in an image column must be made by the application. For example, an application could store data in an image column using a BMP, TIFF, GIF, or JPEG format. It is up to any application that reads the data from the image column to recognize the format of the data and display it correctly. All an image column does is provide a location to store the stream of bits that make up the image data value.
December 24, 2003 at 8:43 am
When storing an image into a BLOB field, also insert its extension into a separate column so that when you reconstruct the image file name, you can determine its type or its extension from the extension column.
December 24, 2003 at 11:55 am
quote:
When storing an image into a BLOB field, also insert its extension into a separate column so that when you reconstruct the image file name, you can determine its type or its extension from the extension column.
That's a very good point. It's also a good idea to have server name in a seperate field, in case you go to multiple servers.
I actually normalize futher by using a filepath table. It keeps recurisve data about which directories are under which other directories. I use stored procedures to build out the entire path to the file or to chop it up so that it's stored properly. It's more work, but it allows me to everything below a certain directory level very easily.
December 28, 2003 at 5:57 am
Thanks for all suggestions, i decided to store the file path in the database, i think it is better option....
Again thanks for ur valuable suggestions
December 29, 2003 at 2:11 am
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechnol/sql/reskit/sql2000/part3/c1161.asp (I know, I know, Jeremy might be worth reading.
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply