dbTalk Databases Forums  

decimal data type serialized to binary

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss decimal data type serialized to binary in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
ThunderMusic
 
Posts: n/a

Default decimal data type serialized to binary - 04-16-2007 , 12:29 PM






Hi,

I have the value 1234.1234 in a decimal field, converted to binary
(cast(myField as binary(13)), it gives 0x000000000013060001883a8f49. When I
use SqlDecimal in .NET, for the same value, I get 0x883a8f49 which makes
0x1306 the precision and scale (precision 19, so 0x13 and scale 6, so 0x06),
but what is the 0x0001? moreover, when I export to a file using bcp native
file type, the 0x0001 becomes 0x01 (loses a byte)

Can someone shed a light on this please?

Thanks

ThunderMusic



Reply With Quote
  #2  
Old   
ThunderMusic
 
Posts: n/a

Default Re: decimal data type serialized to binary - 04-16-2007 , 12:43 PM






I think I found it. It would be to indicate a positive number. I still don't
understand why the cast operation gives 0001 and bcp gives 01, but still, it
seems to match anyway... Can someone confirm?

Thanks

ThunderMusic

"ThunderMusic" <NoSpAmdanlatathotmaildotcom (AT) NoSpAm (DOT) com> wrote

Quote:
Hi,

I have the value 1234.1234 in a decimal field, converted to binary
(cast(myField as binary(13)), it gives 0x000000000013060001883a8f49. When
I use SqlDecimal in .NET, for the same value, I get 0x883a8f49 which makes
0x1306 the precision and scale (precision 19, so 0x13 and scale 6, so
0x06), but what is the 0x0001? moreover, when I export to a file using bcp
native file type, the 0x0001 becomes 0x01 (loses a byte)

Can someone shed a light on this please?

Thanks

ThunderMusic




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.