19 lines
526 B
C#
19 lines
526 B
C#
using Microsoft.SqlServer.TransactSql.ScriptDom;
|
|
using SQLLinter.Common;
|
|
|
|
namespace SQLLinter.Infrastructure.Rules;
|
|
|
|
public class HavingWithoutGroupByRule : BaseRuleVisitor
|
|
{
|
|
public override string Text => "HAVING без GROUP BY недопустим: {0}";
|
|
|
|
public override void Visit(QuerySpecification node)
|
|
{
|
|
if (node.HavingClause != null && node.GroupByClause == null)
|
|
{
|
|
AddViolation(node.HavingClause, node.HavingClause.ToString());
|
|
}
|
|
base.Visit(node);
|
|
}
|
|
}
|