~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CREATE PROCEDURE RegisterDownload
(@UserName, @Title)
AS
UPDATE CustomerDownlList
SET NumDownloads = NumDownloads + 1
WHERE UserName = @UserName AND Title = @Title
SET Downloaded = 1 WHEN NumDownloads = Quantity
WHERE UserName = @UserName AND Title = @Title
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In ( SET Downloaded = 1 WHEN NumDownloads = Quantity ) sentence, I wanted to set the Downloaded to 1 IF NumDownloads = Quantity. I am not sure if WHEN operator works like a conditional IF though.