Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Partition index Expand / Collapse
Author
Message
Posted Wednesday, May 6, 2009 7:07 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Today @ 8:10 AM
Points: 39, Visits: 528
Hi All,

Can anyone help on getting a scripts to rebuild index for all db's except the Partitioned table indexes.

Thanks in Advance,
Gagan
Post #711029
Posted Wednesday, May 6, 2009 8:27 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, June 18, 2014 10:33 AM
Points: 344, Visits: 1,543
Hi,

Take a look at the following article, it contains a reference to one of the best index rebuild scripts there is. When the stored procedure encounters a partitioned index, it performs a specific action.

Index Optimisation Script Link

See procedure snippet below that identifies the partitioned indexes.

 /* Determine if the index is partitioned */
SELECT @partitionSQL = 'Select @partitionCount_OUT = Count(*)
From ' + @databaseName + '.sys.partitions
Where object_id = ' + CAST(@objectID AS VARCHAR(10)) + '
And index_id = ' + CAST(@indexID AS VARCHAR(10)) + ';'
, @partitionSQL_Param = '@partitionCount_OUT int OutPut';

I'm certain you could easily modify the stored procedure and/or code to suit your needs.

Cheers,



John Sansom (@sqlBrit) | www.johnsansom.com
Post #711130
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse