TSQL Program to perform multiplication in SQL SERVER using SET BASED APPROACH

Rajnilari2015
Posted by Rajnilari2015 under Sql Server category on | Points: 40 | Views : 225
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

*/

Comments or Responses

Login to post response