I have two tables kinda like this:
// Person.Details Table:
PersonID int [PK] | EmployeeCreatorID int [FK] | FirstName varchar | OtherInfo...
// Employee.Details Table:
EmployeeID int [PK] | PersonID int [FK] | IsAdmin bit | OtherInfo...
Each table is related to the other:
[Employee.Details.PersonID]===>[Person.Details.PersonID] AND
[Person.Details.EmployeeCreatorID]===>[Employee.Details.EmployeeID]
through their foreign keys.
The problem is that it is not possible to create the first person/Employee without removing one of the foreign keys constraints, inserting the rows, then adding the constraint back in (which is pretty lame).
The obvious God-paradox here is that the first "Employee" doesn't exist to create itself (the "Person").
Is there a way to simultaneously insert data into two tables? This created-is-the-creator scenario will only need to happen once. If I cannot insert data into two tables simultaneously are there any other methods you SO geniuses suggest?
CLARIFICATIONS
There are other tables that are related to the "Persons" table...like "Students" and "Guardians." A person cannot switch types (Employee cannot switch to Student or Guardian, and visa-versa). The paradox is similar to an Employee table that has a ManagerID FK; except in my case the tables have been separated.
SOLUTION thanks to Remus Rusanu and b0fh
--/*seeds database with first employee*/
BEGIN TRAN
GO
INSERT INTO Person.Details
(EmployeeCreatorID, FirstName, Active)
VALUES
(@@Identity, 'Admin', 1)
DECLARE @Identity int;
SET @Identity = @@Identity;
INSERT INTO Employee.Details
(PersonID, IsAdmin, Email, Password)
VALUES
(@Identity, 1, 'admin', 'admin')
UDPATE
Person.Details
SET
EmployeeCreatorID = @@Identity
WHERE
PersonID = @Identity
IF(@@ERROR <> 0)
ROLLBACK TRAN
ELSE
COMMIT TRAN