この SQL クエリを起動すると、ゼロ除算エラーが発生します。
SELECT CONVERT(VARCHAR(11),CaptureTime,106) 'CaptureTime',
Type,
CASE WHEN Unit='g/L' THEN (data1* 0.02586) ELSE data1 END As data1,
CASE WHEN Unit='g/L' THEN nullif(data2* 0.02586,0) ELSE data2 END As data2,
CASE WHEN Unit='g/L' THEN nullif(data3* 0.02586,0) ELSE data3 END As data3,
CASE WHEN Unit='g/L' THEN nullif(data1* 0.02586,0) / nullif(data2* 0.02586,0) ELSE (data1/data2) END As Ratio,
CASE WHEN Unit='g/L' THEN 'ml/L' ELSE 'ml/L' END As data,
CASE WHEN Unit='g/L' THEN (data4* 0.01129) ELSE data4 END As data4
FROM something
where Type ='DATA'
and ID='" + Session["name"].ToString() + "'
Order By CONVERT(DateTime, CaptureTime,101) DESC