How to fix Error 9232 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 9232 occurs when SQL Server’s parser encounters an invalid notification options string, typically used in Query Notifications (SqlDependency), Service Broker CREATE EVENT NOTIFICATION statements, or Database Mail profile strings. The options identifier expects a strict key=value;key=value format, and this error fires when a value contains trailing garbage, a missing semicolon, or an unescaped special character between key-value pairs. This is almost always caused by a malformed connection string or notification string generated by application code (ADO.NET SqlDependency, ODBC drivers, or custom T-SQL scripts) rather than by SQL Server itself being corrupted.

Step-by-Step Resolution Guide

Step 1: Identify the Source of the Malformed String

  • Check SQL Server error logs at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG for the exact string reported in the %.*ls placeholder.
  • If using .NET, enable verbose exception logging in your application to capture the full SqlDependency or SqlNotificationRequest options string before it is sent to the server.
  • Confirm whether the error originates from SUBSCRIBE QUERY NOTIFICATION, CREATE EVENT NOTIFICATION, or a Database Mail profile call.

Step 2: Correct the Notification Options Syntax

  • Ensure the options string strictly follows the pattern: service=ServiceName;local database=DatabaseName.
  • Remove any trailing semicolons, double semicolons (;;), or stray whitespace after the last key-value pair.
  • In C#, verify the SqlNotificationRequest.Options property is built using a safe string builder rather than manual string concatenation:
  request.Options = "service=MyNotifyService;local database=MyAppDB";

Step 3: Validate the Query Notification Infrastructure

  • Open SQL Server Management Studio (SSMS) and confirm Service Broker is enabled on the target database:
  ALTER DATABASE MyAppDB SET ENABLE_BROKER;
  • Verify the notification service and queue exist and are not corrupted:
  SELECT * FROM sys.services;
  SELECT * FROM sys.service_queues;
  • Recreate the service and queue if they appear misconfigured or orphaned from a previous app deployment.

Step 4: Update Application Configuration and Restart Services

  • Edit the application’s app.config or web.config file to correct the connection string or notification options value.
  • Restart the application pool (IIS) or Windows Service hosting the application on Windows Server 2025.
  • Restart the SQL Server Agent service via services.msc or net stop SQLSERVERAGENT && net start SQLSERVERAGENT to clear any cached malformed job notification settings.

Step 5: Rebuild Corrupted Alert or Mail Profiles (If Applicable)

  • If the error ties to SQL Server Agent alerts, open SSMS, navigate to SQL Server Agent > Alerts, and recreate the affected alert’s notification message manually instead of relying on a scripted insert.
  • For Database Mail, re-run sp_send_dbmail with a clean, manually typed profile name to rule out string corruption from copy-paste characters (e.g., smart quotes).

Alternative or Verification Steps

  • Re-run the exact query or application action that triggered Error 9232 and confirm no exception is thrown; check sys.dm_qn_subscriptions to confirm the subscription registered successfully.
  • As an alternative, bypass the custom options string entirely by using the default SqlDependency.Start(connectionString) overload (without a custom options string) to let ADO.NET auto-generate a valid service/queue pair.