Re: Getting result of odbc's INSERT INTO command



"Joe" wrote:
> My problem is that other clients could add records in the meantime. My
> module is using only one connection to serve multiple clients. So I can
> use a lock.
>
> The Select MAX(id) in this case seems dangerous to me.

If you are just using one connection you are a tad screwed really, the
@@identity works on a connection by connection basis.

However, if it is just the single connection, are you passing them one by
one from some sort of queue? If so you should add some sort of return to
your query that automatically queries @@IDENTITY straight after any INSERT.

Otherwise, its time to start using multiple connections.

--
- Mark Randall
http://zetech.swehli.com


.



Relevant Pages


Loading