0

I'm getting an error running this code in DBeaver. Anybody help what is the equivalent of Dateadd and Datediff in DBeaver or anybody can convert this code in DBeaver. by the way, Just new in DBeaver. Thank you.

row_number() over (partition by serialid, dateadd(dd,0, datediff(dd,0,dateadd(HH,8,createddatetime))) order by createddatetime desc) rnk
Jon
  • 139
  • 1
  • 13

1 Answers1

0

DBeaver works as a client (read: front-end) to the database. This means that whatever queries you're working on are not relative to DBeaver, but to the database to which you're connected.

To help you out we need to know which database system you're connecting to. Is it PostgreSQL, MySQL, SQL Server, Oracle, etc.?

From the looks of your query, it looks like you might be using SQL Server. I don't see anything that jumps out as being syntactically wrong with your query, so it's probably another issue.

Can you post any error message you're receiving from DBeaver along with the database system you're working with? Do you have a connection created to the database in question?

Kyle
  • 415
  • 1
  • 6
  • 11
  • hi Kyle, actually were using SQL Server and were on the process of converting the code to Denodo. already find the conversion of dateadd and datediff in Denodo "getdaysbetween" and addday. right now I'm converting this code also to Denodo but I'm getting an error cast(serialid as varchar)+cast(cast(dateadd(hh,8,st.createddatetime) as decimal(12,4)) as varchar) . – Jon Aug 30 '17 at 03:47
  • Jov, I'm not familiar with Denodo. However, reading from their docs [here](https://community.denodo.com/kb/view/document/Microsoft%20SQL%20Server%20SQL%20to%20Denodo%20VQL%20Quick%20Reference?category=VQL) and [here](https://community.denodo.com/kb/view/document/VDP%20Conformance%20with%20Standard%20SQL?category=VQL), it looks like you're using incorrect data types. You're probably looking for something like this cast(serialid, text) + cast(cast(addhour(st.createddate, 8), float), text). If that doesn't work, provide the details of the error and hopefully someone familiar with Denodo can help. – Kyle Aug 30 '17 at 13:03