[dba-SQLServer] Cancel INSERT?

Francisco Tapia fhtapia at gmail.com
Mon Mar 6 12:42:28 CST 2006


@@ Identity may problematic as this variable will contain the last insert
from anybody, using Scope_Identity() may be a better solution as it gives
you the last id used in your session.  If however the insert has ran and now
you want to lookup what you did because you need to roll it back you can do
it manually with software from quest software or idera



On 3/4/06, Stuart McLachlan <stuart at lexacorp.com.pg> wrote:
>
> On 4 Mar 2006 at 14:57, Susan Harkins wrote:
>
> > I know I can wrap INSERT in a transaction. Barring a transaction that
> keeps
> > the action from being committed, is there anyway to undo an INSERT
> action
> > that's been committed?
> >
>
> Assuming you have an Identity field, want to undo the INSERT immediately
> after it is committed, how about "Delete from myTable where Key = " &
> @@IDENTITY --
> Stuart
>
>
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
>
>


--
-Francisco
http://pcthis.blogspot.com |PC news with out the jargon!
http://sqlthis.blogspot.com | Tsql and More...



More information about the dba-SQLServer mailing list