Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IS NULL Within a CASE statement 1

Status
Not open for further replies.
Apr 12, 2001
5
GB
When I try to use WHEN IS NULL THEN ...... within a case expression I get the message "incorrect syntax near the keyword IS"

Nulls are checked in the table. The code below worked fine before I added the last CASE expression listed:

CASE [sale or return]
WHEN 'R'
THEN - PI.[Cost of sales]
ELSE PI.[Cost of sales]
END AS cost,
CASE [Ledgering a/c]
WHEN IS NULL
THEN [Cust account no]
ELSE [ledgering a/c]
END AS [ledgering ac]

Many thanks in advance.

Peter M


 

Use the following syntax.

CASE [sale or return]
WHEN 'R'
THEN - PI.[Cost of sales]
ELSE PI.[Cost of sales]
END AS cost,
CASE
WHEN [Ledgering a/c] IS NULL
THEN [Cust account no]
ELSE [ledgering a/c]
END AS [ledgering ac]
Terry Broadbent


"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top