Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Inserting in Multiple tables

Author  Topic 

azamsharp
Posting Yak Master

201 Posts

Posted - 2005-06-02 : 10:22:09
Okay I am sending multiple values to the database which have to be inserted in two tables. PersonID is a identity column. I know I can get the PersonID using @@IDENTITY but the I am using OPENXML to insert the Names.

Person:

PersonID Name
1 John
2 Cindy
3 Sally

and at the same time the PersonID generated have to be inserted into another table:

Test:

TestID PersonID
1 1
2 2
3 3

How can this be done.


Mohammad Azam
www.azamsharp.net

nathans
Aged Yak Warrior

938 Posts

Posted - 2005-06-02 : 11:35:34
You can use the OpenXML metaproperties to acheive this.

Look into BOL or post your openXML query here for more help.


Nathan Skerl
Go to Top of Page
   

- Advertisement -