I need to get the sum of multiple columns in a table. The issue is the columns may change over time and i don't want to have to constantly readjust my code...
I have a table called tbl_CenterInfo
I know how to pull all the columns back:
Select [Name]
from sys.columns
where object_ID = 437576597
Then for each column returned, i want to do a sum on that column.
Any ideas how i can do this without using a cursor?
I have a table called tbl_CenterInfo
I know how to pull all the columns back:
Select [Name]
from sys.columns
where object_ID = 437576597
Then for each column returned, i want to do a sum on that column.
Any ideas how i can do this without using a cursor?