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 SessionSELECT @@identity--Get Identity value that is Populated in the Table--Regardless of Scope and SessionSELECT ident_current('test')Note that first two methods won’t give correct values if data are added to the ‘different tables’.
For resolving damaged sql databases use sql server data recovery. It is able to work out like errors and show the results of working as a list or else. The program launches under low system requirements.
ReplyDelete