Home > ASP Development > problem in datediff...

problem in datediff...



This is the error:

--------

Error Type:

Microsoft OLE DB Provider for SQL Server (0x80040E14)

Invalid parameter 1 specified for datediff.

--------



And this is the code:

------

sql_del = "DELETE FROM table WHERE status=0 and DateDiff('d',date_record,GetDate()) > 15;"





db.execute(sql_del)

------



"date_record" helds the date where a record has been entered in the database (the database is SQL server) and it looks like this format "11/6/2002" or "6/6/2005".



Any ideas?



Thanks.

    
Guest


try


Code:


DateDiff(d,date_record,GetDate()) > 15




d without the single quotes!!



sorry if it doesnt work!

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by shaileshdubey
This is the error:

--------

Error Type:

Microsoft OLE DB Provider for SQL Server (0x80040E14)

Invalid parameter 1 specified for datediff.

--------



And this is the code:

------

sql_del = "DELETE FROM table WHERE status=0 and DateDiff('d',date_record,GetDate()) > 15;"





db.execute(sql_del)

------



"date_record" helds the date where a record has been entered in the database (the database is SQL server) and it looks like this format "11/6/2002" or "6/6/2005".



Any ideas?



Thanks.




I fell for this one too...



In SQL Server its



sql_del = "DELETE FROM table WHERE status=0 and DateDiff(d,date_record,GetDate()) > 15;"



notice the lack of quotes around the first datediff parameter

Was this answer helpful ? Yes No   
Guest


thanks both micky & elija............it works.........

Was this answer helpful ? Yes No   
Guest


glad it worked
no problem!!

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved