I used this code in SQL Server:
CREATE TYPE ExampleType AS TABLE (Number INT)
GO
CREATE FUNCTION GetExampleTableType(@InputNumber INT)
RETURNS ExampleType
AS
BEGIN
DECLARE @OutputTable ExampleType;
INSERT INTO OutputTable
VALUES (@InputNumber);
RETURN(@OutputTable);
END;
GO
But I got an error:
Must declare the scalar variable "@OutputTable"
I have declared @OutputTable but it cannot be a scalar value, it must be a table.
What is wrong?