Re: Updating Identical tables

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Uri Dimant (urid_at_iscar.co.il)
Date: 12/02/04


Date: Thu, 2 Dec 2004 15:16:29 +0200

Hi
I'm not sure understood you but you can try the following script
What is a condition for INSERT/UPDATE Operations?

IF EXISTS (SELECT * FROM TableA)

UPDATE TableB SET UserId=......

ELSE

INSERT INTO TableB (columns) SELECT columns FROM TableA

"F@yy@Z" <fayyaz.ahmed@mvwebmaker.com> wrote in message
news:uUxCHjG2EHA.3336@TK2MSFTNGP11.phx.gbl...
> Hi All
>
> I have two tables table A and table B, all fields are same in A and B
except
> table B has one extra field User_Id. I need to select fields data from
Table
> A and Update/Insert in Table B with User_Id. What I am doing first reading
> the data from Table A and then inserting/updating in table B .
>
> As I have so many tables to read and Insert/Update which is lengthy
process.
>
> My Question is, is there any other way to do this some sort of mapping
> fields or tables ?
>
>
> Regards
>
>



Relevant Pages

  • Re: Updating Identical tables
    ... What is a condition for INSERT/UPDATE Operations? ... UPDATE TableB SET UserId=...... ... INSERT INTO TableB SELECT columns FROM TableA ... I need to select fields data from ...
    (microsoft.public.sqlserver.server)
  • Re: Calling an SQL function from within an Oracle trigger
    ... Before insert or update on a table tableA, I need to check if the value ... I want to have a trigger before insert or update on tableA which calls ... I use the return value to either allow the insert/update or disallow ... Your best source for information on how to code triggers is probably ...
    (comp.databases.oracle.misc)
  • Calling an SQL function from within an Oracle trigger
    ... Before insert or update on a table tableA, I need to check if the value ... for fieldAtableA which is being inserted or updated in tableA is within ... I want to have a trigger before insert or update on tableA which calls ... I use the return value to either allow the insert/update or disallow ...
    (comp.databases.oracle.misc)