Lets say I have table with 1 column like this:
Col A 1 2 3 4
If I SUM it, then I will get this:
SUM
Col A 10
You can do It simply by declaring an variable in following, COALESCE is used to avoid NULLS.
NULLS
DECLARE @var INT SELECT @var = Col1 * COALESCE(@var, 1) FROM Tbl SELECT @var
SQL FIDDLE