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')