| Kuido Külm via SQLMonster.com 2005-04-19, 7:23 am |
| Hello !
From website PHP script calls following MSSQL2000 stored procedure and
in this procedure:
DECLARE @a_pdate DATETIME
DECLARE @a_vuntil DATETIME
SET @a_pdate=GETDATE()
SET @a_vuntil=DATEADD(da
y,30,@a_pdate)
And now for this statement ODBC error appears
SET @a_vuntil = ( SELECT DBO. KUUPAEV_AINULT(@a_vu
ntil) )
PHP Warning: odbc_exec(): SQL error: [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., SQL state 22008 in
SQLExecDirect in ......
Function itselt:
CREATE FUNCTION KUUPAEV_AINULT ( @kuupaev DATETIME )
RETURNS DATETIME
AS /* makes day.month.year format */
BEGIN
DECLARE @a_data DATETIME
DECLARE @c VARCHAR(25)
SET @c=CONVERT(VARCHAR(2
5),@kuupaev,104 )
SET @a_data = CAST(@c AS DATETIME)
RETURN @a_data
END
Any suggestions ?
Kuido
--
Message posted via http://www.sqlmonster.com
|