Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 last inserted data

Author  Topic 

avijit_mca
Posting Yak Master

109 Posts

Posted - 2010-03-08 : 10:51:17
how i will find out my last insewrted or updated data from database with out trigger?

Regards,
avijit

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-08 : 10:53:08
do you have audit column in your table like created date or modified date?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

avijit_mca
Posting Yak Master

109 Posts

Posted - 2010-03-08 : 10:56:15
no.

Regards,
avijit
Go to Top of Page

avijit_mca
Posting Yak Master

109 Posts

Posted - 2010-03-08 : 10:57:39
let say eg.
user 1 inserting data.user2 inserting data.
user1 session he wants 2 know his last inserted dat.how??

Regards,
avijit
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-08 : 11:15:41
Ok if its inserting, then he can see his last inserted record by taking value of SCOPE_IDENTITY and then returning record with the obtained ID value. Obviously for that you need an identity column to be available in your table.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

avijit_mca
Posting Yak Master

109 Posts

Posted - 2010-03-09 : 02:13:25
thanks for your reply.its really good. but what about non identity column table?

Regards,
avijit
Go to Top of Page
   

- Advertisement -