Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

Simple Multiply Function

Nov 13 2007 1:47AM by Madhivanan   

There is no direct way to multiply all the values of a column as we do summation using SUM(col). But it is possible with the following methods

create table test (i int, amount float)

insert into test(i,amount)
select          
        abs(cast(cast(newid() as varbinary(100)) as smallint)),
        abs(cast(cast(newid() as varbinary(100)) as smallint))/1000
from 
        sysobjects s1 cross join sysobjects s2 

Method 1

select 
        i,exp(sum(log(cast(amount as float)))) AS multiplied_value
from
        test
where 
        amount<>0
group by i
order by i

Method 2 use user defined function

create function dbo.multiply
(
@number int
)
returns float 
as
begin
declare @i float
set @i=1.0select @i=@i*amount from test where i=@number
return @iend

select i,dbo.multiply(i) as multiplied_value from(select distinct i from test) as torder by i

Tags: t-sql, sql_server, multiply,


Madhivanan
3 · 40% · 12947
1
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"Simple Multiply Function" rated 5 out of 5 by 1 readers
Simple Multiply Function , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]