Hi chetan,
I have made use of the following table Customers with the schema as follows.
I have already inserted few records in the table.
You can download the database table SQL by clicking the download link below.
Download SQL file
SQL
CREATE FUNCTION fn_GetCustomers()
RETURNS @tblCustomers TABLE
(
Id INT NULL,
Name VARCHAR(100) NULL,
Country VARCHAR(50) NULL
)
AS
BEGIN
INSERT INTO @tblCustomers
SELECT * FROM Customers
RETURN
END
GO
SELECT * FROM fn_GetCustomers()
Output
Id |
Name |
Country |
1 |
John Hammond |
United States |
2 |
Mudassar Khan |
India |
3 |
Suzanne Mathews |
France |
4 |
Robert Schidner |
Russia |