Я пытался, но нет, @gbn правильно, вы не можете в SQL Server 2005
вот моя попытка:
CREATE FUNCTION dbo.TestTable
(
@InputTable table (RowID int, DataValue varchar(10))
)
RETURNS
table (RowID int, DataValue varchar(10))
AS
SELECT * FROM @InputTable ORDER BY 1 DESC
RETURN
go
DECLARE @t table (RowID int, DataValue varchar(10))
INSERT INTO @t VALUES (3,'cccc')
INSERT INTO @t VALUES (2,'bbbb')
INSERT INTO @t VALUES (1,'aaaa')
select * from @t
select * from dbo.TestTable(@t)
вот ошибки:
Msg 156, Level 15, State 1, Procedure TestTable, Line 3
Incorrect syntax near the keyword 'table'.
Msg 1087, Level 15, State 2, Procedure TestTable, Line 8
Must declare the table variable "@InputTable".
Msg 1087, Level 15, State 2, Line 1