Inserting Data into Multiple Tables
I have two tables Orders and Orders_detail.
The Orders table has OrderID as the primary key.
The Orders_detail table has the OrderID as a foreign key.
In my ASP application, I want to insert a record into both tables. How do I get the OrderID from the Orders table, so that I can insert the data into my Orders_detail table. In Oracle, I would have the OrderID set as a sequence and then use the OrderId.currval for the insert into the Orders_detail table. I'm not sure how to do this in Sql Server 2005. Can anyone help ?
|