Re: update statement

From: Vishal Parkar (REMOVE_THIS_vgparkar_at_yahoo.co.in)
Date: 03/18/04


Date: Fri, 19 Mar 2004 01:52:38 +0530

Try:

--replace #t with the tablename you have

begin transaction
update #t
set unitnumber
=(select result from #t a
  where a.name = #t.name and primarykey =
  (select max(primarykey) from #t where #t.name = a.name and testcode = '%UN') )
where testcode ='TOOL'

--check the data and commit/rollback accordingly.

-- 
Vishal Parkar
vgparkar@yahoo.co.in


Relevant Pages

  • Re: update statement
    ... PrimaryKey Name TestCode Result UnitNumber ... >begin transaction ... >Vishal Parkar ...
    (microsoft.public.sqlserver.programming)
  • Re: update statement
    ... PrimaryKey Name TestCode Result UnitNumber ... >begin transaction ... >Vishal Parkar ...
    (microsoft.public.sqlserver.programming)
  • Re: Error-handling Question
    ... > SELECT and fetches you really don't care about transaction ... commit/rollback or somehow end the transaction at some point. ... a long running process that has autocommit turned off & only does selects ...
    (perl.dbi.users)
  • Re: Hot and Cold backups
    ... >>> impression that shutdown immediate was safe, ... >> transaction. ... > 3 - Oracle halts processing of the DML statement and rolls back the ... the application decides when to commit/rollback. ...
    (comp.databases.oracle.server)
  • transactions and stored procedures
    ... execute sp_update_table_001 ... If the connection dies before the commit, will SQL server rollback the ... transaction automatically? ...
    (microsoft.public.sqlserver.programming)