将访问代码转换为SQL [英] Converting Access Code to SQL

查看:43
本文介绍了将访问代码转换为SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Access中有以下代码,我需要它在sql中工作,数字"部分使我失望.

I have the following code in Access and I need it to work in sql, the Is numeric portion is throwing me off.

Sum([Employee Count]*IIf(IsNumeric([Length]),[Length],0)) AS Total_hours, 

推荐答案

您将用CASE表达式替换IIF(). IsNumeric() 在SQL Server:

You will replace the IIF() with a CASE expression. The IsNumeric() is valid in SQL Server:

Sum([Employee Count]*
    case when IsNumeric([Length]) = 1
          then [Length]
          else 0 end) AS Total_hours,

这篇关于将访问代码转换为SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