简体   繁体   中英

Unable to extract XML Data from SQL Server using bcp

I am trying to extract an xml column value from a sql server table via bcp, but I am facing the below error.

Error = [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]SELECT failed beca use the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'. Veri fy that SET options are correct for use with indexed views and/or indexes on com puted columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations.

This is the query i am using via bcp

select EventLog.payload.value('(/EventData/Pin)[1]', 'varchar(10)') 
as payload_pin 
from usp.EventLog

The above query is working in sql server but not via bcp. Has anyone encountered such scenario?

bcp "SET QUOTED_IDENTIFIER ON ;select ColumnName.value('(/EventData/Pin)[1]', 'varchar(10)') as pin;" queryout data.txt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM