Reputation: 510
I wrote this precedure that checks certain conditions and then runs an INSERT or UPDATE base on the data. However, for some reason the INSERT does not execute.
IF @sid = ''
BEGIN
INSERT INTO Book_Art (Sub_ID, Art_IDs, P_ID) VALUES (@Sub_ID,@art_id,@P_ID)
END
ELSE IF @aids = ''
BEGIN
SET @comma = ''
UPDATE Book_Art SET Art_IDs = + @aids + @comma + @art_id WHERE Sub_ID = @Sub_ID AND P_ID = @P_ID
END
ELSE
BEGIN
SET @comma = ','
UPDATE Book_Art SET Art_IDs = + @aids + @comma + @art_id WHERE Sub_ID = @Sub_ID AND P_ID = @P_ID
END
END
Upvotes: 0
Views: 47