Function Reference > Functions > SYSTIMESTAMP
  

SYSTIMESTAMP

Returns the current date and time with precision to the nanosecond of the system that hosts the Secure Agent that starts the task. The precision to which you can retrieve the date and time depends on the system that hosts the Secure Agent.
The return value of the function varies depending on how you configure the argument:

Syntax

SYSTIMESTAMP( [format] )
Argument
Required/
Optional
Description
format
Optional
Precision to which you want to retrieve the timestamp. You can specify precision up to seconds (SS), milliseconds (MS), microseconds (US), or nanoseconds (NS). Enclose the format string within single quotation marks. The format string is not case sensitive. For example, to display the date and time to the precision of milliseconds use the following syntax: SYSTIMESTAMP(‘MS’). Default precision is microseconds (US).

Return Value

Timestamp. Returns date and time to the specified precision. Precision dependent on platform.

Examples

Your organization has an online order service and processes real-time data. You can use the SYSTIMESTAMP function to generate a primary key for each transaction in the target database.
Create an Expression transformation with the following fields and values:
Field Name
Field Type
Expression
Customer_Name
Input
n/a
Order_Qty
Input
n/a
Time_Counter
Variable
'US'
Transaction_ID
Output
SYSTIMESTAMP (Time_Counter)
At run time, the SYSTIMESTAMP generates the system time to the precision of microseconds for each row:
Customer_Name
Order_Qty
Transaction_Id
Vani Deed
14
07/06/2007 18:00:30.701015000
Kalia Crop
3
07/06/2007 18:00:30.701029000
Vani Deed
6
07/06/2007 18:00:30.701039000
Harry Spoon
32
07/06/2007 18:00:30.701048000