| Author |
Topic |
|
zhshqzyc
Posting Yak Master
240 Posts |
Posted - 2009-01-16 : 10:22:06
|
| Hello,I have a binary data0x033F443F183F5048263F3F2B723F3F1BHow to convert it to the integer?Thanks. |
|
|
hanbingl
Aged Yak Warrior
652 Posts |
Posted - 2009-01-16 : 10:33:09
|
| it's going to be too big to fit :( |
 |
|
|
zhshqzyc
Posting Yak Master
240 Posts |
Posted - 2009-01-16 : 10:34:54
|
| It is from a bitmap(image) for the purpose of encryption.I know the result is '111'.The question is how to get it? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-16 : 10:35:20
|
| use CAST() or CONVERT() to bigint |
 |
|
|
ashishashish
Constraint Violating Yak Guru
408 Posts |
Posted - 2009-01-16 : 10:41:15
|
| When Converted in Integerlike this,,,,select cast(0x033F443F183F5048263F3F2B723F3F1B as int)Result are..1916747547when in BigInt then....select cast(0x033F443F183F5048263F3F2B723F3F1B as bigint)Result are...2755990952806924059thanks,,,,But vishak sir how these two queries give different results.i dont understand...Waiting For our Reply...Thanks... |
 |
|
|
asgast
Posting Yak Master
149 Posts |
Posted - 2009-01-16 : 10:52:08
|
| This is easy when you get to max value of int (2,147,483,647) you start from the bottom. overflow you do it again :) until ou get the value that fits. Big int allows larger values to be inserted. (9,223,372,036,854,775,807)our value is too big to fit into int. |
 |
|
|
hanbingl
Aged Yak Warrior
652 Posts |
Posted - 2009-01-16 : 11:01:46
|
| Read OP's response, this is a bitmap for text '111' generated by app. the OP wants to decode this bitmap image back to text. so 0x033F443F183F5048263F3F2B723F3F1B is '111' in image. I don't think the conversion can be done in sql server. |
 |
|
|
asgast
Posting Yak Master
149 Posts |
Posted - 2009-01-16 : 11:27:05
|
| I answered question "how these two queries give different results." not the one on convention. I know no automatic way to do the conversion OP wants. Sorry if I mislead anyone. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-01-16 : 12:21:42
|
quote: Originally posted by zhshqzyc It is from a bitmap(image) for the purpose of encryption.I know the result is '111'.The question is how to get it?
You will have to decrypt it using same algorithm used when encrypting the data. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
hanbingl
Aged Yak Warrior
652 Posts |
Posted - 2009-01-16 : 15:24:02
|
quote: Originally posted by asgast I answered question "how these two queries give different results." not the one on convention. I know no automatic way to do the conversion OP wants. Sorry if I mislead anyone.
My post about read Op's respond was a FYI in case anyone missed it. |
 |
|
|
ashishashish
Constraint Violating Yak Guru
408 Posts |
Posted - 2009-01-16 : 23:33:53
|
| Yes If u Encrypt it with any Algorithm then its only possible only possible to get back your results to Decrypt the data with the same algorithm,,,,,,SO Decrypt the data with the same algorithm to get the expected result.Thanks..... |
 |
|
|
|