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&"')
我想要做的就是添加一个条件语句的SET quantityLimit = allocation
,这样,而不是让WHERE allocation IS NOT NULL
,我希望它有一个条件语句,如SET quantityLimit = ((allocation IS NULL) ? 0 : allocation)
MSSQL。我写的条件陈述是PHP速记,但我不知道如何显示我想要做的事情的例子。 – scarhand