| Author: Christopher 02 Nov 2009 | Member Level: Gold | Rating:  Points: 2 |
Use
@@identiy or Scope_identity
|
| Author: karunajo 02 Nov 2009 | Member Level: Silver | Rating:  Points: 2 |
Can u give me the query
|
| Author: Dharmaraj 02 Nov 2009 | Member Level: Diamond | Rating:  Points: 2 |
Hi, You can use RETURN @@IDENTITY which will return the idvalue of the last affected row.
Regards, Dharma Editor,Mentor,MVM Try and fail but don't fail and try Me and DNS
|
| Author: Anil Kumar Pandey 02 Nov 2009 | Member Level: Diamond | Rating:  Points: 2 |
hi,
where do you want to access this.. either you can use the @@IDENTITY in the SP to return the last inserted row or use a update time column to get the recent updated row..
Thanks & Regards Anil Kumar Pandey
|
| Author: satya 02 Nov 2009 | Member Level: Diamond | Rating:  Points: 2 |
You can use IDENT_CURRENT
SELECT IDENT_CURRENT('tablename')
|
| Author: Melchior 02 Nov 2009 | Member Level: Gold | Rating:  Points: 2 |
To find the unique id of the affected record, you can use the following query
INSERT INTO TABLE1 VALUES(F1,F2...) SET @intLastAffectedID = @@IDENTITY
To get the number of rows affected, you can use this statement
INSERT INTO TABLE1 VALUES(F1,F2...) SELECT @intLastAffectedID = @@IDENTITY,@intAffectedRows = @@ROWCOUNT
|