@@IDENTITY in SQL server
If I execute the following SQL statement through ASP (as one string
sent through to the Execute statement of a connection object), am I
guaranteed to get the identity column of the record that was just
inserted, or could two users get the same ID if they are both executing
the statement at the same time?
SET NOCOUNT ON
INSERT INTO [X] (Y) VALUES ('z')
SELECT @@IDENTITY AS NewID
SET NOCOUNT OFF
.
Relevant Pages
- Re: Two Way Bidirectional Rep
... > You mean to tell me that the following script will actually execute? ... > tbl_IssueTracker_IssueCategories has an identity column in it. ... >> Hilary Cotter ... >> Looking for a SQL Server replication book? ... (microsoft.public.sqlserver.replication) - Re: Two Way Bidirectional Rep
... You mean to tell me that the following script will actually execute? ... tbl_IssueTracker_IssueCategories has an identity column in it. ... > Looking for a SQL Server replication book? ... (microsoft.public.sqlserver.replication) - Re: SCOPE_IDENTITY() returns NULL
... My program uses Delphi ADO VCL components: ... I traced with SQL Profiler and it seems that between above ... Execute() and Openthere many internal commands are ... >> insert statements into an identity column occur in the scope. ... (microsoft.public.sqlserver.programming) - RE: ODBC TIMEOUT ON UPDATE
... >This behavior occurs when Microsoft SQL Server does not ... > RECONFIGURE WITH OVERRIDE ... > SET NOCOUNT ON ... >In Microsoft SQL Server Query Analyzer, execute the ... (microsoft.public.access.setupconfig) - Re: Question about efficiency
... If your sp is good enough to handle multiple customers in single call of sp ... you can execute now your sp with executenonquery method of command object. ... that command object should have connection object where you created your ... > repeatedly execute an SQL string or repeatedly call a storedprocedure, ... (microsoft.public.dotnet.framework.adonet) |
|