Home All Groups Group Topic Archive Search About

To retrieve the last updated row

Author
8 Sep 2005 11:39 AM
sajeeth raja
while using the inserted and deleted in a query its showing that invalid
object name. Could upls suggest me what should i do to get the last
updated row in a table.

*** Sent via Developersdex http://www.developersdex.com ***

Author
8 Sep 2005 11:46 AM
Jens
The inserted and deleted can only be retrived in the context of a
trigger. To get the last inserted or updated row you have to implement
your own mechanism which stores the date(time) when the row was last
updated. With a trigger you can keep this column / value up-tp-date if
anybody changes / updates the table. There is a no built-in mechanism
for this.

HTH, Jens Suessmeyer.

---
http://www.sqlserver2005.de
---
Author
8 Sep 2005 12:43 PM
Hari Prasad
Hi,

INSERTED and UPDATED records can be used only inside the Triggers. To get to
last updated record inside a store procedure you
have to use some datetime column which is available inside the table. Make
sure on each update you update this modifiedon column.

Thanks
Hari
SQL Server MVP


Show quote
"sajeeth raja" <sajeethr***@gmail.com> wrote in message
news:%23NSFDoGtFHA.3548@TK2MSFTNGP11.phx.gbl...
>
>
> while using the inserted and deleted in a query its showing that invalid
> object name. Could upls suggest me what should i do to get the last
> updated row in a table.
>
> *** Sent via Developersdex http://www.developersdex.com ***

AddThis Social Bookmark Button