Bigints are converted to floats when using ODBC with MSSQL

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Bigints are converted to floats when using ODBC with MSSQL

Michael Uvarov-2
Hi,

I am using MSSQL with unixodbc on Ubuntu (unixodbc + tdsodbc packets).

My odbc.ini is:


[mongoose-mssql]                                                                    
    Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so                           
    Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so                               
    Server = 127.0.0.1                                                              
    Port = 1433                                                                     
    Database = ejabberd                                                                                              
    Charset = UTF-8                                                                 
    TDS Version = 8.0


So, the query
odbc:sql_query(Conn, "select cast(1 as bigint)").
returns floats:                                                     
{selected,[[]],[{1.0}]}

instead of:
{selected,[[]],[{1}]}

Is there any way to change this behaviour?

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Bigints are converted to floats when using ODBC with MSSQL

Michael Uvarov-2
Should be:
TDS_Version = 7.1
in that config.

in that case it returns
{selected,[[]],[{"1"}]}

On 12 March 2018 at 20:24, Michael Uvarov <[hidden email]> wrote:
Hi,

I am using MSSQL with unixodbc on Ubuntu (unixodbc + tdsodbc packets).

My odbc.ini is:


[mongoose-mssql]                                                                    
    Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so                           
    Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so                               
    Server = 127.0.0.1                                                              
    Port = 1433                                                                     
    Database = ejabberd                                                                                              
    Charset = UTF-8                                                                 
    TDS Version = 8.0


So, the query
odbc:sql_query(Conn, "select cast(1 as bigint)").
returns floats:                                                     
{selected,[[]],[{1.0}]}

instead of:
{selected,[[]],[{1}]}

Is there any way to change this behaviour?



--
С уважением,
Уваров Михаил.
Best regards,
Uvarov Michael

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions