|
|
Choosing A Webhost: |
RE: datatype conversion: msg#00199db.tds.freetds
> From: P. Sankar [mailto:SankarP@xxxxxxxxxxxxxxxx] > Sent: November 18, 2003 8:25 AM Welcome, Sankar. > I have few doubts in datatype conversion using the DB library API > function dbconvert(). I have tried the following numbers to insert > into SQL Server database after conversion. > > 123456789123456.8800 > 123456789123456.9900 > 123456789123456.9800 ... > dbconvert(dbproc, SYBMONEY, pSrc, sizeof(DBMONEY), > SYBDECIMAL, (unsigned > char *)&decTemp, sizeof(DBDECIMAL)); > dbconvert(dbproc, SYBDECIMAL, (unsigned char *const)&decTemp, > sizeof(DBDECIMAL), SYBCHAR, tmpstr, -1); ... > For example, after conversion I am getting the result as follows. > > 123456789123456.8700 > 123456789123456.9800 > 123456789123456.9700 Pennies! What's a few pennies, these days, between friends? The place to look is the source code: src/tds/convert.c. I suspect the money->decimal conversion is likely culprit. See tds_convert_money(), also src/tds/numeric.c::tds_money_to_string(). I do not think decimal->char is a problem, because money is good to four decimal places and your data are only two deep. You might also want to look at src/tds/unittests/convert.c. A patch would be wonderful, if you can manage it. Short of that, it would be a great help if you could narrow it down to a function or algorithm. Thanks for the problem report. --jkl ----------------------------------------- The information contained in this transmission may contain privileged and confidential information and is intended only for the use of the person(s) named above. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. Please note that we do not accept account orders and/or instructions by e-mail, and therefore will not be responsible for carrying out such orders and/or instructions.
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: Compiling and using FreeTDS on Mac OS X, Castellano, Nicholas |
|---|---|
| Next by Date: | jdbc connectivity issue in perl, praveen |
| Previous by Thread: | RE: datatype conversion, ZIGLIO Frediano |
| Next by Thread: | Datatype conversion, P. Sankar |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |