DF075: GO batch separator is possibly missing.

The topic describes the DF075 T-SQL code analysis rule.

Category

EXECUTION RULES

Message

GO batch separator is possibly missing.

Description

The procedure grants itself permissions at the end of its body. This may indicate that the GO command is missing.

Additional information

In SQL Server, batches of SQL statements are typically separated by the GO batch separator. Each batch is compiled and executed separately. If the GO separator is missing, multiple statements may be combined into a single batch, leading to unexpected behavior or errors.

Noncompliant code example

CREATE PROCEDURE dbo.DemoProc
AS
  SELECT
    *
  FROM dbo.Customer;

  GRANT EXECUTE ON dbo.DemoProc TO PUBLIC
GO

Compliant solution

CREATE PROCEDURE dbo.DemoProc
AS
  SELECT
    *
  FROM dbo.Customer;
GO
GRANT EXECUTE ON dbo.DemoProc TO PUBLIC
GO