MSSQL on Windows: Cannot determine the service account for SQL Server instance

Microsoft.SQLServer.Windows.EventRule.DBEngine.Cannot_determine_the_service_account_for_SQL_Server_instance_1_5_Rule (Rule)

This error occurs when a Transact-SQL statement contains mismatched single or double quotes. The SET QUOTED_IDENTIFIER setting will determine which combinations of single and double quotations marks are valid. For more information about SET QUOTED_IDENTIFIER, see "SET QUOTED_IDENTIFIER" in Docs Online.

Knowledge Base article:

Causes

This error occurs when a Transact-SQL statement contains mismatched single or double quotes. The SET QUOTED_IDENTIFIER setting will determine which combinations of single and double quotations marks are valid. For more information about SET QUOTED_IDENTIFIER, see "SET QUOTED_IDENTIFIER" in Docs Online.

Each single or double quotation mark used to mark the beginning of a literal string must have a corresponding quotation mark of the same type to mark the end of the literal string. A single quotation mark cannot be paired with a double quotation mark to delimit a single literal string.

Quotation marks that are part of the literal string are handled differently. If a single quotation mark (') is part of the literal string, it can be represented by two single quotation marks (''). If a literal string is delimited by double quotation marks and SET QUOTED_IDENTIFIER is OFF, the string can contain embedded single quotation marks, such as apostrophes. If a literal string is delimited by single quotation marks and SET QUOTED_IDENTIFIER is either ON or OFF, the string can contain embedded double quotation marks.

If you do not place the correct type and number of quotation marks in each place in your code, SQL Server will return the above error, possibly along with an "Incorrect syntax near %" error.

For more information about managing quotation marks in code, see these Microsoft Knowledge Base articles:

311023 and 311021.

For examples of quotation mark usage, see "SET QUOTED_IDENTIFIER" in Docs Online.

Resolutions

SELECT SESSIONPROPERTY('QUOTED_IDENTIFIER')

Depending on your needs, you may need to change the setting with SET QUOTED_IDENTIFIER ON/OFF.

Overridable Parameters

Name

Description

Default Value

Enabled

Enables or disables the workflow.

Yes

Interval (seconds)

The recurring interval of time in seconds in which to run the workflow.

300

Priority

Defines Alert Priority.

1

Severity

Defines Alert Severity.

1

Synchronization Time

The synchronization time specified by using a 24-hour format. May be omitted.

 

Timeout (seconds)

Specifies the time the workflow is allowed to run before being closed and marked as failed.

200

Timeout for query execution (seconds)

The workflow will fail and register an event, if the query execution takes longer than the specified period.

60

Timeout for database connection (seconds)

The workflow will fail and register an event, if it cannot access the database during the specified period.

15

Element properties:

TargetMicrosoft.SQLServer.Windows.DBEngine
CategoryEventCollection
EnabledTrue
Alert GenerateTrue
Alert SeverityWarning
Alert PriorityNormal
RemotableTrue
Alert Message
MSSQL on Windows: Cannot determine the service account for SQL Server instance
{2}
CommentMom2017ID='{9F3F26E8-EB1A-479F-A53F-BA44C789022D}';MOM2017GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}

Member Modules:

ID Module Type TypeId RunAs 
_F6DA1507_12AF_11D3_AB21_00A0C98620CE_ DataSource Microsoft.SQLServer.Windows.DataSource.EventCollectionFiltered Default
GenerateAlert WriteAction System.Health.GenerateAlert Default

Source Code:

<Rule ID="Microsoft.SQLServer.Windows.EventRule.DBEngine.Cannot_determine_the_service_account_for_SQL_Server_instance_1_5_Rule" Target="SqlDiscW!Microsoft.SQLServer.Windows.DBEngine" Enabled="true" ConfirmDelivery="true" Remotable="true" Comment="Mom2017ID='{9F3F26E8-EB1A-479F-A53F-BA44C789022D}';MOM2017GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}">
<Category>EventCollection</Category>
<DataSources>
<DataSource ID="_F6DA1507_12AF_11D3_AB21_00A0C98620CE_" Comment="{F6DA1507-12AF-11D3-AB21-00A0C98620CE}" TypeID="Microsoft.SQLServer.Windows.DataSource.EventCollectionFiltered">
<MachineName>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/MachineName$</MachineName>
<NetbiosComputerName>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/NetbiosComputerName$</NetbiosComputerName>
<InstanceName>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/InstanceName$</InstanceName>
<ConnectionString>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/ConnectionString$</ConnectionString>
<InstanceVersion>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/Version$</InstanceVersion>
<InstanceEdition>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/Edition$</InstanceEdition>
<MonitoringType>$Target/Property[Type="SqlDiscW!Microsoft.SQLServer.Windows.DBEngine"]/MonitoringType$</MonitoringType>
<SqlExecTimeoutSeconds>60</SqlExecTimeoutSeconds>
<SqlTimeoutSeconds>15</SqlTimeoutSeconds>
<TimeoutSeconds>200</TimeoutSeconds>
<IntervalSeconds>300</IntervalSeconds>
<SyncTime/>
<EventDisplayNumber>14353</EventDisplayNumber>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="GenerateAlert" TypeID="Health!System.Health.GenerateAlert">
<Priority>1</Priority>
<Severity>1</Severity>
<AlertMessageId>$MPElement[Name="Microsoft.SQLServer.Windows.EventRule.DBEngine.Cannot_determine_the_service_account_for_SQL_Server_instance_1_5_Rule.AlertMessage"]$</AlertMessageId>
<AlertParameters>
<AlertParameter1>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/MachineName$</AlertParameter1>
<AlertParameter2>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/InstanceName$</AlertParameter2>
<AlertParameter3>Event ID: $Data/Property[@Name='EventID']$. $Data/Property[@Name='Message']$</AlertParameter3>
</AlertParameters>
<Suppression>
<SuppressionValue/>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>