Alexander Kuznetsov : Set based logichttp://sqlblog.com/blogs/alexander_kuznetsov/archive/tags/Set+based+logic/default.aspxTags: Set based logicenCommunityServer 2.1 SP2 (Build: 61129.1)Set based calculation of products of several numbers.http://sqlblog.com/blogs/alexander_kuznetsov/archive/2009/03/17/set-based-calculation-of-products-of-several-numbers.aspxTue, 17 Mar 2009 22:01:00 GMT21093a07-8b3d-42db-8cbf-3350fcbf5496:12714Alexander Kuznetsov10http://sqlblog.com/blogs/alexander_kuznetsov/comments/12714.aspxhttp://sqlblog.com/blogs/alexander_kuznetsov/commentrss.aspx?PostID=12714You can use SUM to calculate the sum of several numbers, but you cannot directly use set-based logic to calculate a product. Yet there is a very simple trick – you can use EXP(SUM(LOG(…))) and get a product of several numbers without a loop. The trick...(<a href="http://sqlblog.com/blogs/alexander_kuznetsov/archive/2009/03/17/set-based-calculation-of-products-of-several-numbers.aspx">read more</a>)<img src="http://sqlblog.com/aggbug.aspx?PostID=12714" width="1" height="1">SQLTransact SQLBrainteasersSet based logic