how can I do an if statement to check if the column value is equal to an input value a user entered
I have a table called Tasks and a primary key called TaskID. How would the “if” condition look like if I am trying to compare an id a user entered, to the TaskID column
basically I am trying to do if(TaskID = 599) insert values
I have tried this so far:
if ((select TaskID from MyDB.dbo.Tasks where TaskID=599) = 599)
begin
insert into MyDB.dbo.Tasks (Concluded)
Values (1)
end
however I don’t think it has the result I want. It keeps creating a new task in stead.
Try this