INSERT INTO ChildTable (DataCol3, DataCol4) VALUES ('Rec2-1','Rec2-2')
As indicated in your article, ChildKey PK populates automatically.
When I try to create a new record in ParentTable that is linked to the record previously created in ChildTable I'm having trouble.
The following does not work. Please advise and thanks in advance.
DECLARE @myNewID uniqueidentifier
SELECT @myNewID = NEWID()
SET ParentKey = @myNewID
WHERE DataCol3 = 'Rec2-1'
INSERT INTO ParentTable
(ParentKey, DataCol1, DataCol2)
VALUES (@myNEWID, 'New3','New31')
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!