Skip to Content.
Sympa Menu

freetds - [freetds] Problem with smalldates in SP

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Carlo Andreoli" <vespito AT vespito.com>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Problem with smalldates in SP
  • Date: Fri, 30 Sep 2005 03:39:58 +0200

Hello,
I run Freetds from FreeBSD. I connect to SQL Server with

carlo@qs414% /usr/local/bin/odbctest "DSN=bla;UID=bla;PWD=bla"

and I type the following stored procedure, that used to rule:

SQL>execute SpInsertDaCda 0, 11, 142, 'chas', 'chas', '1990-05-12','british', 'm', '2005-08-12', '2005-09-30', 0, 6,0,0,2,0,'',0,0

I get:

[FreeTDS][SQL Server]The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value., SQLSTATE=22007
[FreeTDS][SQL Server]The statement has been terminated., SQLSTATE=01000
[FreeTDS][SQL Server]Cannot insert the value NULL into column 'idUtente', table 'SYSMA4.dbo.autorizzazioni'; column does not allow nulls. INSERT fails., SQLSTATE=23000
[FreeTDS][SQL Server]The statement has been terminated., SQLSTATE=01000

Unfortunately, I don't control the stored procedure, but I've been told that it has not been modified since when it worked for me. Moreover, I've been told that the same sp works fine from asp pages.

So, it looks like there's some problem with the dates. I tried other formats (dd-mm-yyyy, dd/mm/yyyy, yyyymmdd...), but I get the same error.

In the sp, all three dates are defined as varchar(20) and then casted to smalldatetime.

I tried this:

SQL>select cast('2005-09-12' as smalldatetime)

and it works fine, since I get: result set 1 returned 1 rows.

So, could anybody tell me what the problem could be or what I could do to debug?
Thank you in advance for any help.
Regards;

Carlo.






Archive powered by MHonArc 2.6.24.

Top of Page