Page 1 of 1

how to get Datediff SQL type

Posted: Mon Apr 19, 2010 9:32 am
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)

Posted: Mon Apr 19, 2010 9:44 am
by anbu
Use decimal

Posted: Mon Apr 19, 2010 10:02 am
by vemisr
still getting same error.


OR Is there any Dsfunction to get the difference of 2 date columns ?

Posted: Mon Apr 19, 2010 10:04 am
by chulett
Yes, but you don't have dates - you have timestamps. Different beasts.

Posted: Mon Apr 19, 2010 10:15 am
by anbu

Code: Select all

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

Posted: Mon Apr 19, 2010 10:19 am
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 ?

Posted: Mon Apr 19, 2010 10:23 am
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.

Posted: Mon Apr 19, 2010 10:28 am
by chulett
Is your documentation broke? These are all detailed in the Parallel Job Developer's Guide - description, aurguments and output.

Posted: Fri May 21, 2010 12:51 am
by desmondcheah
The document doesn't really give good example.. They should include proper example into the doc.

anbu.. Thanks ;)

Posted: Fri May 21, 2010 7:05 am
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.