Archive für 1.11.2007

MS SQL-Server: Zuletzt eingefügte ID ’@@Identity’

Im Microsoft-SQL Server verwendet man dazu die globale Variable:  

Zum Beispiel:  

create proc writeIPgetID

 

            @ipAddress varchar(15)

 

as       

 

            INSERT INTO ldIPs (ipAddress) VALUES (@ipAddress)

 

            SELECT @@Identity as ipID

  

 

 

exec writeIPgetID ‘192.168.140.251′ 

 

 

You can use the global Variable ‘@@Identity’ – It will help you to find last insert id.

|