How can I get the Current Date in a Cognos query expression?

两盒软妹~` 提交于 2019-12-10 18:38:01

问题


I have a query expression in Cognos where I need to compare a past date to the current date. I don't see one in the functions list and I'm otherwise unsure how to put the query date inside a query object.

How can I use the current date in a query?


回答1:


Depending on your Database software, the object will be either be current_date (SQL Server) or SYSDATE{} (Oracle). If you don't know which you have, just make an expression of just the function and press the Validate button; if you get an error, you used the wrong function for your database.

You can then use this object like any other Date query object, so you can add/compare it to dates in your query or display it somewhere on the page.




回答2:


The best way is to use current_date. This method is data source agnostic and will be converted to the appropriate data source equivalent at run-time.




回答3:


You can use something like this with your query:

SELECT FIELD1 FROM TABLE WHERE FIELD2 = current_date

Asumming that FIELD2 has a date format



来源:https://stackoverflow.com/questions/12712125/how-can-i-get-the-current-date-in-a-cognos-query-expression

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!