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
Source Address: http://www.cnblogs.com/lsjwzh/archive/2008/08/03/1259370.html
SQL Server 2000 has three similar functions: scope_identity, ident_current, and @ identity. Both return values inserted into the identity column.
Ident_current returns the
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
Create a table, insert an id column, and automatically generate an id. The id is automatically generated.
USE [yuyongTest]
GO
-- Go: Execute now. The go statement segments the SQL Server script. After a segment is executed, the next segment can be
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
In SQL Server 2000, insert data returns an AutoNumber ID, and there are three ways to implement Scope_identity, Ident_current, and @ @IDENTITY, all of which return values inserted into the IDENTITY column.Ident_current: Returns the identity value
This article uses SQL Server 2005
Preparations:I need a user table. This table has several fields and a self-increasing number ID. The table structure is as follows:
This is a much simpler user table than in real-world applications, and userid
INSERT into SELECT statement
Statement form: Insert into Table2 (field1,field2,...) Select Value1,value2,... from Table1
The target table Table2 must exist, because the target table Table2 already exists, so we can insert a constant in addition to
In SQL Server 2000, IDs of automatic numbers are returned when data is inserted. scope_identity, ident_current, and @ identity are returned in three ways.
Ident_current: returns the last generated id value for any session and specific tables in
13. T-SQL and SQL query AnalyzerWhat is SQL?What is T-SQL?Introduce new features of T-SQLHow to Use T-SQLSummaryIn this chapter, we will introduce some basic concepts about the Structured Query Language and transact-SQL and their differences. This
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.