karthik parcha

karthik parcha

  • NA
  • 153
  • 92.8k

StoredProcedure:How to subtact previous value from recent value that value displayed in another column

Jul 25 2011 9:26 AM
How to subtact previous value from recent value that value displayed in another column
in my database i have 4 columns
actually my task is differnt so iam taking some example
i have to insert data like
EmpID,EMpname,Sal,Expectedsal

when i insert data first like sal 300
the table should be
Empid,name,sal,expsal
1 k 300 0
again wheni insert data like sal 500
table should be
EMpid,name,sal,expsal
1 k 500 0
2 k 300 200
if their more than 500 records how to write storedprocedure
plz help me

Answers (20)