Here's how to use table typed arguments to author a stored procedure that inserts multiple master-detail records into tables that use identity columns for primary key. Consider the following Accounts and Transactions tables: CREATE TABLE Accounts ( AccountID int not null identity(1,1) PRIMARY KEY, CustomerName NVARCHAR(100) not null, AccountType NVARCHAR(10) not null ) CREATE TABLE [Transactions] ( AccountID int not null, TransactionID int not null identity(1,1), TransactionDate date default (GETDATE()), Amount money not null default (0.00), CONSTRAINT PK_Transactions PRIMARY KEY (AccountID, TransactionID), CONSTRAINT FK_TransactionAccount FOREIGN KEY (AccountID) REFERENCES Accounts(AccountID) ) ...
Business Intelligence on Power BI, Azure and SQL Server