Inside my stored procedure, I have the following logic:
if exists(select * <<1>>)
begin
select * ...
end
else if exists(select * <<2>>)
begin
select 'no records'
end
else
select 'you do not have access'
end
Basically I want to return records from <<1>> if there are records. If not, I want to see if <<2>> returns records. If <<1>> returns records, I want to exit the stored procedure, and not go into <<2>> or the else part.
If <<1>> does not exist, and <<2>> exists, I want to return 'no records' and exit the stored procedure. If else, I want to return 'you do not have access'.
if exists(select * <<1>>)
begin
select * ...
end
else if exists(select * <<2>>)
begin
select 'no records'
end
else
select 'you do not have access'
end
Basically I want to return records from <<1>> if there are records. If not, I want to see if <<2>> returns records. If <<1>> returns records, I want to exit the stored procedure, and not go into <<2>> or the else part.
If <<1>> does not exist, and <<2>> exists, I want to return 'no records' and exit the stored procedure. If else, I want to return 'you do not have access'.