Hi,
I have a table and it has a two column. I want to add those two columns and put it in to third column Total. This is can we do this by using "CREATE VIEW" Method instead spf or normal update?
Hi,
I have a table and it has a two column. I want to add those two columns and put it in to third column Total. This is can we do this by using "CREATE VIEW" Method instead spf or normal update?
yes. You can create a view for this.
create view NewView
as
select col1, col2, Total = col1 + col2
from atable
if you want to update the total column of the same table,
update atable
set total = col1 + col2
if total is always a sum of col1 and col2, you should seriously consider John's suggestion of using a computed column
No one has followed this question yet.