I am using a table-valued parameter in one our stored procedures. Here is the syntax I used:
@districtlist NumericList readonly
(NumericL
You can pass the TVP as default:
EXEC dbo.Test_TVP @my_table = default
Which is the equivalent of an empty table.
You can opt to not pass the parameter, even if no default is defined for it. For example:
CREATE TYPE TestTable AS TABLE (my_id INT)
GO
CREATE PROCEDURE dbo.Test_TVP
@my_table TestTable READONLY,
@my_int INT
AS
BEGIN
SELECT * FROM @my_table
END
GO
EXEC dbo.Test_TVP @my_int = 2
GO
DROP PROCEDURE dbo.Test_TVP
DROP TYPE TestTable
In this case the table will simply be empty. If you wanted some number of default rows then you would have to simulate that in the stored procedure, probably by using a temporary table since table-valued parameters must be READONLY
.