Another sql statement problem
Hi Everyone,
What is wrong with this sql statement? I keep getting an error saying that there is an incorrect syntax near the '=' sign. I would appreciate any help. Thank you.
Code:
SELECT MemID, MemName, (CASE WHEN PayCredit = AppRes THEN PayCredit = NULL
ELSE PayCredit - AppRes END) AS AppliedCredit, (CASE WHEN AppRes = 0 THEN AppRes = NULL
ELSE AppRes END) AS CreditReserve
FROM Archive
WHERE PDate BETWEEN CAST('" & DTPicker1.Value & "' AS smalldatetime) AND CAST('" & DTPicker2.Value & "' AS smalldatetime) AND
PayCredit <> 0 AND PayCredit <> DedRes
ORDER BY ID
Re: Another sql statement problem
Quote:
Originally posted by Ace
Hi Everyone,
What is wrong with this sql statement? I keep getting an error saying that there is an incorrect syntax near the '=' sign. I would appreciate any help. Thank you.
Code:
SELECT MemID, MemName, (CASE WHEN PayCredit = AppRes THEN PayCredit = NULL
ELSE PayCredit - AppRes END) AS AppliedCredit, (CASE WHEN AppRes = 0 THEN AppRes = NULL
ELSE AppRes END) AS CreditReserve
FROM Archive
WHERE PDate BETWEEN CAST('" & DTPicker1.Value & "' AS smalldatetime) AND CAST('" & DTPicker2.Value & "' AS smalldatetime) AND
PayCredit <> 0 AND PayCredit <> DedRes
ORDER BY ID
is ur paycredit a numeric ... if so it cannot accept null. it shd be 0
try changing the null to 0