Is there a tool out there that can analyse SQL Server databases for potential problems?
For example:
- a foreign key column that is not indexed
- an index on a
uniqueidentifier
column that has noFILL FACTOR
- a
LastModifiedDate DATETIME
column that has noUPDATE
trigger to update the datetime - a large index with "high" fragmentation
- a non-fragmented index that exists in multiple extents
- a trigger that does not contain
SET NOCOUNT ON
(leaving it suspectible to "A trigger returned a resultset and/or was running with SET NOCOUNT OFF while another outstanding result set was active.") - a database, table, stored procedure, trigger, view, created with
SET ANSI_NULLS OFF
- a database or table with
SET ANSI_PADDING OFF
- a database or table created with
SET CONCAT_NULL_YIELDS_NULL OFF
- a highly fragmented index that might benefit from a lower
FILLFACTOR
(i.e. more padding) - a table with a very wide clustered index (e.g. uniqueidentifier+uniqueidentifier)
- a table with a non-unique clustered index
- use of
text/ntext
rather thanvarchar(max)/nvarchar(max)
- use of
varchar
in columns that could likely contain localized strings and should benvarchar
(e.g. Name, FirstName, LastName, BusinessName, CountryName, City) - use of
*=
,=*
,*=*
rather thanLEFT OUTER JOIN
,RIGHT OUTER JOIN
,FULL OUTER JOIN
- trigger that returns a results set
- any column declared as
timestamp
rather thanrowversion
- a nullable
timestamp
column - use of
image
rather thanvarbinary(max)
- databases not in simple mode (or a log file more than 100x the size of the data file)
Is there an FxCop for SQL Server?
Note: The Microsoft SQL Server 2008 R2 Best Practices Analyzer doesn't fit the bill.