You'll have to use Table-Valued parameters. A link here: https://learn.microsoft.com/en-us/sql/relational-databases/tables/use-table-valued-parameters-database-engine
In your case you need to create a custom type in database (I declared column types as INT, as an example)
CREATE TYPE YourTypeName AS TABLE (
column_a INT
, column_b INT
, column_c INT);
One that's done, your procedure can be created as follows:
CREATE PROCEDURE [dbo].[InsertMultipleObject] (
@Objects YourTypeName READONLY
)
AS
BEGIN
SET NOCOUNT ON;
SELECT *
FROM @Objects;
END;
DECLARE @Objects YourTypeName;
INSERT INTO @Objects (column_a, column_b, column_c)
VALUES (1, 1, 1)
, (2, 2, 2)
, (3, 3, 3);
EXECUTE dbo.InsertMultipleObject @Objects = @Objects;
So this has taken a single parameter which contained multiple rows/columns as a parameter and simply made a SELECT *
from it.