Re: How to update a table using Join with other table

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


Date: Mon, 22 Mar 2004 21:39:39 +0530

try:

begin transaction
UPDATE a SET PHONENUM = STUFF(A.PHONENUM, 1, 3, B.NEW_NPA)
from company A INNER JOIN phonelist B
 ON SUBSTRING(A.PHONENUM,1,3) = B.OLD_NPA
 AND SUBSTRING(A.PHONENUM,4,3) = B.PREFIX

--check the data and commit/rollback accordingly

-- 
Vishal Parkar
vgparkar@yahoo.co.in


Relevant Pages

  • Re: How to loop without using cursor
    ... begin transaction ... --check the data and commit/rollback accordingly ... 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)
  • Re: update statement
    ... begin transaction ... where testcode ='TOOL' ... --check the data and commit/rollback accordingly. ...
    (microsoft.public.sqlserver.programming)