Click here to Skip to main content
15,908,111 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello All,

I have a Table with a column of Image Datatype. I am trying to update an hexadecimal value from one database Image datatype column to another database image type column and when I am trying to do that, It is changing the hex value.

The original value copied from first table is
"0x47494638396151002900F70000000000800000008000808000000080800080008080808080C0C0C0FF000000FF00FFFF000000FFFF00FF00FFFFFFFFFF"

But when I am updating it, It is changing to

"0x424D464401000000000036000000280000004501000055000000010018000000000010440100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000010000010000010000010"

Please help me out.
Posted
Updated 4-Oct-11 5:57am
v2
Comments
OriginalGriff 4-Oct-11 12:09pm    
How are you doing the update?
Vamshi Krishna Naidu 4-Oct-11 13:00pm    
UPDATE provider SET signature = '0x47494638396151002900F70000000000800000008000808000000080800080008080808080C0C0C0FF000000FF00FFFF000000FFFF00FF00FFFFFFFFFF' where ProviderID=1

This is the SQL Statement i am using

1 solution

SQL
UPDATE provider SET signature = '0x47494638396151002900F70000000000800000008000808000000080800080008080808080C0C0C0FF000000FF00FFFF000000FFFF00FF00FFFFFFFFFF' where ProviderID=1
Firsth thing I would do is loose the quotes:
SQL
UPDATE provider SET signature = 0x47494638396151002900F70000000000800000008000808000000080800080008080808080C0C0C0FF000000FF00FFFF000000FFFF00FF00FFFFFFFFFF where ProviderID=1
Since this is an Image field it will take quoted data as a character string rather than a binary stream.

But when I try it, using your string in either method abovce I get what I would expect: from yours the ASCI string for '0' 'x' '4' '7' ...
Without the quotes I get the right data. Are you sure you are reading the data correctly?
 
Share this answer
 
Comments
Vamshi Krishna Naidu 4-Oct-11 15:13pm    
Perfect. I am copying the correct Data and when updating it without Quotes, It is Fixed. You are Awsome.
OriginalGriff 4-Oct-11 15:17pm    
Hardly that... but you are welcome! :laugh:
Eslam Hosney 9-Jan-21 4:55am    
Same with me worked fine after removing the quotes. Many thanks man :)
OriginalGriff 9-Jan-21 6:06am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900