patternModerate
SELECT failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'
Viewed 0 times
theincorrectsettingshaveoptionsfollowingbecausefailedselectquoted_identifier
Problem
Whats wrong with this statement?
why it gives below error message
Error Message:
SELECT failed because the following SET options have incorrect
settings: 'QUOTED_IDENTIFIER'. Verify that SET options are correct for
use with indexed views and/or indexes on computed columns and/or
filtered indexes and/or query notifications and/or XML data type
methods and/or spatial index operations.
Statement
why it gives below error message
Error Message:
SELECT failed because the following SET options have incorrect
settings: 'QUOTED_IDENTIFIER'. Verify that SET options are correct for
use with indexed views and/or indexes on computed columns and/or
filtered indexes and/or query notifications and/or XML data type
methods and/or spatial index operations.
Statement
SELECT ISNULL(STUFF((SELECT ', ' + u.TITLE + ' ' + u.FirstNAME + ' ' + LastNAME [text()]
FROM table1 c
INNER JOIN table2 u ON c.user = u.user
AND c.Task = @task
AND c.Type = 'Assign'
FOR XML PATH(''), TYPE)
.value('.','NVARCHAR(MAX)'),1,2,' ')
,'') UNAMESLISTSolution
As documented in SET QUOTED_IDENTIFIER (Transact-SQL)
SET QUOTED_IDENTIFIER must be ON when you invoke XML data type
methods.
A simple test
Msg 1934, Level 16, State 1, Line 8 SELECT failed because the
following SET options have incorrect settings: 'QUOTED_IDENTIFIER'.
Verify that SET options are correct for use with indexed views and/or
indexes on computed columns and/or query notifications and/or xml data
type methods.
You are using
Msg 1934, Level 16, State 1, Line 8 SELECT failed because the
following SET options have incorrect settings: 'QUOTED_IDENTIFIER'.
Verify that SET options are correct for use with indexed views and/or
indexes on computed columns and/or query notifications and/or xml data
type methods.
SET QUOTED_IDENTIFIER must be ON when you invoke XML data type
methods.
A simple test
set quoted_identifier off
DECLARE @xmlRecords XML
SET @xmlRecords = ''
SELECT records.record.value('(@orderId)[1]', 'INT') AS orderId
FROM @xmlRecords.nodes('/records/record') records(record)Msg 1934, Level 16, State 1, Line 8 SELECT failed because the
following SET options have incorrect settings: 'QUOTED_IDENTIFIER'.
Verify that SET options are correct for use with indexed views and/or
indexes on computed columns and/or query notifications and/or xml data
type methods.
You are using
FOR XML PATHSET QUOTED_IDENTIFIER off
DECLARE @T TABLE (id VARCHAR(5),col1 XML)
INSERT INTO @t (id,col1) VALUES ('1','one')
SELECT ISNULL(STUFF((
SELECT ', ' + id
FROM @t
FOR XML PATH('')
,TYPE
).value('.', 'NVARCHAR(MAX)'), 1, 2, ' '), '') UNAMESLISTMsg 1934, Level 16, State 1, Line 8 SELECT failed because the
following SET options have incorrect settings: 'QUOTED_IDENTIFIER'.
Verify that SET options are correct for use with indexed views and/or
indexes on computed columns and/or query notifications and/or xml data
type methods.
Code Snippets
set quoted_identifier off
DECLARE @xmlRecords XML
SET @xmlRecords = '<records><record orderId="1" refCode="1234"></record></records>'
SELECT records.record.value('(@orderId)[1]', 'INT') AS orderId
FROM @xmlRecords.nodes('/records/record') records(record)SET QUOTED_IDENTIFIER off
DECLARE @T TABLE (id VARCHAR(5),col1 XML)
INSERT INTO @t (id,col1) VALUES ('1','<node1>one</node1>')
SELECT ISNULL(STUFF((
SELECT ', ' + id
FROM @t
FOR XML PATH('')
,TYPE
).value('.', 'NVARCHAR(MAX)'), 1, 2, ' '), '') UNAMESLISTContext
StackExchange Database Administrators Q#233471, answer score: 14
Revisions (0)
No revisions yet.