有没有函数让同一字段中所有值相乘?谢谢 decarle @result intset @result=1select @result=@result*coefficient 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 declare @result numeric(15,3)select @result=0.0select @result=@result*coefficient from Mytable declare @result numeric(15,3)select @result=0.0select @result=@result*coefficient from Mytableselect @result 你如果想传入列名,那有点难,因为函数里面不能用exec,所以你只能是写一个特定函数来计算这个列的乘积create funciton xxreturns numeric(12,4)asbegin declare @a numeric(12,4) set @a =1 select @a=@a*coefficient from Mytable result @aend然后调用select xx as result from MyTable select dbo.xx as result from MyTable 存储过程中datetime类型的默认值 Report Machine打印求助 一个简单问题 分析服务器的部署问题 我没有可用分了,[Microsoft][SQLServer 2000 Driver for JDBC]Error reading data from static cursor cache. 各位看看呀,晕了, 数据库不能运行 谁能给提供点关于 ODBC 读取数据库的资料?? 有关DTC的问题 总计 关于外关键字约束的问题,帮帮忙 OpenVMS(半知半解)进来接分 帮忙!!!!
select @result=0.0
select @result=@result*coefficient from Mytable
select @result=0.0
select @result=@result*coefficient from Mytable
select @result
计算这个列的乘积
create funciton xx
returns numeric(12,4)
as
begin
declare @a numeric(12,4)
set @a =1
select @a=@a*coefficient from Mytable
result @a
end
然后调用select xx as result from MyTable