|
Datedifference with native sql server |
Iniciado por BARROS, set., 26 2019 1:44 PM - 4 respostas |
| |
| | | |
|
| |
Membro registado 5 mensagems |
|
Publicado em setembro, 26 2019 - 1:44 PM |
Hi,
I'm new with WINDEV24 and I'm facing a difficulty to calculate datedifference in a query, using native sql server connector. There's a WL function for that, but only works with WFSQL datafiles. There's anybody able to help me on this? Thanks in advance.
-- Barros |
| |
| |
| | | |
|
| | |
| |
Membro registado 52 mensagems Popularité : +3 (3 votes) |
|
Publicado em setembro, 26 2019 - 2:50 PM |
maybe the problem is with dateformat. Try to use "YYYYMMDD" or "DDMMYYYY" , "MMDDYYYY". If the problem is there, then you can use DateToString(myDate,maskDateSystem) so you use the correct format for each user. |
| |
| |
| | | |
|
| | |
| |
Membro registado 5 mensagems |
|
Publicado em setembro, 26 2019 - 3:31 PM |
Hi Baltasar,
thank you for your answer. I'm getting this message error:
The message is very clear.
The query code is this:
SELECT DISTINCT Clientes.Nome AS Nome_Cl, Prestacoes.PrestacoesID AS EXPRESS_PrestacoesID, Prestacoes.DataIni AS Data, Prestacoes.Valor AS ValorDolares, Prestacoes.ValorKwanzas AS ValorKwanzas, Prestacoes.Estado AS Estado, Prestacoes.ContratosID AS EXPRESS_ContratosID, WL.DateDifférence(Prestacoes.DataIni,WL.Today()) AS Dias FROM Clientes, Contratos, Prestacoes WHERE Contratos.ContratosID = Prestacoes.ContratosID AND Clientes.Cliente = Contratos.Cliente AND ( Prestacoes.Estado = 1 AND LEFT(Prestacoes.DataIni, < LEFT(SYSDATE, ) ORDER BY Dias DESC
-- Barros |
| |
| |
| | | |
|
| | |
| |
Membro registado 52 mensagems Popularité : +3 (3 votes) |
|
Publicado em setembro, 26 2019 - 10:31 PM |
not sure, but maybe when you call sysdate function windev uses "DDMMYYYY", "DD/MM/YYYY" format instead of "YYYYMMYY" "YYYY/MM/DD" so you must check this first. If you call LEFT(SYSDATE,8) you want sql to return "20190926" but probably it's returning "2019/09/" or "26/09/20" so check this
good luck ! |
| |
| |
| | | |
|
| | |
| |
Membro registado 5 mensagems |
|
Publicado em outubro, 08 2019 - 6:57 PM |
HI Baltasar,
thanks for the tip. It didn't work. I found this solution: Replace SYSDATE by GETDATE(). But I can't use it with Query Editor. Thanks again.
-- Barros |
| |
| |
| | | |
|
| | | | |
| | |
|