how to Truncate the records from table

Answered how to Truncate the records from table

  • Wednesday, May 16, 2012 7:15 AM
     
     

    Hi,

        how to truncate some records from table.because if i delete the records from table then the Database size increases.

        so please suggest me how to delete some records(not all in table) with out storing in log.

       Ex: we are having 10000 record in Emp table. in that i want to delete 5000 recors(daily). so by using the delete statement the Database size increases.so how i delete those 5000 records with out Database size increases.

    Thanks in Advance.

All Replies

  • Wednesday, May 16, 2012 7:39 AM
     
     Answered

    Hi,

    You can't truncate with a WHERE clause, I'm afraid.

    To reduce the impact on the log, you could delete in smaller batches.  Having said that, I would expect deleting 5000 records to have a very light touch on the log anyway.



    Thanks,

    Andrew Bainbridge
    SQL Server DBA

    Please click "Propose As Answer" if a post solves your problem, or "Vote As Helpful" if a post has been useful to you