Is there a way to turn off the logging of an inser

  • Im loading some tables in a batch job at night, there are other jobs running that need to be recoverable. I want to turn off the logging only for the few insert statements Im running in this session. I can't do bulk inserts. Any ideas?

    Thanks,

    Brad

  • Hi Brad,

    SQL Server is a little different than Oracle and wasn't sure which 'Bulk Insert' you were referring too...

    You can set the database into a 'BULK' recovery model with:

    ALTER DATABASE <dbName> SET RECOVERY BULK LOGGED.

    As long as your other jobs are not Bulk inserts you will still be able to recover them.

    From Books Online:

    When BULK_LOGGED is specified, logging for all SELECT INTO, CREATE INDEX, and bulk loading data operations is minimal and therefore requires less log space. In exchange for better performance and less log space usage, the risk of exposure to loss is greater than with full recovery. For more information, see Bulk-Logged Recovery.

    You may want to look into the BCP (kind of like a week SQL*Loader) command and DTS packages.


    "Keep Your Stick On the Ice" ..Red Green

  • quote:


    I want to turn off the logging only for the few insert statements Im running in this session.


    In general, You can't even you set recovery mode to bulk logged. But you can consider SELECT INTO /Bulk INSERT which are are minimally logged.

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

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