Re: DecimalField and SQL Server
On 2013-12-08, at 7:18 AM, Derrick Jackson <derrick.jackson73@gmail.com> wrote:
Thanks Vernon and Michael.I've done a little more research and at first I thought the problem was in django_pyodbc. However, running the following "%0.2f" % 33333333333333333 from the python console and it yields '33333333333333332.00' and I don't understand why the digit prior to the decimal is "2" and not "3". This may be a lack of understanding but any help would be appreciated.
I would be a bit surprised that your ODBC package is using floating point internally for decimal types, but it may. Until you narrow it down that entire chain is suspect. ODBC drivers have the problem that they must support the least capable databases as well as the most. imho if you can get away from ODBC and use a database-specific support layer you might have better luck. Maybe try the one mentioned earlier??
hth
- Tom
On Friday, December 6, 2013 1:52:18 PM UTC-5, Vernon D. Cole wrote:Derrick:
I just added your failing test pattern to the unit test for adodbapi, and it works correctly. Therefore I would conclude that the problem is in django-pyodbc, not in SQL Server itself.
Micheal and I maintain the other SQL server backend, sqlserver_ado, so I am afraid that we can't be much more help to you.
--
Vernon Cole
On Friday, December 6, 2013 6:59:11 AM UTC-7, Derrick Jackson wrote:Hi Michael,I'm using django-pyodbc 0.10
On Friday, December 6, 2013 8:42:00 AM UTC-5, Michael Manfre wrote:Which database backend are you using to connect to SQL Server?Regards,Michael Manfre
On Friday, December 6, 2013 6:45:30 AM UTC-5, Derrick Jackson wrote:Hello all,I have a strange occurrence I'd like to share to see if any of you have run into the same thing. I am using Django 1.5.4, SQL Server 2008, and have the following field definition in one of my models:gift_value = models.DecimalField(max_digits=20, decimal_places=2, verbose_name='Gift Value') SQL Server table has the field's dataType as numeric(20,2).In my form if I enter the following values:444444444444444444 is saved as 444444444444444416222222222222222222 is saved as 222222222222222208666666666666666666 is saved as 666666666666666624Well you get the picture, no need for me to bore you with more examples. Have any of you see this happen before?--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3aefeaa5-cf81-47c0-99d6-00c09fcda6a9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home