设置SQLCA.dbParm = "AtAtIdentity = '1'"
Database Connectivity Information
==============================================
New DBParm Support
==================
Support for a new DBParm, AtAtIdentity, has been added to the
Microsoft SQL Server (PBMSS70.DLL) interface.
AtAtIdentity
--------------
Specifies what syntax the Microsoft SQL Server database interface
uses to obtain the identity value of a new row in a database table.
When a DataWindow update request inserts a new row into a
Microsoft SQL Server table that contains an IDENTITY column, the
DataWindow engine calls PBMSS70 to obtain the identity value of
the newly inserted row. The AtAtIdentity DBParm allows you to
define how this request is implemented.
Values are:
0 (Default) Use the syntax SELECT MAX(IDENTCOL) FROM <table name>
to obtain the identity value of the newly inserted row
1 Use the syntax SELECT @@identity to obtain the identity value
of the newly inserted row
By default, PBMSS70 issues SELECT MAX(IDENTCOL) FROM <table name>.
This produces the correct result as long as two users are not updating
the same table at the exact same time. If your application does
many concurrent updates to the same table, set AtAtIdentity = 1.
When AtAtIdentity is set, PBMSS70 issues SELECT @@identity to obtain the
IDENTITY column value of the newly inserted row. If this request
is successful, you will have the correct identity value regardless
of concurrent updates. However, AtAtIdentity=1 may not work if the
table containing the IDENTITY column has an insert trigger associated
with it. The insert trigger may perform another database activity
(such as inserting a row in an activity log table) which causes
the @@identity system variable to be reset to zero.
For this reason, you must decide on a case-by-case basis the best
technique for obtaining newly inserted identity values.
Since AtAtIdentity is a dynamic DBParm, it can be set and reset
at any time during an application.
You can set the AtAtIdentity DBParm in the Transaction object of a
PowerBuilder application script by typing the following:
SQLCA.dbParm = "AtAtIdentity = '1'"
The AtAtIdentity DBParm cannot be set via the MSS Database Profile
Setup dialog box.
本文介绍了SQL Server数据库接口新增的DBParm AtAtIdentity参数,用于在DataWindow更新请求中获取新插入行的身份值。该参数提供两种方式获取身份值,一种是默认的SELECT MAX(IDENTCOL)语法,另一种是使用SELECT @@identity。AtAtIdentity=1可以在并发更新时提供更准确的结果,但可能不适用于包含触发器的表。此参数可通过设置SQLCA.dbParm动态调整,但不能在MSS数据库配置对话框中设置。
4630

被折叠的 条评论
为什么被折叠?



