I was reading this post Click and I realize that we can't use a stored procedure in SELECT / WHERE / HAVING
statements/clauses, but we can use them in an UDF, so why does this stored procedure work and return data?
I'm using select and having in this stored procedure:
create proc person_sp (@id int)
as
begin
select id, [name], lastname
from person
group by id, [name], lastname
having sum(id) > 3
end
and then I called
exec person_sp 1