Save output table in sql server

  • How can I save the output table from the join code below in sql server.

    select * from [Products]  join  [Sales] on [Sales].Item_name = [Products].Item_name

    NB: Usually, I would go join the table in SSIS and load into sql server but I want to a faster one.

  • You have to create a table to store it in

    CREATE TABLE foo (col1, col2, etc)

    Then insert the results into it

    INSERT INTO foo (col1, col2, etc)
    SELECT col1, col2, etc
    FROM [Products] AS p
    INNER join [Sales] AS s ON s.Item_name = p.Item_name

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

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