Let's say we have a table of integers as under
number
234
213
666
879
The objective is to perform multiplication in SQL SERVER using SET BASED APPROACH. Below TSQL Script will do so
Declare @t table(number int)
Insert into @t values(234),(213),(666),(879)
SELECT Product = EXP(SUM(LOG(number)))
FROM @t
/*Result
-------
Product
29178204588
*/