dbTalk Databases Forums  

Returning Record Identity

microsoft.public.sqlserver.programming microsoft.public.sqlserver.programming


Discuss Returning Record Identity in the microsoft.public.sqlserver.programming forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Atley
 
Posts: n/a

Default Returning Record Identity - 12-08-2004 , 03:17 PM






I need to be able to create a new record in a table and return the
AutoIncremented ID fields contents so I can be sure that no two people can
try to use the same ID Number.

Any suggestions, I have been looking for a while now, and I just do not seem
to making any headway.




Reply With Quote
  #2  
Old   
Tom Moreau
 
Posts: n/a

Default Re: Returning Record Identity - 12-08-2004 , 03:23 PM






Check out SCOPE_IDENTITY() in the BOL.

--
Tom

---------------------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com


"Atley" <atley_1 (AT) homtmail (DOT) com> wrote

I need to be able to create a new record in a table and return the
AutoIncremented ID fields contents so I can be sure that no two people can
try to use the same ID Number.

Any suggestions, I have been looking for a while now, and I just do not seem
to making any headway.




Reply With Quote
  #3  
Old   
Alejandro Mesa
 
Posts: n/a

Default RE: Returning Record Identity - 12-08-2004 , 03:31 PM



See SCOPE_IDENTIY() and @@IDENTITY in BOL.



AMB

"Atley" wrote:

Quote:
I need to be able to create a new record in a table and return the
AutoIncremented ID fields contents so I can be sure that no two people can
try to use the same ID Number.

Any suggestions, I have been looking for a while now, and I just do not seem
to making any headway.





Reply With Quote
  #4  
Old   
Agnes
 
Posts: n/a

Default Re: Returning Record Identity - 12-08-2004 , 11:45 PM



Could you tell me What is BOL ? Thx

--
..
"Tom Moreau" <tom (AT) dont (DOT) spam.me.cips.ca> ???
news:Oo23jwW3EHA.3840 (AT) tk2msftngp13 (DOT) phx.gbl ???...
Quote:
Check out SCOPE_IDENTITY() in the BOL.

--
Tom

---------------------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com


"Atley" <atley_1 (AT) homtmail (DOT) com> wrote in message
news:OuFKbtW3EHA.1408 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
I need to be able to create a new record in a table and return the
AutoIncremented ID fields contents so I can be sure that no two people can
try to use the same ID Number.

Any suggestions, I have been looking for a while now, and I just do not
seem
to making any headway.






Reply With Quote
  #5  
Old   
Kalen Delaney
 
Posts: n/a

Default Re: Returning Record Identity - 12-09-2004 , 12:13 AM



Books Online (BOL) is the documentation that comes with SQL Server. When you
install the product you'll get the Books Online installed also.
It should always be the first place you look for answers.

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


"Agnes" <agnes (AT) dynamictech (DOT) com.hk> wrote

Quote:
Could you tell me What is BOL ? Thx

--
.
"Tom Moreau" <tom (AT) dont (DOT) spam.me.cips.ca> ???
news:Oo23jwW3EHA.3840 (AT) tk2msftngp13 (DOT) phx.gbl ???...
Check out SCOPE_IDENTITY() in the BOL.

--
Tom

---------------------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com


"Atley" <atley_1 (AT) homtmail (DOT) com> wrote in message
news:OuFKbtW3EHA.1408 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
I need to be able to create a new record in a table and return the
AutoIncremented ID fields contents so I can be sure that no two people
can
try to use the same ID Number.

Any suggestions, I have been looking for a while now, and I just do not
seem
to making any headway.








Reply With Quote
  #6  
Old   
David Gugick
 
Posts: n/a

Default Re: Returning Record Identity - 12-09-2004 , 12:24 AM



Books On Line - the help file in SQL Server 2000

--
David Gugick
Imceda Software
www.imceda.com

Reply With Quote
  #7  
Old   
Atley
 
Posts: n/a

Default Re: Returning Record Identity - 12-09-2004 , 11:48 AM



I looked at those,

But I am worried because this is for an application where several people (up
to 20) could be making a new record at the same time. They just seem to
return the last identity entered.

