April 6, 2007 at 8:44 am
I have to get the difference of dates of single column, the table is temporary table. The records will be inserted into the table through a cursor ( it will retriev values from another table and insert into this temporary table ) and also i have a column called "StopsTheClock". If the value changes from 0 to 1 or remains same i have to subtract dates and store the value.
For eg:
_ID_______Date________________StopsTheClock
_1_______03/03/2007______________0_________
_2_______03/04/2007______________0_________
_3_______03/06/2007______________1_________
_4_______03/09/2007______________0_________
_5_______03/20/2007______________1_________
_6_______03/27/2007______________0_________
My calculation should be
(date1-date2)+(date2-date3)+(date4-date5)+(date6-getdate())
plz mail me if u got solution naveenwinsome@gmail.com
Naveen
April 6, 2007 at 9:32 am
What should the result of this calculation be based on your example?
April 6, 2007 at 8:41 pm
Lynn question is very relevant but you should be using the DATEDIFF function to do the math. See Books on line for the details.
April 7, 2007 at 12:13 am
Asked and answered here
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81761
N 56°04'39.16"
E 12°55'05.25"
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply