Menu

decimal type on freebsd (windown ok)

2010-03-16
2013-04-29
  • igor potapenko

    igor potapenko - 2010-03-16

    Hi.

    I got a problem with Decimal type on freebsd.

    code:

    from decimal import Decimal
    import _mssql
    def main():
        con = _mssql.connect('194.247.133.1:1433', 'user', 'pass',)
        sql = u''' declare @megavar decimal(16,5)
        set @megavar = 1234567890.111222
        select 1, @megavar
        '''
        con.execute_query(sql)
        for row in con:
            print row
        con.close()
    if __name__ == '__main__':
        main()
    

    result

    #python ntype.py
    {0: 1, 1: 1234567890.1112199}
    

    On windows decimal type helps to solve this problem.

    F:\igor\apps\devel\python\mssql>python ntype.py
    {0: 1, 1: Decimal('1234567890.11122')}
    

    How can I configure _mssql to use Decimal rather than float ?

     
  • igor potapenko

    igor potapenko - 2010-03-16

    setting
    tds version = 7.0

    fixed the problem

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.