SqlServer.Rules 5.0.0 is out 🎉
SqlServer.Rules v5.0.0 is now available
SqlServer.Rules is an open-source static code analysis library and toolset for SQL Server database projects, command line, and Visual Studio, that helps teams catch design flaws, naming inconsistencies, performance anti-patterns, and risky T-SQL constructs early — during development and build time instead of in production.
The value is straightforward: it shifts SQL quality checks left, gives fast and repeatable feedback in CI/CD and local workflows, and helps improve reliability, maintainability, and performance of database code with clear, actionable rule-based guidance.
This major release expands rule coverage significantly and continues consolidation around the SqlServer.Rules codebase and tooling.
Highlights
- Large set of new and migrated design and performance rules
- New SQL project/database option checks
- Completed migration from legacy TSQLSmells packaging
- Tooling and repository improvements
New and Ported Rules (with docs links)
Design rules
SRD0078Single-character aliases are poor practiceSRD0079Single-character variables are poor practiceSRD0080TOP expression should use parenthesesSRD0081TOP(100) PERCENTis ignored by optimizerSRD0082Avoid changingDATEFORMATSRD0083Avoid changingDATEFIRSTSRD0084CONCAT_NULL_YIELDS_NULLmust beONSRD0085ANSI_NULLSshould beONSRD0086ANSI_PADDINGshould beONSRD0087ANSI_WARNINGSshould beONSRD0088NUMERIC_ROUNDABORTshould beOFFSRD0089QUOTED_IDENTIFIERshould beONSRD0090SET FORCEPLANshould beOFFSRD0091AvoidORDER BYin derived tables for final orderingSRD0092Avoid named primary key constraints on temp tablesSRD0093Do not name default constraints on temporary tablesSRD0094Avoid named foreign keys on temporary tablesSRD0095Named check constraints on temp tablesSRD0096Potential SQL injection issue
Performance rules
SRP0026Avoid cross-server joinsSRP0027Avoid explicit conversion of columnar dataSRP0028ExplicitRANGEwindow frameSRP0029ImplicitRANGEwindow frameSRP0030SpecifyFAST_FORWARDfor cursors
SQL project/database option rules
SRD0700DatabasePAGE_VERIFYoption is notCHECKSUMSRD0701DatabaseQUERY_STOREoption is notREAD_WRITESRD0703DatabaseQUERY_STORE_CAPTURE_MODEoption is notAUTOSRD0704DatabaseTARGET_RECOVERY_TIMEoption is not setSRD0705DatabaseAUTO_CLOSEoption is notOFFSRD0706DatabaseAUTO_SHRINKoption isON
Tooling and cleanup
- Documentation generation moved to a separate tool
- Solution updates (including
.slnx) - Legacy TSQLSmells package/sign/test removal
Upgrade
<PackageReference Include="ErikEJ.DacFX.SqlServer.Rules" Version="5.0.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Full changelog
Thanks to all contributors and everyone using and testing SqlServer.Rules.