Senin, 16 Agustus 2010

Different ways to get Identity of New Inserted Rows in SQL Server

There are different methods to know the Identity Value of a newly added row.Let us consider the following example:--Create a TableCREATE TABLE test(id int identity(1,1),names varchar(100) )--Insert DataINSERT INTO test(names) SELECT 'testing'--Get Identity Value that is Populated in the Current ScopeSELECT scope_identity()--Get Identity value that is Populated in the Current Session SELECT @@

Tidak ada komentar:

Posting Komentar