Can anyone explain the design decision behind preventing table valued parameters from being specified as output parameters to stored procedures?
I can\'t count the n
Table-valued parameters have the following restrictions(source MSDN):
there are few options to over come this restriction one is
CREATE TYPE RTableType AS TABLE(id INT, NAME VARCHAR )
go
CREATE PROCEDURE Rproc @Rtable RTABLETYPE READONLY,
@id INT
AS
BEGIN
SELECT *
FROM @Rtable
WHERE ID = @id
END
go
DECLARE @Rtable RTABLETYPE
DECLARE @Otable RTABLETYPE
INSERT INTO @Rtable
VALUES (1,'a'),
(2,'b')
INSERT @Otable
EXEC Rproc
@Rtable,
2
SELECT *
FROM @Otable
through this you can get the table values out