我有一个函数返回它的formula.some部分的格式----
if(CHARINDEX(@fieldname,@formula)<>0)
Begin
declare @previouschar char = SUBSTRING(@formula, CHARINDEX(@fieldname, @formula)-1, 1),
@nextchar char = SUBSTRING(@formula, CHARINDEX(@fieldname ,@formula)+len(@fieldname), 1)
if(@previouschar in('[',']','(',')','{','}','+','-','/','*')
and @nextchar in ('[',']','(',')','{','}','+','-','/','*'))
Begin
set @calFormula= replace(@calFormula,@fieldname,' case when FLD'+Convert(varchar,@flid)+' is null OR FLD'+Convert(varchar,@flid)+'='''' then 0.0 else Convert(decimal(18,'+ Convert(varchar,@decimalPlc) +'),FLD'+Convert(varchar,@flid)+' ) end ')
End
end
set @cnt1=@cnt1+1
End
set @calFormula= replace(@calFormula,'[','')
set @calFormula= replace(@calFormula,']','')
return @calFormula
我想在Sql Server关系数据库中实现DAX的ISERROR方法,检查输入的除数是否为零,然后在计算公式中指定NULL。如何为此工作?SQL中是否有一些替代方法如ISERROR?