T-SQL – Insert Data into Parent and Child Tables
Here is my solution (based on the same answer I’ve linked to in the comments): First, you must add another column to your UDT, to hold a temporary ID for the employee: CREATE TYPE dbo.tEmployeeData AS TABLE ( FirstName NVARCHAR(50), LastName NVARCHAR(50), DepartmentType NVARCHAR(10), DepartmentBuilding NVARCHAR(50), DepartmentEmployeeLevel NVARCHAR(10), DepartmentTypeAMetadata NVARCHAR(100), DepartmentTypeBMetadata NVARCHAR(100), EmployeeId int ) … Read more