Application Type
Traditional Web

Hi All,

Hope everyone is fine...

How can I execute this query in SQL as SQL to test?

select case when cast ((current year to second - run_fim_dt) as interval minute(9) to minute) > <TOP> then <TOP> else cast ((current year to second - run_fim_dt) as interval minute(9) to minute) end from batch_loja where processo_cd="GBECMSF" and loja_cd= '000';

Thanks & regards,


Hi Steve,

I am not sure what your problem is in this matter. But that is because i only see some SQL (of which i don't know if its valid) and i don't know your level of expertise. So i will start with some questions:

- What happens when you click the Test button?

- can you explain some of the context of what you are trying to do with this SQL and why you have the question you seem to have?

- Do you have more information on your datamodel?

make sure you parameter input and output is correct, and can you give more detail about your question

HI Steve,

Can you please clarify what indeed is your need? From the SQL Query text there are multiple queries, and your question mentions an additional one.

Thank you very much.

Best regards,

Paulo Moreira

Hi Steve. 

Is run_fim_dt a column from batch_loja table? 

If it is try replacing it in the query by:


If that doesn't solve can you detail your goal for this query and the error you get when hitting the test button? 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.