Monthly Archives: July 2014

TSQL – Add column values and display in a new column.

This one was surprisingly difficult to find, so I post it here for your perusal.
create table #temp(
id int,
value1 int,
value2 int)
go
insert into #temp
values
(1,1,1)
,(2,2,2)
,(3,3,3)
,(4,9,1)
go
SELECT ID,VALUE1, VALUE2, VALUE1 + VALUE2 as Total
FROM #temp

drop table #temp
Design a site like this with WordPress.com
Get started