I want to know which option is better or faster and why?
Basically I am looking to create a function and implement some logic but I having problems with the performance. I want to understand why returning a table as a variable is taking more time that a select.
CREATE FUNCTION [dbo].[ufn_GetID]  
(
    @Par BIT
)   
RETURNS TABLE 
AS RETURN
(
     Select * from dbo.Mytable where a=@Par
)
GO
or 
CREATE FUNCTION [dbo].[ufn_GetID]  
(
    @Par BIT
)  
RETURNS @Return Table 
( 
[Id] bigint  ,
[a] BIT  NULL
)
BEGIN
insert into @Return
Select * from dbo.Mytable where a=@Par
    RETURN
end       
Thanks
