change current date + different second for each row
Moderators: chulett, rschirm, roy
change current date + different second for each row
Hi,
Right now i am using Currenttimestamp() in transformer for date i need to change that to current date + different second for each row, stating at 00:00:00
example: 500 records created, TimeStamp content would be :
2012-01-15 00:00:00
2012-01-15 00:00:01
2012-01-15 00:00:02
2012-01-15 00:00:03
....
2012-01-15 00:08:20
who can i modify Currenttimestamp() to do that.
Thanks
Right now i am using Currenttimestamp() in transformer for date i need to change that to current date + different second for each row, stating at 00:00:00
example: 500 records created, TimeStamp content would be :
2012-01-15 00:00:00
2012-01-15 00:00:01
2012-01-15 00:00:02
2012-01-15 00:00:03
....
2012-01-15 00:08:20
who can i modify Currenttimestamp() to do that.
Thanks
Use "DSJobStartTimestamp", which remains the same for each row.
Derive the new timestamp with the formula
Note that if the value has to be unique then, if you run on more than one node, you will have to adjust the algorithm.
Derive the new timestamp with the formula
Code: Select all
TimeOffsetBySeconds(DSJobStartTimestamp,1)
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You probably don't like CurrentTimestamp() either, because it returns the current timestamp (that is, "now") whether or not another record is being processed.
I have some DataStage jobs processing over a quarter of a million rows per second on a two-node configuration. "Now" will be the same for each quarter of a million rows, with "second" as the granularity of the current timestamp.
Even setting the granularity to microseconds isn't going to help; "now" will be the same for more than one record. And that assumes that the underlying operating system can deliver quanta as short as 0.000001 second. Most cannot.
Arnd's response was, to me, perfectly sensible. If you don't like that, you're going to have to write your own function, and reinvent the meaning of "now".
I have some DataStage jobs processing over a quarter of a million rows per second on a two-node configuration. "Now" will be the same for each quarter of a million rows, with "second" as the granularity of the current timestamp.
Even setting the granularity to microseconds isn't going to help; "now" will be the same for more than one record. And that assumes that the underlying operating system can deliver quanta as short as 0.000001 second. Most cannot.
Arnd's response was, to me, perfectly sensible. If you don't like that, you're going to have to write your own function, and reinvent the meaning of "now".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
My mistake, instead of "1" use "@INROWNUM" - sorry.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Re: change current date + different second for each row
Irrespective of the real writing time, do you need to increase 1 sec for each row?
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Below logic gives me results like below so in some cases i am getting same timestamp and some cases its unique.
"01/29/2013 21:51:20",
"01/29/2013 21:51:21"
"01/29/2013 21:51:22",
"01/29/2013 21:51:20",
TimestampToString(TimestampFromSecondsSince(@INROWNUM,DSJobStartTimestamp),"%mm/%dd/%yyyy %hh:%nn:%ss")
"01/29/2013 21:51:20",
"01/29/2013 21:51:21"
"01/29/2013 21:51:22",
"01/29/2013 21:51:20",
TimestampToString(TimestampFromSecondsSince(@INROWNUM,DSJobStartTimestamp),"%mm/%dd/%yyyy %hh:%nn:%ss")
-
- Participant
- Posts: 134
- Joined: Tue Jun 15, 2010 2:10 am
- Location: Bangalore
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: