Problems with Update...Case Statement

GrahamK

Registered User.
Local time
Today, 06:02
Joined
Aug 5, 2008
Messages
25
Hello All,

I'm trying to run the query Below on SQL Server 2000 and and getting the error "Line 4: Incorrect syntax near '=' " I wonder if anyone can offer assistance?

Code:
UPDATE tblStaffQual
SET Status = 
     (CASE
        WHEN GETDATE() >= Expires_Date THEN Status = 'Expired'
        WHEN GETDATE() < (Expires_Date-90) THEN Status = 'Current'
        ELSE (Status = 'Approaching')
        END
    );

Many Thanks
Graham
 
Last edited:
For starters, this is the kind of thing that should not be stored, rather calculated on the fly as needed. You would have to run this every day to keep things current. That said, the syntax would be:

WHEN GETDATE() >= Expires_Date THEN 'Expired'
 
For starters, this is the kind of thing that should not be stored, rather calculated on the fly as needed. You would have to run this every day to keep things current. That said, the syntax would be:

WHEN GETDATE() >= Expires_Date THEN 'Expired'

Paul,

Thank you very much for your assistance!

Graham
 

Users who are viewing this thread

Back
Top Bottom