Avatar of Clif
ClifFlag for United States of America

asked on 

Storing an Image Into SQL Server 2008

Yes, I'm aware of the arguments against storing an image in SQL Server, but it has to be done none the less.

So, everything I've run across seems to imply that you need VB pr C# (or some other dev platform).  Is it not possible to write a SQL query of sorts to copy an image from a BMP file into a BLOB field of SQL Server (and a corresponding query to take it from the field and create a file)?

If so, how?
Microsoft SQL Server

Avatar of undefined
Last Comment
Clif
ASKER CERTIFIED SOLUTION
Avatar of Faiga Diegel
Faiga Diegel
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Anthony Perkins
>>Is it not possible to write a SQL query of sorts to copy an image from a BMP file into a BLOB field of SQL Server (and a corresponding query to take it from the field and create a file)?<<
SQL Server used to ship with a utility called TextCopy to do this, but since it is no longer available you will have to resort to using OPENROWSET()
Avatar of Clif
Clif
Flag of United States of America image

ASKER

faiga16,

Halfway there.

The first link you posted seems to work ok, in as much as there is now a table in the database with some data that looks like it might be right.

However I have not yet the ability to retrieve the image from the database.  Is this possible strictly through SQL Server, or do I need another app?
Avatar of Faiga Diegel
Faiga Diegel
Flag of United States of America image

You cannot use SQL management tool to read and open that stored image file since it is stored in a binary format. You will have to create your own UI/tool for this. There is no general UI/tool available online (atleast from what I have searched before), but you can always create a simple UI form to retrieve it. There are couple of sample codes in the net. Search Retrieving image BLOB SQL 2008.
Avatar of Clif
Clif
Flag of United States of America image

ASKER

Well, at least I can put it into the database.

Thanks.
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo