tsql - Conditional Insert -
i want fill temporary table on happening of condition, if select statement return result statement, else statement fill table e.g;
if exists(select name table name='zain') insert #table(name) --values above select statement
else if exists(select name table name='ali')
insert #table(name) --values above select statement
one way is:
insert #table (name) select name table name='zain' if (@@rowcount = 0) begin insert #table (name) select name table name='ali' end
Comments
Post a Comment