Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:57:31+00:00 2026-06-09T05:57:31+00:00

I am trying to get the elapsed time for transaction. I need to extract

  • 0

I am trying to get the elapsed time for transaction. I need to extract it then to a file.
I found some SQL online for Derby that does not work as I would like it:

ij> create  table atab1(ts timestamp, i int, ts1 timestamp); 
ij> insert into atab1 values(CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP); 
1 row inserted/updated/deleted 
ij> insert into atab1 values(CURRENT_TIMESTAMP, 2, CURRENT_TIMESTAMP); 
1 row inserted/updated/deleted 
ij> select {fn TIMESTAMPDIFF(SQL_TSI_SECOND, ts1,ts)} as TS_DIFF from atab1; 
TS_DIFF 
----------- 
0 
0 

The content of the atab1 table is :

TS                           |I          |TS1
-----------------------------------------------------------------------
2012-08-05 00:20:16.675      |1          |2012-08-05 00:20:16.675
2012-08-05 00:20:29.081      |2          |2012-08-05 00:20:29.081

The statement:

select {fn TIMESTAMPDIFF(SQL_TSI_SECOND, ts1,ts)} as TS_DIFF from atab1; 

will always give 0 as the values for ts1 and ts are the same

How should I adjust the statement so it would show the difference between the values of ts and ts1?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:57:32+00:00Added an answer on June 9, 2026 at 5:57 am

    It seems like you should have two different rows: one is the start row, and one is the end row. Each row should have a transaction id, and a timestamp, and one should have a code that indicates it is the start row, while the other should have a code that indicates it is the end row.

    Then, you can select those two rows by self-joining the table on its transaction id, and then you can subtract the start time from the end time to get the elapsed time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am stuck trying to get an overall average elapsed time between 2 dates
Im trying to get the current time elapsed percentage of todays time. It can
I'm trying to get the elapsed times in miliseconds in windows. The only way
I'm trying to determine the total elapsed time to complete a set of processes
I am trying to get the current time of a running animation but I
Im trying to get the time elapse percentage, what I do is first check
I have the following code that will count the elapsed time and print the
I'm trying to get a general smooth scrolling mechanism that I can implement in
I'm trying to use following code with System.nanoTime() to measure the elapsed time of
I get the following error(s) when compiling: 3>Time Elapsed 00:00:00.10 2>ClCompile: 2> Main.cpp 2>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.