BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SQLServer, Identity(autoincriment), and returning value

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Claude
Guest





PostPosted: Fri May 21, 2004 2:41 pm    Post subject: SQLServer, Identity(autoincriment), and returning value Reply with quote



How do I retrieve the value of an identity column
after it is inserted into a table?
Select max will is bad because other records my be
inserted at the same time.


Back to top
Viatcheslav V. Vassiliev
Guest





PostPosted: Fri May 21, 2004 2:46 pm    Post subject: Re: SQLServer, Identity(autoincriment), and returning value Reply with quote



Select @@Identity

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Claude" <claude (AT) dev (DOT) scomage.com> сообщил/сообщила в новостях следующее:
news:40ae1529$1 (AT) newsgroups (DOT) borland.com...
Quote:
How do I retrieve the value of an identity column
after it is inserted into a table?
Select max will is bad because other records my be
inserted at the same time.





Back to top
Claude
Guest





PostPosted: Fri May 21, 2004 3:32 pm    Post subject: Re: SQLServer, Identity(autoincriment), and returning value Reply with quote



Thanks for the reply.

Is there a way that it could be implemented also for Access and Oracle?

Claude

"Viatcheslav V. Vassiliev" <support (AT) oledbdirect (DOT) com> wrote

Quote:
Select @@Identity

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Claude" <claude (AT) dev (DOT) scomage.com> сообщил/сообщила в новостях следующее:
news:40ae1529$1 (AT) newsgroups (DOT) borland.com...
How do I retrieve the value of an identity column
after it is inserted into a table?
Select max will is bad because other records my be
inserted at the same time.







Back to top
OKusmen
Guest





PostPosted: Mon Aug 16, 2004 5:01 am    Post subject: Re: SQLServer, Identity(autoincriment), and returning value Reply with quote

Table->Insert();
......
Table->Post();

int newId = Table->FieldValues["IdentityField"];

"Claude" <claude (AT) dev (DOT) scomage.com> wrote

Quote:
Thanks for the reply.

Is there a way that it could be implemented also for Access and Oracle?

Claude

"Viatcheslav V. Vassiliev" <support (AT) oledbdirect (DOT) com> wrote in message
news:40ae165d$1 (AT) newsgroups (DOT) borland.com...
Select @@Identity

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Claude" <claude (AT) dev (DOT) scomage.com> сообщил/сообщила в новостях следующее:
news:40ae1529$1 (AT) newsgroups (DOT) borland.com...
How do I retrieve the value of an identity column
after it is inserted into a table?
Select max will is bad because other records my be
inserted at the same time.









Back to top
OKusmen
Guest





PostPosted: Mon Aug 16, 2004 5:02 am    Post subject: Re: SQLServer, Identity(autoincriment), and returning value Reply with quote

sorry. It is not for Oracle.

For Oracle, You can query "object.curval".

"Select object.curval FROM DUAL"

"Claude" <claude (AT) dev (DOT) scomage.com> wrote

Quote:
Thanks for the reply.

Is there a way that it could be implemented also for Access and Oracle?

Claude

"Viatcheslav V. Vassiliev" <support (AT) oledbdirect (DOT) com> wrote in message
news:40ae165d$1 (AT) newsgroups (DOT) borland.com...
Select @@Identity

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Claude" <claude (AT) dev (DOT) scomage.com> сообщил/сообщила в новостях следующее:
news:40ae1529$1 (AT) newsgroups (DOT) borland.com...
How do I retrieve the value of an identity column
after it is inserted into a table?
Select max will is bad because other records my be
inserted at the same time.









Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.