I have an application that I am working on that uses some small temp
tables. I am considering moving them to Table Variables - Would this
be a performance enhancement?
Some background information: The system I am working on has numerous
tables but for this exercise there are only three that really matter.
Claim, Transaction and Parties.
A Claim can have 0 or more transactions.
A Claim can have 1 or more parties.
A Transaction can have 1 or more parties.
A party can have 1 or more claim.
A party can have 1 or more transactions. Parties are really many to
many back to Claim and transaction tables.
I have three stored procs
insertClaim
insertTransaction
insertParties
From an xml point of view the data looks like this
<claim>
<parties>
<info />
insertClaim takes 3 sets of paramters - All the claim level
information (as individual parameters), All the parties on a claim (as
one xml parameter), All the transactions on a claim(As one xml
parameter with Parties as part of the xml)
insertClaim calls insertParties and passes in the parties xml -
insertParties returns a recordset of the newly inserted records.
insertClaim then uses that table to join the claim to the parties. It
then calls insertTransaction and passes the transaction xml into that
sproc.
insertTransaciton then inserts the transactions in the xml, and also
calls insertParties, passing in the XML snippet