Since it is not possible to script only the primary keys of all tables with the SQL Server 2005 Management Studio, here a small script to get the create scripts for all existing primary keys of the current database.
2007-03-28 (first published: 2007-03-09)
4,249 reads
When AUTOSTATS is used in a database, we can sometimes use these automatically generated statistics to find columns where SQL Server has built statistics on non-indexed columns that may benefit from an index. This script finds these columns and displays the selectivity of them. This script can be useful in troubleshooting poorly performing databases by […]
2007-04-09 (first published: 2007-02-20)
1,743 reads
Most DBAs are constantly looking for ways to tune their servers to run better. Joe Doherty brings us the second part of his series on indexes with an in depth look at how the indexes are stored in your database.
2007-12-13 (first published: 2006-12-20)
14,352 reads
This script will drop and recreated all indexes in a database within a transaction. The script will also add standard nameing conventions to the index names. Any duplicated indexes are removed.
2007-07-20 (first published: 2006-10-24)
1,364 reads
Most of the time even after executing dbcc dbreindex script on database you won't see much improvement in application/DB performance. Thats because dbreindex creates statistics for all tables but it executes sp_updatestats which is like sample statistics. To get the maximum performance we had to execute Update statistics with fullscan on table. This simple will […]
2006-12-22 (first published: 2006-10-23)
20,449 reads
The below command will rebuild all indexes on a database.We need to run the below command in the context of each database that is of interest.
2007-02-21 (first published: 2006-10-23)
1,217 reads
the following scripts helps in finding top 5 missing indexes using the new feature of DMV available in SQl Server 2005
2007-07-19 (first published: 2006-10-23)
5,361 reads
In real world production tuning sometimes a "quick fix" is required. This script will generate index create scripts for any column ending ID which doesn't have an index. It's dirty and its quick but you might just be amazed by the results when run against your database!
2007-07-11 (first published: 2006-10-10)
492 reads
This script lists all the foreign keys ,the referenced and the referencing tables , along with the column information.
2007-07-09 (first published: 2006-10-04)
312 reads
This script combines functionality of sp_helpindex and sp_spaceused to list all tables with individual indexes, their keys and description (sp_spaceused cannot do that) and size in MB per individual index (sp_helpindex cannot do that either). Feel free to use and modify as you see fit. Hope it can help.
2007-07-03 (first published: 2006-09-25)
2,648 reads