I want to create a procedure to update a table. It takes number of input parameters(one of them is the @pID) and updates four columns which have the pID=@pID and only one of these four columns can be updated if the value of another column='F' in addition to pID=@pID. How can I do this?
This is what I've got so far
CREATE PROCEDURE ABC (
@pID
@A INT,
@B CHAR,
@C CHAR,
@D VARCHAR)
AS
update EEE
set A=@A,
B=@B,
C=@C
WHERE pID=@pID
update EEE
set D=@D
Where pID=@pID AND G='T'