日期:2014-05-19  浏览次数:20503 次

新人求解
一个视图:

SELECT   *,   CAST(TatolMark   AS   float)   /   CAST(MarkTimes   AS   float)   AS   Mark
FROM   Artis   s  

当MarkTimes   为0的时候,会报错,如何避免




------解决方案--------------------
SELECT *, CAST(TatolMark AS float) / case when CAST(MarkTimes AS float)=0 then null else CAST(MarkTimes AS float) end AS Mark
FROM Artis s