I have the following logic in a SQL Stored Prodecedure. I want the stored procedure to return 'yes' if exists if false. The problem is if exists is true, select ... 2 returns no data. If this is the case (that select ... 2 returns no records), how can I return 'no' using the logic below?
if exists(select ... 1)
begin
select ... 2
end
else
begin
print 'yes'
select 'yes'
end
if exists(select ... 1)
begin
select ... 2
end
else
begin
print 'yes'
select 'yes'
end