[racket] Losing decimal in SQL Server query result

From: Greg Graham (GGraham at cistercian.org)
Date: Wed Oct 31 17:07:42 EDT 2012

Hello everyone,

I attempting to use the Racket db interface to access a Microsoft SQL Server 2005 database. The field "creditaward" is defined as numeric(19,7), and in the case of the following query, I should get a value of 1.25 rather than 1. Anyone have an idea how I get to the fractional part?

The code:
#lang racket
(require db)
(define dbc (odbc-connect ...))
(query dbc "select creditawarded from ea7studentgrades where ea7studentcoursesid=58170")

The results:
(rows-result
 '(((name . "creditawarded")
    (typeid . 2)
    (size . 19)
    (digits . 7)))
 '(#(1)))

Here is the result of the same query using SQL Server Management Studio:
    creditawarded
    1.2500000

-Greg



Posted on the users mailing list.