TIMESTAMPDIFF function

I am trying to calculate the time difference in seconds between CONNECTTIMESTAMP and DISCONNECTTIMESTAMP. Both are “timetype”. I use the following: TIMESTAMPDIFF(SECOND, “DISCONNECTTIMESTAMP”, “CONNECTTIMESTAMP”). I only get an “unexpected error”. Any ideas what “Unexpected error occurred” means?

Hi @rhanks

If you click on jobs, you should see a download profile on the right bottom of the screen. Can you please send us the downloaded zip file? That should give us more information

How To Share a Query Profile

Thanks,
@balaji.ramaswamy

  • Query Type:UI (preview)
  • Duration:<1s
  • Start Time:08/14/2018 07:54:03
  • End Time:08/14/2018 07:54:03
  • User:rchanks1
  • Job ID:248d2103-c6d4-0c64-fbb9-90b5bc6f2800
    IllegalStateException: Value at index is null

Query

Parents
  • session

Yiptel.zultys_cdr_for_byu

SQL

SELECT CONNECTTIMESTAMP, TIMESTAMPDIFF(SECOND, “CONNECTTIMESTAMP”, “DISCONNECTTIMESTAMP”) AS new_field, DISCONNECTTIMESTAMP

FROM (

SELECT CONNECTTIMESTAMP, DISCONNECTTIMESTAMP

FROM Yiptel.zultys_cdr_for_byu.session AS session

) nested_0

Hi, @rhanks !
Try to truncate both timestamps to seconds before “TIMESTAMPDIFF”
It was helpful in my case.