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) ) GO These tables represent a typical parent-child relationship where identity columns are used for the primary keys. Inserting records into such tables is usually problematic for performance, because client applications are required to perfo
Business Intelligence on Power BI, Azure and SQL Server