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
 New to SQL Server Programming
 Querying from Image DataType

Author  Topic 

bsk
Starting Member

2 Posts

Posted - 2011-06-13 : 16:41:24
We have a vendor-supplied application system/DB from which I am trying to generate a report. The database is SQLServer 2005. One of the tables has a column of Image datatype. I understand that some XML data is written into this column. When I try "Select * from .........." from Management Studio, it returns "0x.........." like data. What is the simple method to retrieve (see) the data? I am not a programmer, but understand and write SQL very well. Are there any special techniques or tools? I appreciate any help. Thanks!

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-06-13 : 19:11:19
can try
SELECT CONVERT(varchar(max), <binary string here>) 
Go to Top of Page

bsk
Starting Member

2 Posts

Posted - 2011-06-14 : 09:01:40
Thank you very much for your suggestion. When I tried this method, it said - "Explicit conversion from data type image to varchar is not allowed.". As per SQL Books Online, an implicit conversion from Binary to Char/VarChar is possible. But, it does not allow any conversion (Explicit or Implicit) from Image to Char/VarChar. It says Image data type can be converted to Binary, VarBinary or TimeStamp.

Finally, taking advantage of your tip, I used "Convert" function to convert first from Image to VarBinary; and then used it as input to convert it to Varchar.

THANKS A LOT!!
Go to Top of Page
   

- Advertisement -