Hi all.
I have a (fairly large) table with 14 columns for numbers. I need to add a column for the total sum of all of the columns. Some of them can be null, so simply doing
doesn't work.
I was hoping to avoid having to make all of the null columns = 0 as presumably that must increase the size of my table, which is likely to be about 20 million rows, and in lots of cases 10 off the 14 columns would be null, so it may be significant in size (and my DBA had limited my space to a little as possible!).
Any advice on the best way of dealing with this would be hugely appreciated.
Thanks is advance,
Fee
The question should be [red]Is it worth trying to do?[/red] not [blue] Can it be done?[/blue]
I have a (fairly large) table with 14 columns for numbers. I need to add a column for the total sum of all of the columns. Some of them can be null, so simply doing
Code:
Update TrialTable
set totalscore = S+P+T1+T2+T3+T4+D1+D2+D3+D4+C1+C2+C3+C4;
I was hoping to avoid having to make all of the null columns = 0 as presumably that must increase the size of my table, which is likely to be about 20 million rows, and in lots of cases 10 off the 14 columns would be null, so it may be significant in size (and my DBA had limited my space to a little as possible!).
Any advice on the best way of dealing with this would be hugely appreciated.
Thanks is advance,
Fee
The question should be [red]Is it worth trying to do?[/red] not [blue] Can it be done?[/blue]