August 29, 2009 at 7:56 am
I have a function that requires a varbinary(8) as input. Basically the function takes in a 32 bit hex string and spits out the corresponding binary. From there, I manipulate the bits to determine its floating point value. Unfortunately, the hex string I'm working with is type varchar since it's read in one byte at a time and then reversed. A convert or cast to type varbinary changes the value of the hex and thus changes the resulting floating point value returned by the function.
Does anyone know how to change the datatype of a variable without chaning it's actual value in T-SQL?
Ex. '0x43160000' is the parameter as a varchar. I need it to be varbinary(8) 0x43160000.
Thanks!!!
Sarah
August 29, 2009 at 10:58 am
Hi Sarah,
Not sure of the answer myself, but I had a little dig around and found this link which may be of use to you.
August 29, 2009 at 11:32 am
That actually worked great!! Thanks so much!!
Sarah
September 1, 2009 at 1:55 am
No problem! Glad it helped.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply