June 28, 2011 at 10:07 am
Hello All,
I was actually trying to convert binary to string format...
I've implemented some statements like
cast( column_name as nvarchar),
convert(varchar, column_name, 0) or convert(varchar, column_name, 1) or convert(varchar, column_name, 2) which obviously didn't work...
My column has the data in the binary format which is starting with 0x
But I can just query the database...I have to write a query (for example: select x1, x2, x3 from table in which x2 is a binary column and I need to convert that to a string or varchar format. So that, I can write my outer queries.)
Appreciate any help on this....
June 28, 2011 at 10:14 am
Why do you need to convert that column to be able to join? I never had that restriction before!
June 28, 2011 at 10:17 am
Ninja's_RGR'us (6/28/2011)
Why do you need to convert that column to be able to join? I never had that restriction before!
I just want to read what was there in that column(as it is a comment field)...its not for join...
June 28, 2011 at 10:34 am
It's a text comment put in a varbinary column? Are you sure this is not a blob of some sort like .doc or .pdf?
June 28, 2011 at 10:39 am
Ninja's_RGR'us (6/28/2011)
It's a text comment put in a varbinary column? Are you sure this is not a blob of some sort like .doc or .pdf?
I'm not really that familiar with SQL...They are capturing this column from some kind of mainframes system...That column was defined as binary(1086) in the database.
June 28, 2011 at 10:47 am
if convert(VARCHAR(2000), colname) doesn't work then you need to use the actual application to read it.
June 28, 2011 at 10:55 am
Ninja's_RGR'us (6/28/2011)
if convert(VARCHAR(2000), colname) doesn't work then you need to use the actual application to read it.
so you say that we cant convert the column using SQL...? When I tried to implement the cast and convert as mentioned in the msdn that its an implicit conversion...it dint work out...but it gave something which has some wierd characters like some square and sooo on....
Thanks for the reply...
June 28, 2011 at 11:00 am
Binary column are "supposed" to hold binary data, which 99% of the time is used to store a file like a jpeg, pdf or doc file.
So to be able to read those files back you need to open them with whatever software that encoded them in the first place.
Maybe someone else might know another way but for now I'm out of ideas.
June 28, 2011 at 11:47 am
Really appreciate your help Ninja...
thanks a lot...
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply