/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Function with input parameter and it will return table parameter(only one as function return only one parameter in this case it is table type)
Create FUNCTION MyTestFunction
(
@DataBaseTableColumn3 int
)
RETURNS @Dummytable TABLE
(
MyColumn1 nvarchar(max),
MyColumn2 nvarchar(max)
)
AS
Begin
insert into @Dummytable(MyColumn1,MyColumn2)SELECT top 1 DataBaseTableColumn1,DataBaseTableColumn2 FROM DatabaseTable where DataBaseTableColumn3=@DataBaseTableColumn3
RETURN
End
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Function without input parameter and it will return table parameter(only
one as function return only one parameter in this case it is table type)
Create FUNCTION MyTestFunction
(
)
RETURNS @Dummytable TABLE
(
MyColumn1 nvarchar(max),
MyColumn2 nvarchar(max)
)
AS
Begin
insert into @Dummytable(MyColumn1,MyColumn2)SELECT top 1 DataBaseTableColumn1,DataBaseTableColumn2 FROM DatabaseTable
RETURN
End
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////