dbTalk Databases Forums  

inserted the image in a column----how can i view the image

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss inserted the image in a column----how can i view the image in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
satish
 
Posts: n/a

Default inserted the image in a column----how can i view the image - 03-07-2006 , 05:47 AM






hi,
i have inserted the image present in mydocuments using alter command

create table aa(a int, d image)
insert into aa values (1,'F:\prudhvi\baba 002.jpg')


when i do
select * from aa
i am getting the result in the column d as
0x463A5C707275646876695C70727564687669203030322E6A 7067


how i can i view the image?


pls clarify my doubt


satish


Reply With Quote
  #2  
Old   
Jack Vamvas
 
Posts: n/a

Default Re: inserted the image in a column----how can i view the image - 03-07-2006 , 07:44 AM






Use WRITETEXT/READTEXT instead of INSERT/SELECT to store / retrieve
There is quite a detailed explanation in Books Online


--
Jack Vamvas
___________________________________
Receive free SQL tips - www.ciquery.com/sqlserver.htm


"satish" <satishkumar.gourabathina (AT) gmail (DOT) com> wrote

Quote:
hi,
i have inserted the image present in mydocuments using alter command

create table aa(a int, d image)
insert into aa values (1,'F:\prudhvi\baba 002.jpg')


when i do
select * from aa
i am getting the result in the column d as
0x463A5C707275646876695C70727564687669203030322E6A 7067


how i can i view the image?


pls clarify my doubt


satish




Reply With Quote
  #3  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: inserted the image in a column----how can i view the image - 03-07-2006 , 04:21 PM



satish (satishkumar.gourabathina (AT) gmail (DOT) com) writes:
Quote:
i have inserted the image present in mydocuments using alter command

create table aa(a int, d image)
insert into aa values (1,'F:\prudhvi\baba 002.jpg')

when i do
select * from aa
i am getting the result in the column d as
0x463A5C707275646876695C70727564687669203030322E6A 7067


how i can i view the image?
You have not inserted the the image into the table. You have inserted the
disk location of the image into the table. Run

SELECT convert(varchar(80), d) FROM aa

to see.

There is no way to insert data into a column directly from a file. The
normal way of loading image is write a program that reads the file,
and the passes the binary stream through a parameterised INSERT statement
in a client API. You can also convert the contents to a hexstring and
build an INSERT statement from that.

Conversly, to display the image you also need an application. If you
have stored an image in a table, a SELECT on that table in Query Analyzer
or Mgmt Studio will only display a long hex string.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.