sql - Condition in a stored procedure -
i have stored procedure 2 updates, want first update if parameter @active equals 'y'.
alter procedure sp_updatethis @something varchar(5), @active char(1) begin -- check see if active , update update mytable set this=@something -- run 1 regardless update yourtable set that=@something
try changing last line this:
if (@active = 'y') begin update yourtable set that=@something end
Comments
Post a Comment