Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Calculating Delays with SQL

Author  Topic 

Swati Jain
Posting Yak Master

139 Posts

Posted - 2006-07-11 : 05:39:05

I have three columns in my table,'StartDate',EndDate','BatchID'

When I upadate the the table for 'EndDate' I want to calculate the

I want to store this modified value somewhere and calculate the difference in (Value of 'End Date' Before update)-(Value of 'EndDate' after Update')

How it is possible?
Thanks in advance
Swati

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-07-11 : 05:43:44
in your sp, before you make the update, retrive the old value, do the update then store the calculated value...


select @oldvalue=endDate from tablename

update tablename
set endDate=@newvalue
where...

insert into anotherTable(calculatedValue)
select datediff(day,@oldvalue,@newvalue)--or something similar



--------------------
keeping it simple...
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-07-11 : 05:43:53
Write an update trigger on the table where u will get newly modified date in the EndDate column of inserted table and old value from underlying table.

"I want to store this modified value somewhere"

Please be more specific ! what do u mean by somewhere ?


Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2006-07-11 : 05:46:06
Please don't cross post:


http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=68889
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=68888


Duane.
Go to Top of Page
   

- Advertisement -