Return GUID value Like @@IDENTITY
Is there a way to return the equivalent of @@IDENTITY using a GUID?
I need to insert data into a database in a parent/child format.
I insert the parent information into the parent table like this
Code:
Parent Table
PID (GUID) PK
ParentName
INSERT INTO tableName VALUES(newid(), '" & strParentName & "')
Then I need to insert the child information into the childs table something like this
Code:
Child Table
CID (GUID) PK
PID (GUID) FK references ParentTable.PID
ChildName
INSERT INTO tableName VALUES(newid(), get GUID that was inserted in ParentTable.PID field, '" & childName & "')
any ideas?