SELECT INTO question

  • Hi,

    we need to fill a large table if possible without logging.

    I was thinking of using SELECT INTO instead of inserts.

    (We do have a staging area from where we fill using SQL)

    But: some fields are filled in a later process.

    What is the best way to add empty fields of a certain data type for the table to be created with SELECT INTO ?

    Thank you very much !

  • Something like this should work. Haven't tested.

    SELECT col1, col2, CAST(NULL AS int) as AddedCol1, CAST(NULL as varchar(100) as AddedCol2, col3, col4 INTO SomeOtherTable

    FROM SourceTable

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thank you,

    worked just as we needed 🙂

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

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