471,348 Members | 1,558 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

Autonumber Fields & Insert Statment

Hi,

I have a table which the first field is an autonumber field as is also my
keyfield. Now I want to know if it is possible that after I do an insert
stament I can get what the value of this autonumber field. My problem is
that I cannot do a "select (max(field_name))" cause I have multiple users
using the same table and I can have an other insert from another user while
I'm getting the max field value.

Ivan
Feb 24 '06 #1
3 1563
after that
Select @@identity

"Ivan Sammut" <sa*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a table which the first field is an autonumber field as is also my
keyfield. Now I want to know if it is possible that after I do an insert
stament I can get what the value of this autonumber field. My problem is
that I cannot do a "select (max(field_name))" cause I have multiple users
using the same table and I can have an other insert from another user
while
I'm getting the max field value.

Ivan

Feb 24 '06 #2
Hi,

It's not that simple if you are using access.

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Dragon" <ta*****@hotmail.com> wrote in message
news:Oc**************@TK2MSFTNGP10.phx.gbl...
after that
Select @@identity

"Ivan Sammut" <sa*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a table which the first field is an autonumber field as is also my
keyfield. Now I want to know if it is possible that after I do an insert
stament I can get what the value of this autonumber field. My problem is
that I cannot do a "select (max(field_name))" cause I have multiple users
using the same table and I can have an other insert from another user
while
I'm getting the max field value.

Ivan


Feb 24 '06 #3
Hi,

Sorry for the previous post, you were right, you can get it executing select
@@identity , you just have to make sure of using the same connection
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:e7**************@TK2MSFTNGP09.phx.gbl...
Hi,

It's not that simple if you are using access.

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Dragon" <ta*****@hotmail.com> wrote in message
news:Oc**************@TK2MSFTNGP10.phx.gbl...
after that
Select @@identity

"Ivan Sammut" <sa*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a table which the first field is an autonumber field as is also
my
keyfield. Now I want to know if it is possible that after I do an insert
stament I can get what the value of this autonumber field. My problem is
that I cannot do a "select (max(field_name))" cause I have multiple
users
using the same table and I can have an other insert from another user
while
I'm getting the max field value.

Ivan



Feb 24 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Ilan Sebba | last post: by
35 posts views Thread by Traci | last post: by
3 posts views Thread by ben.werdmuller | last post: by
4 posts views Thread by Dan Keeley | last post: by
1 post views Thread by zeebiggie | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.