sql server - return a default record from a sql query -
i have sql query run against sql server database eg.
select * mytable id = 2
this may return number of records or may return none. if returns none, alter sql query return default record, possible , if so, how? if records returned, default record should not returned. cannot update data need alter sql query this.
another way (you empty initial rowset returned);
select * mytable id = 2 if (@@rowcount = 0) select ...
Comments
Post a Comment