Cuurentimestamp Function in DB2 stag2

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Madhu1981
Participant
Posts: 69
Joined: Wed Feb 22, 2006 7:49 am

Cuurentimestamp Function in DB2 stag2

Post 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
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post 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,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
Post Reply