Orders
OrderId (Int identity) , AssociatedOrderId (foreign key to OrderId, allows null) , OrderName, ......
I need to insert into the above table from a tvp. How do i map the AssociatedOrderId during the insert?
Technology Tips and News
Orders
OrderId (Int identity) , AssociatedOrderId (foreign key to OrderId, allows null) , OrderName, ......
I need to insert into the above table from a tvp. How do i map the AssociatedOrderId during the insert?
I answered a similar question earlier today:
http://social.Msdn.microsoft.com/Forums/en-US/transactsql/thread/0430e4c1-eeb3-4a4c-b008-308b5795435b#43be232a-09c2-476f-b3c7-2f88c4dd0b76
The gist is that as long as you insist on using IDENTITY, you need to take them one by one, or at least add the associate keys later. If you roll your own, you have more control.