The query:
UPDATE empPac
SET quantityLimit = allocation,
allocationStart = '"&allocationStart&"',
nextUpdate = DATEADD(mm, allocationMonths, "&allocationStart&"),
lastUpdate = GETDATE(),
quantityIssued = 0,
quantityShipped = 0
WHERE allocation IS NOT NULL AND
allocationMonths <> 0 AND
(nextUpdate <= DATEADD(mm, "&checkCondition&", GETDATE()) OR
nextUpdate IS NULL) AND
empIdent in (select empIdent
from employee
where custIdent='"&custIdent&"')
What I want to do is add a conditional statement to the SET quantityLimit = allocation so that rather than having the WHERE allocation IS NOT NULL, I want it to have a conditional statement such as SET quantityLimit = ((allocation IS NULL) ? 0 : allocation)
You can use
ISNULL():Equivalent functions for other databases are
NVL()for Oracle andIFNULL()for MySQL and SQLiteWhat you really should be using though is
COALESCE()if you want to increase the portability of your code.COALESCEis part of the SQL-92 standard and widely supported across RDBMSes.