Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
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 advanceSwati
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 tablenameupdate tablenameset endDate=@newvaluewhere...insert into anotherTable(calculatedValue)select datediff(day,@oldvalue,@newvalue)--or something similar
--------------------keeping it simple...
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 AthalyeIndia."Nothing is Impossible"