Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Stored procedure behaves abnormally

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-07-29 : 07:27:59
Badri writes "I have a stored procedures that retrieves data based on few params that includes a date param. This param is compared with actual data. The operators used are <= and -.

I am using an asp page that uses ado command and this sp. The date parameter is passed in 'dd/MMM/yyyy' format (25/Jul/2003). The datatype for the data param in sp is SMALLDATETIME and for command its adDate.

The procedure worked perfectly till the database was shifted to another sql server. A dump was taken and restored in the current server.

The problem I am facing is that when i run the asp file the following error is thrown:
"Arithmetic overflow error converting expression to data type smalldatetime" (0x80040E57). The most frustating issue is that the error is not encountered every time. As soon as i recompile the proc (sp_recompile <procname>), the page opens without any problem. And recently, the error is occurring more often.

I should also mention that the data displayed in asp file is paged. I provide links to pages. For every page i execute the sp passing the same params. What i wonder is the error does not occur when the asp file is invoked for the first time. When i request for the second page, the error is thrown.

I am not able to figure out whether the problem is in my asp or the sp since when recompiled everything works fine.

SQL Server: MS SQL Server 2000 (SP 3)
OS: MS Windows 2000 Server (SP 3)"

SamC
White Water Yakist

3467 Posts

Posted - 2003-07-29 : 08:08:51
Can you post your ASP/ADO code that calls the SP?

Sam
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-07-29 : 08:12:57
If the SP is not too long please post it too.

Sam
Go to Top of Page
   

- Advertisement -