Page 1 of 1

Cuurentimestamp Function in DB2 stag2

Posted: Tue Feb 28, 2006 8:58 am
by Madhu1981
Hi,

I have to use a query in DB2 stage SELECT * FROM TABLE_NAME WHERE DATE <= "Current timestamp"

Can any one tells me about the MetaSQL function which can be used for CurrentTimestamp.

%CurrentDateTimeIn() == is the right function or not?

Kindly help me

Posted: Tue Feb 28, 2006 5:01 pm
by roy
Hi,
You have 2 options to go about your question:
1. the current timestamp is an SQL function which is DB specific and relates to the exact point in time the quesry is analyzed by your db.
Oracle analogy:

Code: Select all

select * from <table name> where <column> <= sysdate()
2. the current timestamp is a set point in time which is a static representation in the SQL sent to the DB.
Oracle analogy:

Code: Select all

select * from <table name> where column <= to_date('#DS_job_parameter#','<format>') 
You can ask your DBAs for the format and or conversions available to get a proper syntax.

IHTH,