SELECT failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER' 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

  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,' ')
                                 ,'') UNAMESLIST
As documented in SET QUOTED_IDENTIFIER (Transact-SQL)


  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 = '&lt;records&gt;&lt;record orderId="1" refCode="1234"&gt;&lt;/record&gt;&lt;/records&gt;'


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 PATH

SET QUOTED_IDENTIFIER off

DECLARE @T TABLE (id VARCHAR(5),col1 XML)

INSERT INTO @t (id,col1) VALUES ('1','&lt;node1&gt;one&lt;/node1&gt;')

SELECT ISNULL(STUFF((
                SELECT ', ' + id
                FROM @t
                FOR XML PATH('')
                    ,TYPE
                ).value('.', 'NVARCHAR(MAX)'), 1, 2, ' '), '') UNAMESLIST



  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.