Re: Copy records from one table to another

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

From: Tom Moreau (tom_at_dont.spam.me.cips.ca)
Date: 04/29/04


Date: Thu, 29 Apr 2004 08:30:53 -0400

Try:

insert TableB
select
    *
from
    TableA
where
    ...

-- 
Tom
---------------------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Ed" <xx@xx.com> wrote in message
news:uxO0TPeLEHA.3292@TK2MSFTNGP11.phx.gbl...
I have two identical tables (TableA has data, TableB is empty)
Using SQL, I want to select a range of records from TableA and insert them
into TableB.
Can someone help.
Thanks
Ed


Relevant Pages

  • Re: Problem with a join due to multiple Nulls
    ... Using TableA and TableB below i will demonstrate the problem. ... Please post DDL rather than sketches of tables otherwise ... State what version of SQL Server you are using and specify the content ...
    (comp.databases.ms-sqlserver)
  • Re: Require Solution for this SQL problem
    ... runs every morning and based on some logic dumps rows from TableA to ... Now when I run stored proc I want rows copied as below ... FROM TableB (UPDLOCK) ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ...
    (comp.databases.ms-sqlserver)
  • Re: Problem with a join due to multiple Nulls
    ... multiple NULLS which I do not want to ignore and I fear they will cause ... Using TableA and TableB below i will demonstrate the problem. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ...
    (comp.databases.ms-sqlserver)
  • Re: SQL help
    ... SQL Server 2005/2008 then EXCEPT: ... SELECT column FROM TableA ... SELECT column FROM TableB; ... Plamen Ratchev ...
    (microsoft.public.sqlserver.programming)
  • Re: Sql Query problem
    ... SQL Server MVP ... Columnist, SQL Server Professional ... TableA a where exists (select from TableB b join (select ... I would like to select only the records in tableA where the first record in TableB have an amount>= 100. ...
    (microsoft.public.sqlserver.server)