Warfarin162
asked on
SQL - creating a formula
I am trying to make the following formula work in SQL 2008:
MAC = (#Combine.Sevo_out)/(1.8*1 0^(-0.0026 9(#Combine .Age - 40)))
I get an error that I assume is related to the "^", but I am not sure how to fix this....
Thanks!
MAC = (#Combine.Sevo_out)/(1.8*1
I get an error that I assume is related to the "^", but I am not sure how to fix this....
Thanks!
Look up POWER in Sql help
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I am getting
incorrect syntax near '(' .
It appears the issue is somewhere in the Power section of the equation. Here is the final code (that runs without the new line without issue:
SELECT #Combine.PatientID
, #Combine.CaseNm
, #Combine.Age
, #Combine.Date_Time
, #Combine.SpO2
, #Combine.HR
, #Combine.Pulse
, #Combine.EtCO2
, #Combine.RR
, #Combine.Temp
, #Combine.NISBP
, #Combine.NIDBP
, #Combine.NIMean
, #Combine.InvSBP
, #Combine.InvDBP
, #Combine.InvMean
, #Combine.InvSBP2
, #Combine.InvDBP2
, #Combine.InvMean2
, #Combine.FiO2
, #Combine.Sevo_In
, #Combine.Sevo_Out
, (#Combine.Sevo_out)/(1.8*P OWER(10,(- 0.00269(#C ombine.Age - 40)))) as MACsevo
, #Combine.Des_In
, #Combine.Des_Out
, #Combine.Iso_In
, #Combine.Iso_Out
, #Combine.N2O_In
, #Combine.N2O_Out
, #Combine.CVP
, #Combine.BIS
, #Combine.BIS_SQI
FROM #Combine
incorrect syntax near '(' .
It appears the issue is somewhere in the Power section of the equation. Here is the final code (that runs without the new line without issue:
SELECT #Combine.PatientID
, #Combine.CaseNm
, #Combine.Age
, #Combine.Date_Time
, #Combine.SpO2
, #Combine.HR
, #Combine.Pulse
, #Combine.EtCO2
, #Combine.RR
, #Combine.Temp
, #Combine.NISBP
, #Combine.NIDBP
, #Combine.NIMean
, #Combine.InvSBP
, #Combine.InvDBP
, #Combine.InvMean
, #Combine.InvSBP2
, #Combine.InvDBP2
, #Combine.InvMean2
, #Combine.FiO2
, #Combine.Sevo_In
, #Combine.Sevo_Out
, (#Combine.Sevo_out)/(1.8*P
, #Combine.Des_In
, #Combine.Des_Out
, #Combine.Iso_In
, #Combine.Iso_Out
, #Combine.N2O_In
, #Combine.N2O_Out
, #Combine.CVP
, #Combine.BIS
, #Combine.BIS_SQI
FROM #Combine
try removing
as MACsevo
as MACsevo
Sorry dumb comment before ...
your missing an arithmetic operator here
(#Combine.Sevo_out)/(1.8*P OWER(10,(- 0.00269 here (#Combine.Age - 40))))
your missing an arithmetic operator here
(#Combine.Sevo_out)/(1.8*P
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I think this is working... trying to resolve the error from "dividing by zero" when patients are 40 years old, but after I fix that I will award points :)