How to fetch the last inserted record in a particular table?

Answer Posted / nitin kaushik

"select @@identity"
@@identity is used to get the current transaction value .

** Note: Over a given connection if any insert statement is
executed on a table with identity column , the back end
sql-server for the connection initializes a parameter by
name "@@Identity" with the value of Identity column for the
last inserted record.

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How would you connect to database using .NET?

568


What are the disadvantages of using datalist?

501


What is dataset and datatable in ado.net?

497


Which object of ado contains datarow datacolumn collection?

510


Explain the DataAdapter.Update() and DataSetAcceptChanges() methods.

520






What are the differences between OLEDB and SQLClient Providers?

558


What are all the different authentication techniques used to connect to MS SQL Server?

536


Define different execute methods of ADO.NET command object ?

545


What is ole db and odbc?

515


What is an ado?

514


Define atomicity?

573


What is the role of the dataset object in ado.net?

569


Can we create Synonymns in MS Acess,My Sql Server,Sql Server? But iam we can create in oracle!

1635


What is basic use of data view?

505


What are the different layers of ado.net?

516