how to get Datediff SQL type

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
vemisr
Participant
Posts: 72
Joined: Thu Sep 11, 2008 1:31 pm

how to get Datediff SQL type

Post by vemisr »

Hi Experts.

i am doing timestamp diff between two colums i.e (2010-03-15 13:47:00 -2010-03-15 15:56:00 ) to get the differnce of Minutes.

(to_date - from_date) -> Mins_cals giving the out put SQL type as double , giving error "Invalid conversion requested from a dfloat to a timestamp."

what type do i need to define for the dirrerence value . (SQL type)
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Use decimal
You are the creator of your destiny - Swami Vivekananda
vemisr
Participant
Posts: 72
Joined: Thu Sep 11, 2008 1:31 pm

Post by vemisr »

still getting same error.


OR Is there any Dsfunction to get the difference of 2 date columns ?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes, but you don't have dates - you have timestamps. Different beasts.
-craig

"You can never have too many knives" -- Logan Nine Fingers
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Code: Select all

SecondsSinceFromTimestamp('2010-03-15 15:56:00','2010-03-15 13:47:00'
)
You are the creator of your destiny - Swami Vivekananda
vemisr
Participant
Posts: 72
Joined: Thu Sep 11, 2008 1:31 pm

Post by vemisr »

IT sounds good, but what is the out type . is it Int or someting else.



SecondsSinceFromTimestamp('2010-03-15 15:56:00','2010-03-15 13:47:00'

out put SQL type ?
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

should be integer with difference in seconds, you can convert it to minutes if you like but that can have scale unless you want to round it.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Is your documentation broke? These are all detailed in the Parallel Job Developer's Guide - description, aurguments and output.
-craig

"You can never have too many knives" -- Logan Nine Fingers
desmondcheah
Participant
Posts: 5
Joined: Tue Apr 20, 2010 9:27 pm

Post by desmondcheah »

The document doesn't really give good example.. They should include proper example into the doc.

anbu.. Thanks ;)
-Desmond
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

desmondcheah wrote:The document doesn't really give good example.. They should include proper example into the doc.
Of course, they "should" all kinds of things in the documentation that they aren't. However (and I should have quoted it so it was more obvious) I was specifically replying to the question of the output type. Which is documented.

Just want people to actually check there and not just post here and wait for something you can answer for yourself in a minute of reading.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply