temp tables

  • Is it possible to preserve rows on commit for temporary tables in MSSQL? What is the default manner of commit (for temp tables)?

    Thanks

    Viv

  • Sorry, don't understand what you're asking. Transaction behaviour for Temp tables is pretty much the same as for normal tables.

    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
  • Not really sure what you are asking here. Could you provide more information about what you are trying to accomplish?

  • What I want to accomplish is following:

    For example in Oracle when we create temporary tables we have an option like this:

    CREATE GLOBAL TEMPORARY TABLE

    ...............

    ON COMMIT DELETE ROWS

    OR

    ON COMMIT PRESERVE ROWS

    So that when a commit is issued in the database the rows of the temp table will be deleted or preserved.

    I want to ask whether it is possible to preserve rows in MSSQL.

    What is the default ?

    Thanks

  • If you insert rows into a temp table in SQL and commit the transaction, the rows will be in the temp table until they are deleted or the temp table is dropped.

    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

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

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