SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Training
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


Article Topics

All Articles
Performance Tuning
Audit
Business Intelligence
Clustering
Reporting Services
SQL Azure
Developer
General DBA
ASP.NET / ADO.NET
SQL Azure

USEFUL SITES :

ASP.NET Tutorials
Windows and SQL Azure Tutorials
Cloud Hosting Magazine
SharePoint Tutorials
Windows Server Help

Write for Us

Share your SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

A High Level Comparison Between Oracle and SQL Server - Part ...
A High Level Comparison Between Oracle and SQL Server - Part ...
A High Level Comparison Between Oracle and SQL Server - Part ...
A High Level Comparison Between Oracle and SQL Server

More     
 
Latest FAQ's

Add Node to A SQL Server failover Cluster failed with invalid ...
SQL Server Destination remote server error
Setting Up Data And Log Files For SQL Server
Will Check Constraints Improve Database Performance?

More     
   
Latest Software Reviews

dbForge Review
Spotlight on ApexSQL Diff - Server-based database comparison tool ...
Spotlight on ApexSQL Data Diff - Server-based database comparison tool ...
Spotlight on ApexSQL Doc 2008

More     

articles >> performance tuning >> How to Identify Non-Active SQL Server Indexes ...

How to Identify Non-Active SQL Server Indexes

By : Luis Martin
Apr 06, 2005

Page 2 / 4

Load of the Report to a SQL Table

In any database of your choosing, create the following table:

CREATE TABLE [ dbo].[Analysis ] (

[ Table ] [ to varchar ] (50) COLLATE SQL_Latin1_General_CP1_CI_AI NOT NULL,

[ Indice ] [ to varchar ] (100) COLLATE SQL_Latin1_General_CP1_CI_AI NOT NULL,

[ Uso ] [ to varchar ] (50) COLLATE SQL_Latin1_General_CP1_CI_AI NOT NULL,

[ Peso ] [ int ] NOT NULL,

[ Base ] [ to varchar ] (15) COLLATE SQL_Latin1_General_CP1_CI_AI NULL,

[ Date ] [ datetime ] NOT NULL

) ON [ PRIMARY ]

Once the table has been created, you can use DTS Import to load the text file into the SQL Table. When importing the text file, choose the TAB as the column delimiter, and the table Analysis as the destination.

Once the text file is imported, you can use the following stored procedure to list the non-active indexes.

CREATE PROCEDURE Indices_Inactivos AS

declare

it @Base varchar(15),

@Tabla varchar(50),

@Indice varchar(100),

@BaseAnt varchar(15),

@TablaAnt varchar(50)

IndicesInactivos declares for cursor

select Base, Table, Indice

from Analysis

where Indice like ' [ [ ]IX% '

group by Base, Table, Indice

having sum(convert(money, replace(Uso,',','.'))) = 0

they open IndicesInactivos

fetch next from IndicesInactivos into @Base, @Tabla, @Indice

while (@@FETCH_STATUS < > -1)

begin

if @Base < > @BaseAnt

begin

Print ' BASES: ' + @Base

select @BaseAnt = @Base

select @TablaAnt = ''

end

if @Tabla < > @TablaAnt

begin

Print ' TABLE: ' + @Tabla

Print ' INDICES: '

select @TablaAnt = @Tabla

end

Print ' ' + @Indice

fetch next from IndicesInactivos into @Base, @Tabla, @Indice

continue

end

close IndicesInactivos

deallocate IndicesInactivos

GO


<< Prev Page     Next Page>>    








C# Help and Tutorials | PHP MySQL Tutorial | Sharepoint Tutorial | Azure Tutorial | Cloud Hosting Magazine | ASP.NET Tutorials | Windows Server Help | Windows Phone Pro | Silverlight Ace | Visual Studio Tutorials | Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | SQL Server Training Videos | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 2010 Jude O'Kelly. All rights reserved