[freetds] "Data conversion resulted in overflow" with float constants

arielCo arielco at gmail.com
Wed Jun 12 18:26:32 EDT 2013


I'm getting these errors with FreeTDS 1.91 against SQL Server 2008
which I can't make sense of:

$ ~/freetds/bin/fisql -S prueba -U ariel
Password:

1>> select 1.1 foo
2>> go
foo
---
1.1
(1 rows affected)

1>> select 1.11 foo
2>> go
foo
---
1.11
(1 rows affected)

1>> select 1.111 foo
2>> go
foo
---
DB-LIBRARY error:
        Data conversion resulted in overflow
Operating-system error:
        Error 0
---
(1 rows affected)

1>> select 1.0
2>> go

DB-LIBRARY error:
        Data conversion resulted in overflow
Operating-system error:
        Error 0
(1 rows affected)

1>> select 99.0 foo
2>> go
foo
---
99.0
(1 rows affected)

1>> select 100.0 foo
2>> go
foo
---
DB-LIBRARY error:
        Data conversion resulted in overflow
Operating-system error:
        Error 0
---


Apparently I can't write a literal float with more than four
characters. Furthermore, I can't write any decimals without a column
alias (fourth query above).

Since I'm a complete MS SQL newbie, I tried the example provided in
the Transact-SQL documentation and it fails too:

1>> DECLARE @myval decimal (5, 2)
2>> SET @myval = 193.57
3>> SELECT CAST(CAST(@myval AS varbinary(20)) AS decimal(10,5))
4>> go
(1 rows affected)

DB-LIBRARY error:
        Data conversion resulted in overflow
Operating-system error:
        Error 0


Am I doing something terribly wrong? These work in SQL Server Management Studio.

Thanks in advance,
ariel cornejo


More information about the FreeTDS mailing list