In actual database applications, we often need to get the inserted flag value to write data into the relevant table. But what we usually get is the value we need?Sometimes we use select @ identity to obtain the value we just inserted, such as the
SQL Server 2000 has three similar functions: scope_identity, ident_current, and @ identity. Both return values inserted into the identity column.Nbsp; ident_current returns the final id value generated for any session and a specific table in any
[Original address:] The differences between scope_identity, ident_current, and @ identity (comparison)
@ Identity (TRANSACT-SQL) returns the system function of the last inserted Identifier value.
Note: After an insert, select into, or large-capacity
For more information about bugs fixed in SQL Server 2000 Service Pack 4, click the following article number to view the article in the Microsoft Knowledge Base:314128 FIX: When an RPC call is performed, Access with conflicting values includes an
Obtain the automatic ID of the last inserted record in SQL Server 2000 in several ways. For more information, see the following description and comparison.
1. The simplest way to obtain this ID is: (here is a simple and practical example)
--
Recently, this problem occurs in the development project. After a record is inserted, it immediately obtains its auto-increment ID in the database to process the associated data. How can this problem be solved? You can do this in SQL Server 2000 in
Recently, I encountered a problem in the development project, that is, after inserting a record, I need to immediately obtain the ID in the database, which is auto-incrementing. How can I do this? There are several methods available in SQL Server 200
Recently, I encountered a problem in the development project, that is, after inserting a record, I need to immediately obtain the ID in the database, which is auto-incrementing. How can I do this?
There are several methods available in SQL server 200
1. The simplest way to obtain this ID is: (here is a simple and practical example)
-- Create databases and tables
Create database MyDataBase use MyDataBase create table mytable ( id int identity (1, 1 ), name varchar (20)
-- Execute this SQL
[PHP] MySQL obtains the primary key (auto-increment ID) of the inserted data. to prevent primary key conflicts, the auto-increment (auto_increment type) field is often used during database design. Therefore, the primary key of the modified record is
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.