Re: dbconvert SYBMONEY to String
Ken Collins <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
>> So I was debugging all my money fields loosing their last 2 decimal places
>> in my new client lib and noticed this in the source.
>>
>> test("MONEY", "-922337203685477.5808", "-922337203685477.58");
>>
>> Does this mean my client will always loose those last 2 values? Is there
>> anything I can do?
>>
>>
>
> Well... avoid conversion to string... bind/fetch to money structure.
I tried just that and I'm not sure the struct's types can hold the values or I am doing it wrong. Any positive feedback appreciated.
INSERT INTO [datatypes] ([id], [money]) VALUES ( 161, 4.20 )
INSERT INTO [datatypes] ([id], [money]) VALUES ( 162, -922337203685477.5807 )
INSERT INTO [datatypes] ([id], [money]) VALUES ( 163, 922337203685477.5806 )
1> SELECT [id], [money] FROM [datatypes] WHERE [money] IS NOT NULL;
2> GO
id money
161 4.20
162 -922337203685477.58
163 922337203685477.58
data // dbdata() local for row id 162
DBMONEY *money_data = data;
money_data->mnyhigh // -2147483648
money_data->mnylow // 1
DBMONEY4 *money_data = data;
money_data->mny4 // -2147483648