Skip to Content.
Sympa Menu

freetds - Re: [freetds] dbconvert SYBMONEY to String

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Ken Collins <ken AT metaskills.net>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] dbconvert SYBMONEY to String
  • Date: Tue, 5 Oct 2010 16:24:46 -0400



>> 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





Archive powered by MHonArc 2.6.24.

Top of Page