Transferring data into from one table to the next

  • Hi,

    I'm trying to transfer data from table A to table B (cant be a temp table must be an actual table)

    for example

    SELECT L.CURRENTABC

    INSERT INTO [dbo].CustomerABC

    FROM [dbo].LIM_ABC_Table L

    However, i keep getting the following error

    Msg 156, Level 15, State 1, Line 6

    Incorrect syntax near the keyword 'FROM'.

    Can anyone correct the syntax that i'm using

    If you need anyone information please let me know

    Thanks in advance

    ----------------------------Update----------------------------------------

    I've figured out the problem

    INSERT INTO dbo.CustomerABC

    (

    CurrentABC)

    SELECT CurrentABC

    FROM dbo.Lim_ABC_Table

    __________________________________________________________________________________
    Steve J
    Jnr Developer
    BSc(Hon)

  • Reverse the order of "select" and "insert".

    INSERT INTO [dbo].CustomerABC

    SELECT L.CURRENTABC

    FROM [dbo].LIM_ABC_Table L

    I recommend listing the column(s) to insert into instead of just leaving that part blank, but the above should work. Just not "best practices".

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply