INSERT INTO table using OpenQuery

  • Hi, I currently use the following to data warehouse a table everday:

    DROP TABLE mytable

    SELECT firstcolumn, secondcolumn INTO mytable

    FROM OPENQUERY (mylinkedserver, 'SELECT firstcolumn, secondcolumn FROM linkedtable')

    I would like to start using TRUNCATE going forward (to perserve system resources and indexes):

    TRUNCATE TABLE mytable

    INSERT INTO mytable (firstcolumn, secondcolumn)

    ?

    How do I use OpenQuery with the INSERT INTO statement?

  • TRUNCATE TABLE mytable

    INSERT INTO mytable (firstcolumn, secondcolumn)

    SELECT firstcolumn, secondcolumn

    FROM OPENQUERY (mylinkedserver, 'SELECT firstcolumn, secondcolumn FROM linkedtable')

    Jared
    CE - Microsoft

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

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