"Shelly" <> wrote in message
news:...
> Like I said, I know I can do this (adding, of course, the clause WHERE
> accountNumber=theaccountNumber) , but my question is can SQL do this
> automatically on the insert statement into the Agent table? If it can,
> then I can do an ExecuteScalar and return that value from the insert query
> without having to do two queries in succession with the possiblity of a
> race condition where someone else is adding an agent to the same account
> at the same time.
Do you mean something like this...?
<insert the record into the first table>
INSERT Agent (ID, field2, field3,...) VALUES (@@IDENTITY, value2,
value3,...)
--
Mark Rae
ASP.NET MVP
http://www.markrae.net