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 Books 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:
For examples of quotation mark usage, see "SET QUOTED_IDENTIFIER" in Books Online.
SELECT SESSIONPROPERTY('QUOTED_IDENTIFIER')
Depending on your needs, you may need to change the setting with SET QUOTED_IDENTIFIER ON/OFF.
Check whether QUOTED_IDENTIFIER is true for your current session with this Transact-SQL command:SELECT SESSIONPROPERTY('QUOTED_IDENTIFIER')Depending on your needs, you may need to change the setting with SET QUOTED_IDENTIFIER ON/OFF.
Verify that each quotation mark intended to delimit a string has a matching quotation mark of the same type.
Verify that each quotation mark that is part of the literal string is represented by two of the same type of quotation mark.
Target | Microsoft.SQLServer.2012.DBEngine | ||
Category | EventCollection | ||
Enabled | True | ||
Event_ID | 14353 | ||
Event Source | $Target/Property[Type="SQL!Microsoft.SQLServer.DBEngine"]/ServiceName$ | ||
Alert Generate | True | ||
Alert Severity | Warning | ||
Alert Priority | Normal | ||
Remotable | True | ||
Alert Message |
| ||
Event Log | Application | ||
Comment | Mom2012ID='{9F3F26E8-EB1A-479F-A53F-BA44C789022D}';MOM2012GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74} |
ID | Module Type | TypeId | RunAs |
---|---|---|---|
_F6DA1507_12AF_11D3_AB21_00A0C98620CE_ | DataSource | Microsoft.Windows.EventProvider | Microsoft.SQLServer.SQLDefaultAccount |
GenerateAlert | WriteAction | System.Health.GenerateAlert | Default |
<Rule ID="Microsoft.SQLServer.2012.Cannot_determine_the_service_account_for_SQL_Server_instance_1_5_Rule" Target="SQL2012Core!Microsoft.SQLServer.2012.DBEngine" Enabled="true" ConfirmDelivery="true" Remotable="true" Comment="Mom2012ID='{9F3F26E8-EB1A-479F-A53F-BA44C789022D}';MOM2012GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}">
<Category>EventCollection</Category>
<DataSources>
<DataSource ID="_F6DA1507_12AF_11D3_AB21_00A0C98620CE_" Comment="{F6DA1507-12AF-11D3-AB21-00A0C98620CE}" TypeID="Windows!Microsoft.Windows.EventProvider" RunAs="SQL!Microsoft.SQLServer.SQLDefaultAccount">
<ComputerName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
<LogName>Application</LogName>
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>PublisherName</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$Target/Property[Type="SQL!Microsoft.SQLServer.DBEngine"]/ServiceName$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>14353</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="GenerateAlert" TypeID="SystemHealth!System.Health.GenerateAlert">
<Priority>1</Priority>
<Severity>1</Severity>
<AlertMessageId>$MPElement[Name="Microsoft.SQLServer.2012.Cannot_determine_the_service_account_for_SQL_Server_instance_1_5_Rule.AlertMessage"]$</AlertMessageId>
<AlertParameters>
<AlertParameter1>$Data/EventDescription$</AlertParameter1>
</AlertParameters>
<Suppression>
<SuppressionValue/>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>