RE: Removing rows from very large table with indices

From: Umut Nazlica (anonymous_at_discussions.microsoft.com)
Date: 03/12/04


Date: Fri, 12 Mar 2004 07:31:07 -0800

Hi,

Yes you can put db into single user mode using alter database and termination options like:

ALTER DATABASE XXX
SET SINGLE_USER WITH ROLLBACK AFTER X (See Books Online ..)

and you can schedule a job to automate it.

My suggestion is first script your table then create your new table using this script (at this point do not create the indexes on new table), transfer data, create indexes on new table and so on.

But test first to see if it works the way you want..

Regards..



Relevant Pages

  • Re: Moving DB from one drive to another
    ... In the copy of Books Online I have it suggests ALTER DATABASE SET OFFLINE. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ...
    (comp.databases.ms-sqlserver)
  • Re: MSDE data files
    ... You can modify file sizes using alter database. ... For compacting, check books online for dbcc shrinkfile. ... If the log files are what's causing problems, ...
    (microsoft.public.sqlserver.programming)
  • Re: Logical File Names
    ... Look at ALTER DATABASE in Books Online. ... Aaron Bertrand ... SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: Hanging during READ_COMMITTED_SNAPSHOT ON
    ... I realize that all connections expect the query window need to be ... ALTER DATABASE db SET SINGLE_USER WITH ROLLBACK IMMEDIATE ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)