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 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -