Click here to Skip to main content
16,020,347 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Guys,

I was wondering if you could give me a hand here please.. I'm trying to write a bit of SQL Which I will run a a Job that will scan the StockItem table and Update a SpareDate field with the Server Date IF the Stock Quantity is under 5.

I think I am along the correct lines but wanted to check you all the SQL Guru's out there if possible :)

SQL
DECLARE @Date DATE
SET @Date = GETDATE()

UPDATE Sage200DemoData.dbo.StockItem
SET SpareDate3 =
CASE
WHEN FreeStockQuantity <= '5' THEN SpareDate3 = @Date
END


However I think I have the wrong syntax near the '=' sign.

Any pointers would be great! :) Many thanks.
Posted

1 solution

SQL
UPDATE Sage200DemoData.dbo.StockItem
SET SpareDate3 = @Date
WHERE FreeStockQuantity <= 5
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900