Genny
Genny

Reputation: 71

Query XML in SQL Server 2014

This is my table

CREATE TABLE tab_customerxml 
(
    id INT IDENTITY, 
    xmldata XML
)

and I loaded an xml with insert.

I want to run this simple query

SELECT 
    xmldata.query('/customer')
FROM 
    tab_customerxml 
WHERE 
    id = 4;

but I get this error:

Can not run because select the settings of the following SET options are incorrect QUOTED_IDENTIFIER.

I do not know how to solve this problem.

Thank you

Upvotes: 2

Views: 78

Answers (1)

marc_s
marc_s

Reputation: 755321

Try to run this:

  • drop your table

    DROP TABLE tab_customerxml;
    
  • re-create it with the proper settings on:

    SET ANSI_NULLS ON
    SET QUOTED_IDENTIFIER ON
    SET ANSI_PADDING ON
    
    CREATE TABLE tab_customerxml 
    (
       id INT IDENTITY, 
       xmldata XML
    )
    
  • now try your query again

    SELECT xmldata.query('/customer')
    FROM tab_customerxml 
    WHERE id = 4;
    

Does that help?

Upvotes: 1

Related Questions