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
 General SQL Server Forums
 New to SQL Server Administration
 timestamp comparions

Author  Topic 

oldest
Starting Member

2 Posts

Posted - 2014-04-29 : 14:41:12
I am trying to run the following command:
"delete from invoice_log where now()-time > 120*60*60*24;"

and I get:

ERROR: operator does not exist: interval > integer
LINE 1: delete from invoice_log where now()-time > 120*60*60*24;
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

so my formats both side of the comparison do not match. Can anybody pls. help me to improve that statement. Thank you ^

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2014-04-29 : 22:31:04
Are you using Microsoft SQL Server ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

oldest
Starting Member

2 Posts

Posted - 2014-04-30 : 02:21:06
no, we ae using postgres..... but this is a sql syntax problem, which is not necessarily platform dependent. I have to troubleshoot a production site that somebody set up many years ago,
Cheers
Felix

quote:
Originally posted by khtan

Are you using Microsoft SQL Server ?


KH
[spoiler]Time is always against us[/spoiler]



Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2014-04-30 : 02:38:58
quote:
but this is a sql syntax problem

it might be, but the function etc are not the same. There isn't now() in SQL Server.

You will get better help if you post in a Progres forum


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -