SRD0001 |
Missing natural key |
|
Table does not have a natural key. |
|
SRD0002 |
Missing primary key |
|
Table does not have a primary key. |
|
SRD0003 |
Avoid wide primary keys |
|
Primary Keys should avoid using GUIDS or wide VARCHAR columns. |
|
SRD0004 |
Index on Foreign Key |
|
Columns on both sides of a foreign key should be indexed. |
|
SRD0005 |
Avoid long CHAR types |
Yes |
Avoid the (n)char column type except for short static length data. |
|
SRD0006 |
Avoid SELECT * |
Yes |
Avoid using SELECT *. |
|
SRD0009 |
Non-transactional body |
|
Wrap multiple action statements within a transaction. |
|
SRD0010 |
Low identity seed value |
|
Start identity column used in a primary key with a seed of 1000 or higher. |
|
SRD0011 |
Equality Compare With NULL Rule |
|
Equality and inequality comparisons involving a NULL constant found. Use IS NULL or IS NOT NULL. |
|
SRD0012 |
Unused variable |
|
Variable declared but never referenced or assigned. |
|
SRD0013 |
Expected error handeling |
|
Wrap multiple action statements within a try catch. |
|
SRD0014 |
TOP without an ORDER BY |
|
TOP clause used in a query without an ORDER BY clause. |
|
SRD0015 |
Implicit column list |
|
Always use a column list in INSERT statements. |
|
SRD0016 |
Unused input parameter |
Yes |
Input parameter never used. Consider removing the parameter or using it. |
|
SRD0017 |
Avoid Deletes Without Where Rule |
Yes |
DELETE statement without row limiting conditions. |
|
SRD0018 |
Unbounded UPDATE |
Yes |
UPDATE statement without row limiting conditions. |
|
SRD0019 |
Avoid joining tables with views |
Yes |
Avoid joining tables with views. |
|
SRD0020 |
Incomplete or missing JOIN predicate |
|
The query has issues with the join clause. It is either missing a backing foreign key or the join is missing one or more columns. |
|
SRD0021 |
Consider EXISTS Instead Of In Rule |
Yes |
Consider using EXISTS instead of IN when used with a subquery. |
|
SRD0024 |
Avoid EXEC or EXECUTE |
Yes |
Avoid EXEC and EXECUTE with string literals. Use parameterized sp_executesql instead. |
|
SRD0025 |
Avoid ORDER BY with numbers |
Yes |
Avoid using column numbers in ORDER BY clause. |
|
SRD0026 |
Unspecified type length |
|
Do not use these data types (VARCHAR, NVARCHAR, CHAR, NCHAR) without specifying length. |
|
SRD0027 |
Unspecified precision or scale |
|
Do not use DECIMAL or NUMERIC data types without specifying precision and scale. |
|
SRD0028 |
Consider Column Prefix Rule |
Yes |
Consider prefixing column names with table name or table alias. |
|
SRD0030 |
Avoid Use of HINTS |
Yes |
Avoid using Hints to force a particular behavior. |
|
SRD0031 |
Avoid using CHARINDEX |
Yes |
Avoid using CHARINDEX function in WHERE clauses. |
|
SRD0032 |
Avoid use of OR in where clause |
Yes |
Try to avoid the OR operator in query where clauses if possible. (Sargable) |
|
SRD0033 |
Avoid Cursors |
Yes |
Avoid using cursors. |
|
SRD0034 |
Use of NOLOCK |
|
Do not use the NOLOCK clause. |
|
SRD0035 |
Forced delay |
|
Do not use WAITFOR DELAY/TIME statement in stored procedures, functions, and triggers. |
|
SRD0036 |
Do not use SET ROWCOUNT |
Yes |
Do not use SET ROWCOUNT to restrict the number of rows. |
|
SRD0038 |
Alias Tables Rule |
Yes |
Consider aliasing all table sources in the query. |
|
SRD0039 |
Object not schema qualified |
|
Use fully qualified object names in SELECT, UPDATE, DELETE, MERGE and EXECUTE statements. [schema].[name]. |
|
SRD0041 |
Avoid SELECT INTO temp or table variables |
Yes |
Avoid use of the SELECT INTO syntax. |
|
SRD0043 |
Possible side-effects implicit cast |
|
The arguments of the function '{0}' are not of the same datatype. |
|
SRD0044 |
Error handling requires SA permissions |
|
The RAISERROR statement with severity above 18 requires the WITH LOG clause. |
|
SRD0045 |
Excessive indexes on table |
|
Excessive number of indexes on table found on table. |
|
SRD0046 |
Use of approximate data type |
|
Do not use the real or float data types for parameters or columns as they are approximate value data types. |
|
SRD0047 |
Ambiguous column name across design |
Yes |
Avoid using columns that match other columns by name, but are different in type or size. |
|
SRD0050 |
Expression reducible to constaint |
Yes |
The comparison expression always evaluates to TRUE or FALSE. |
Yes |
SRD0051 |
Do Not Use Deprecated Types Rule |
|
Don?t use deprecated TEXT, NTEXT and IMAGE data types. |
|
SRD0052 |
Duplicate/Overlapping Index |
|
Index has exact duplicate or borderline overlapping index. |
|
SRD0053 |
Explicit collation other |
Yes |
Object has different collation than the rest of the database. Try to avoid using a different collation unless by design. |
|
SRD0055 |
Object level option override |
|
The object was created with invalid options. |
|
SRD0056 |
Unsafe identity retrieval |
Yes |
Use OUTPUT or SCOPE_IDENTITY() instead of @@IDENTITY. |
|
SRD0057 |
Do Not Mix DML With DDL Rule |
|
Do not mix DML with DDL statements. Group DDL statements at the beginning of procedures followed by DML statements. |
|
SRD0058 |
Ordinal parameters used |
|
Always use parameter names when calling stored procedures. |
|
SRD0060 |
Permission change in stored procedure |
|
The procedure grants itself permissions. Possible missing GO command. |
Yes |
SRD0061 |
Invalid database configured options |
|
The database is configured with invalid options. |
|
SRD0062 |
Implicit collation |
|
Create SQL Server temporary tables with the correct collation or use database default as the tempdb having a different collation than the database can cause issues and or data instability. |
|
SRD0063 |
Avoid wrapping SQL in IF statement |
Yes |
Do not use IF statements containing queries in stored procedures. |
|
SRD0064 |
Consider Caching Get Date To Variable |
Yes |
Cache multiple calls to GETDATE or SYSDATETIME into a variable. |
|
SRD0065 |
Avoid NOT FOR REPLICATION |
|
Avoid 'NOT FOR REPLICATION' unless this is the desired behavior and replication is in use. |
|