SQLTeam.com | Weblogs | Forums

Empty Result Set


#1

I have a query that returns 0 records. If this query returns 1 record I would like to throw an error.


#2

check for @@rowcount


#3

Just for an example you can do something like:

if exists 
(
select 1 
)

begin 
THROW 50000, 'Row Count is not ZERO', 1;
end