isnull函数需要2个参数。 [英] The isnull function requires 2 argument(s).

查看:481
本文介绍了isnull函数需要2个参数。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SELECT salesmast.*,
       ledgermast.ledgername          AS Customer,
       areamast.areaid,
       areamast.areadesc,
       LedgerMast_1.ledgername        AS SalesLedger,
       ledgermast.phone,
       ledgermast.subareaid           AS SubAreaID2,
       ledgermast.salesmanid          AS SalesmanID2,
       salestypemast.salestypedesc,
       salestypemast.salestypestatus,
       ( Iif(Isnull(salestypestatus), 'S', salestypestatus) & '/' &
         Format(Val(
         salesmast.invno), "00000") ) AS STDcNo,
       tablesmast.tablecode,
       ordertypemast.ordertypedesc,
       operators.operatorname,
       salesmanmast.salesmanname,
       doctormast.doctorname
FROM   (((((((salesmast
              LEFT JOIN (ledgermast
                         LEFT JOIN areamast
                                ON ledgermast.areaid = areamast.areaid)
                     ON salesmast.customerledgerid = ledgermast.ledgerid)
             LEFT JOIN ledgermast AS LedgerMast_1
                    ON salesmast.salesledgerid = LedgerMast_1.ledgerid)
            LEFT JOIN salestypemast
                   ON salesmast.salestypeid = salestypemast.salestypeid)
           LEFT JOIN tablesmast
                  ON salesmast.table_id = tablesmast.table_id)
          LEFT JOIN ordertypemast
                 ON salesmast.ordertypeid = ordertypemast.ordertypeid)
         LEFT JOIN operators
                ON salesmast.operatorid = operators.operatorid)
        LEFT JOIN salesmanmast
               ON salesmast.salesmanid = salesmanmast.salesmanid)
       LEFT JOIN doctormast
              ON salesmast.doctorid = doctormast.doctorid; 





我的尝试:





What I have tried:

SELECT salesmast.*,
       ledgermast.ledgername          AS Customer,
       areamast.areaid,
       areamast.areadesc,
       LedgerMast_1.ledgername        AS SalesLedger,
       ledgermast.phone,
       ledgermast.subareaid           AS SubAreaID2,
       ledgermast.salesmanid          AS SalesmanID2,
       salestypemast.salestypedesc,
       salestypemast.salestypestatus,
       ( Iif(Isnull(salestypestatus), 'S', salestypestatus) & '/' &
         Format(Val(
         salesmast.invno), "00000") ) AS STDcNo,
       tablesmast.tablecode,
       ordertypemast.ordertypedesc,
       operators.operatorname,
       salesmanmast.salesmanname,
       doctormast.doctorname
FROM   (((((((salesmast
              LEFT JOIN (ledgermast
                         LEFT JOIN areamast
                                ON ledgermast.areaid = areamast.areaid)
                     ON salesmast.customerledgerid = ledgermast.ledgerid)
             LEFT JOIN ledgermast AS LedgerMast_1
                    ON salesmast.salesledgerid = LedgerMast_1.ledgerid)
            LEFT JOIN salestypemast
                   ON salesmast.salestypeid = salestypemast.salestypeid)
           LEFT JOIN tablesmast
                  ON salesmast.table_id = tablesmast.table_id)
          LEFT JOIN ordertypemast
                 ON salesmast.ordertypeid = ordertypemast.ordertypeid)
         LEFT JOIN operators
                ON salesmast.operatorid = operators.operatorid)
        LEFT JOIN salesmanmast
               ON salesmast.salesmanid = salesmanmast.salesmanid)
       LEFT JOIN doctormast
              ON salesmast.doctorid = doctormast.doctorid; 

推荐答案

假设您使用的是 SQL Server ,那么您必须指定替换值,请参阅 ISNULL(Transact-SQL )| Microsoft Docs [ ^ ]。
Assuming you are using SQL Server, then you have to specify the replacement value, see ISNULL (Transact-SQL) | Microsoft Docs[^].


我认为你需要测试 IS NULL 而不是函数 ISNULL()



IS NULL(Transact-SQL)| Microsoft Docs [ ^ ]
i think you need test IS NULL rather than the function ISNULL()

see IS NULL (Transact-SQL) | Microsoft Docs[^]


替换:
Iif(Isnull(salestypestatus), 'S', salestypestatus)



with:


with:

IsNull(salestypestatus, 'S')


这篇关于isnull函数需要2个参数。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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