I don't know what is checked by the SQL Server Query Analyser but so it
maybe a stupid answer but had you check your date format in SQL?? It can be
because the date isn't the same type in SQL.  2001/09/29 can be read like
2001 september 1929 (or 2029) in SQL.  In this case you should set the date
like 29/09/2001.

Hope it'll help.



----- Original Message -----
From: "Anil Ozay" <[EMAIL PROTECTED]>
To: "Development-Axapta (E-mail)" <[EMAIL PROTECTED]>
Sent: Monday, September 29, 2003 10:54 AM
Subject: [development-axapta] datetime conversation..


Hi all.. I run sql code from Axapta.. My code is :

Connection Con;
Statement Stmt;
ResultSet R;

Con = new Connection();
Stmt = Con.createStatement();
sqlString = "SELECT * FROM GET_EMPLOYEE_PRIMS WHERE DSEMPLID='A1'  AND
DATAAREAID='" + curExt() +"' "
+ " AND TRANSDATE<CAST('" +
date2str('2001/09/29',321,2,3,2,3,4) + "' AS datetime)"
+ " AND TRANSDATE> CAST('" +
date2str('2003/09/29',321,2,3,2,3,4)+ "' AS datetime)";
R = Stmt.executeQuery(sqlString);

This code runs on Sql Server Query Analyzer successfully. I try to run
from any class on Axapta, but it doesn't work!!

Error info is :


[Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of a char
data type to a datetime data type resulted in an out-of-range datetime
value.




Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/





------------------------ Yahoo! Groups Sponsor ---------------------~-->
Upgrade to 128-Bit SSL Security!
http://us.click.yahoo.com/p7cEmB/s7qGAA/yigFAA/saFolB/TM
---------------------------------------------------------------------~->



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/




Reply via email to