Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duration between two TIMESTAMPS??? 3

Status
Not open for further replies.

babe1898

Programmer
Nov 26, 2003
29
0
0
CA
Hi all,

I'm pretty new to SQL so I only know some of the basic stuffs. I created two columns BEGIN and END both have a TIMESTAMP as datatype. Now. my question is how could I get the diference between these two times/date, meaning the duration between the BEGIN and the END. For example is shown below

Begin
15-NOV-07 08.52.00.000000 AM

End
16-NOV-07 08.58.01.000000 AM

Could you please give some ideas or is/are there any functions that can be used? Thank you in advance.



Cordially,

Babe1898
 
Check DATEDIFF() function in BOL

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
Microsoft MVP VFP
 
if you are indeed using TIMESTAMP datatype, you cannot save a datetime value in there

are you sure you're not using DATETIME datatype?

also, please note, BEGIN and END are reserved words in T-SQL and you should probably use different columns names

r937.com | rudy.ca
 
Hi bborissov,

Thank you so much for the reply...one thing though, what do you mean by BOL? Thanks again.


babe1898
 
hi r937,

yes, the data type is TIMESTAMP. And, the BEGIN and END are just an examples. The following value is the result of the TIMESTAMP datatype.

15-NOV-07 08.52.00.000000 AM

Thank you again...
 
are you ~sure~ they are TIMESTAMP columns?

may i ask how do you insert values into those columns?

according to the sql server documentation, each table can have only one TIMESTAMP column

r937.com | rudy.ca
 
Hi r937,

Thanks again for your rely...Actually, I'm using a Web Application that populates the Tables of my Database(Oracle 10g). From this database, one of the tables contains a column which has the datatype TIMESTAMP. So, basically, my concern is purely "sql query" questioin.

Not sure if I'm on the right forum..please correct me if I'm wrong...Thanks in advance.
 
Hi ca8msm,

Thanks for the information. I'll change this to Oracle forum...Thanks again...


babe1898
 
It does say "Microsoft" up there. Why do so many people get confused and post Oracle questions in here? Do they just search for "SQL" and hit the first thing that looks halfway close?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top