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

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

c++ - How to test/verify that zero-initialization takes place -

node.js - Webpack/TypeScript Raising Errors When node_modules is Excluded -