I just created a UDF and testing it I found only works when I use this syntax
SELECT [PMIS].[dbo].[fnIsReportingTo] (50,1132)
I was expecting it to work like this:
select * from fnIsReportingTo (50,1132)
or
select fnIsReportingTo (50,1132)
here is my create SQL:
create function fnIsReportingTo
(
@BossID int,
@EmployeeID int)
RETURNs bit
AS
begin
declare @ret bit
if exists (select * from dbo.fnGetEmployeeHierarchy(@BossID) where employeeID=@employeeID)
select @ret=1
else
select @ret=0
return @ret
end