如何在Cognos查询表达式中获取当前日期? [英] How can I get the Current Date in a Cognos query expression?
问题描述
我在Cognos中有一个查询表达式,需要将过去的日期与当前的日期进行比较。我没有在函数列表中看到一个,否则我不确定如何将查询日期放入查询对象中。
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?
推荐答案
根据您的数据库软件,对象将是 current_date
(SQL Server)或 SYSDATE {}
(Oracle)。如果您不知道自己拥有哪个,只需对函数进行表达式然后按Validate按钮;如果遇到错误,则说明数据库使用了错误的函数。
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.
然后可以像使用任何其他Date查询对象一样使用此对象,以便对其进行添加/比较。确定查询中的日期或将其显示在页面上。
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.
这篇关于如何在Cognos查询表达式中获取当前日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!