Give the return type as Table in Function signature then you can return the result of any select statement as a table to calling function.
Example: Here we create a function say 'fun_returning_tab' which is taking a parameter @pnr_no and returning table to the calling function.
Create function fun_returning_tab( @pnr_no varchar(7)) return table
as
Begin
return (select * from reservation where pnr_no = @pnr_no)
End
How to call this function:
select * from fun_returning_tab(8161237)
enjoy coding...:)
Post Reference: Vikram Aristocratic Elfin Share
Example: Here we create a function say 'fun_returning_tab' which is taking a parameter @pnr_no and returning table to the calling function.
Create function fun_returning_tab( @pnr_no varchar(7)) return table
as
Begin
return (select * from reservation where pnr_no = @pnr_no)
End
How to call this function:
select * from fun_returning_tab(8161237)
enjoy coding...:)
Post Reference: Vikram Aristocratic Elfin Share
No comments:
Post a Comment