I also didn't see in either of the examples if it could really help me
create a new record and then return the value of the ID field I specify.

Has anyone had to do this before and if so, how did you do it?




"Tom Moreau" <tom (AT) dont (DOT) spam.me.cips.ca> wrote

Quote:
Check out SCOPE_IDENTITY() in the BOL.

--
Tom

---------------------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com


"Atley" <atley_1 (AT) homtmail (DOT) com> wrote in message
news:OuFKbtW3EHA.1408 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
I need to be able to create a new record in a table and return the
AutoIncremented ID fields contents so I can be sure that no two people can
try to use the same ID Number.

Any suggestions, I have been looking for a while now, and I just do not
seem
to making any headway.






Reply With Quote
  #8  
Old   
Atley
 
Posts: n/a

Default Re: Returning Record Identity - 12-09-2004 , 01:36 PM



I looked at those,

But I am worried because this is for an application where several people (up
to 20) could be making a new record at the same time. They just seem to
return the last identity entered.

I also didn't see in either of the examples if it could really help me
create a new record and then return the value of the ID field I specify.

Has anyone had to do this before and if so, how did you do it?



"Tom Moreau" <tom (AT) dont (DOT) spam.me.cips.ca> wrote

Quote:
Check out SCOPE_IDENTITY() in the BOL.

--
Tom

---------------------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com


"Atley" <atley_1 (AT) homtmail (DOT) com> wrote in message
news:OuFKbtW3EHA.1408 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
I need to be able to create a new record in a table and return the
AutoIncremented ID fields contents so I can be sure that no two people can
try to use the same ID Number.

Any suggestions, I have been looking for a while now, and I just do not
seem
to making any headway.






Reply With Quote
  #9  
Old   
Atley
 
Posts: n/a

Default Re: Returning Record Identity - 12-09-2004 , 02:18 PM



I looked at those,

But I am worried because this is for an application where several people (up
to 20) could be making a new record at the same time. They just seem to
return the last identity entered.

I also didn't see in either of the examples if it could really help me
create a new record and then return the value of the ID field I specify.

Has anyone had to do this before and if so, how did you do it?

"Tom Moreau" <tom (AT) dont (DOT) spam.me.cips.ca> wrote

Quote:
Check out SCOPE_IDENTITY() in the BOL.

--
Tom

---------------------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com


"Atley" <atley_1 (AT) homtmail (DOT) com> wrote in message
news:OuFKbtW3EHA.1408 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
I need to be able to create a new record in a table and return the
AutoIncremented ID fields contents so I can be sure that no two people can
try to use the same ID Number.

Any suggestions, I have been looking for a while now, and I just do not
seem
to making any headway.






Reply With Quote
  #10  
Old   
Scott Morris
 
Posts: n/a

Default Re: Returning Record Identity - 12-09-2004 , 02:37 PM



Read the documentation more closely. Tom's suggestion is correct, assuming
the table involved uses an identity column. However, I can also interpret
your comments as an issue with a custom identity-column alternative design.
If so, then perhaps you should re-state the problem and show us the DDL and
code.

"Atley" <atley_1 (AT) homtmail (DOT) com> wrote

Quote:
I looked at those,

But I am worried because this is for an application where several people
(up
to 20) could be making a new record at the same time. They just seem to
return the last identity entered.

I also didn't see in either of the examples if it could really help me
create a new record and then return the value of the ID field I specify.

Has anyone had to do this before and if so, how did you do it?

"Tom Moreau" <tom (AT) dont (DOT) spam.me.cips.ca> wrote in message
news:Oo23jwW3EHA.3840 (AT) tk2msftngp13 (DOT) phx.gbl...
Check out SCOPE_IDENTITY() in the BOL.

--
Tom

---------------------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com


"Atley" <atley_1 (AT) homtmail (DOT) com> wrote in message
news:OuFKbtW3EHA.1408 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
I need to be able to create a new record in a table and return the
AutoIncremented ID fields contents so I can be sure that no two people
can
try to use the same ID Number.

Any suggestions, I have been looking for a while now, and I just do not
seem
to making any headway.








Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.