First of all, change OKS_Status
data type to bit[
^], which accepts
0
,
1
or null values.
Secondly, use query like:
UPDATE Client_feedback SET OKS_Status = CASE WHEN OKS_Status = 1 THEN 0 ELSE 1 END
WHERE ALID = @alid
Where
@alid
is proper value (i believe it's integer value).
Complete sample:
DECLARE @Client_feedback TABLE(ALID INT, OKS_Status BIT)
INSERT INTO @Client_feedback (ALID, OKS_Status)
VALUES(1,0)
SELECT *
FROM @Client_feedback
UPDATE @Client_feedback SET OKS_Status = CASE WHEN OKS_Status = 1 THEN 0 ELSE 1 END
WHERE ALID = 1
SELECT *
FROM @Client_feedback
UPDATE @Client_feedback SET OKS_Status = CASE WHEN OKS_Status = 1 THEN 0 ELSE 1 END
WHERE ALID = 1
SELECT *
FROM @Client_feedback
Of course, you can use the same logic with 'boolean' version ;)
If you use SQL server database, i suggest to use stored procedure.