Member 12905644 Ответов: 3

Функция 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; 


Что я уже пробовал:

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; 

3 Ответов

Рейтинг:
22

CPallini

Предполагая, что вы используете SQL Server, то вы должны указать восстановительная стоимость, видеть ISNULL (Transact-SQL) | Microsoft Docs[^].


Member 12905644

Выше я не заменяю стоимость

CPallini

SQL Server IsNull функция требует восстановительная стоимость.

Рейтинг:
1

barneyman

я думаю, что вам нужно проверить IS NULL а не функция ISNULL()

видеть IS NULL (Transact-SQL) | Microsoft Docs[^]


Рейтинг:
1

Richard Deeming

Заменять:

Iif(Isnull(salestypestatus), 'S', salestypestatus)

с:
IsNull(salestypestatus, 'S')