看看下面这段话也许对你有用==============================================
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.
The first time you insert a row into the table, an IDENTITY column has a value of 1 assigned to it. On each subsequent insert, the value of the column increases by one. The value most recently inserted into an identity column is available in the @@identity global variable.