• Ask a Question
  • Create a Poll
150
    Ask a Question
    Cancel
    150
    More answer You can create 5 answer(s).
      Ask a Poll
      Cancel

      XML parsing: line 1, character 7, text/xmldecl not at the beginning of input while running stored procedure

      I have a csv file and want to bulk import all the csv file values into my table. I have written a stored procedure for it.

      Problem is I have a table with columns of xml datatype. When I’m trying to import xml values from csv file to database its throwing XML parsing:

      line 1, character 7, text/xmldecl not at the beginning of input

      My stored procedure

      SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO  ALTER PROCEDURE [dbo].[sp_CreateImportTempTable] AS BEGIN     SET NOCOUNT ON;      CREATE TABLE ImportData1     (         message XML,         status XML     )      BULK INSERT ImportData1 from 'C:\Temp\demo.csv'      WITH (             FIELDTERMINATOR = ',',             FIRSTROW = 2          ) END 

      My csv has these values

      first column: message

      <?xml version="1.0" encoding="UTF-8"?><ixml xsi:noNamespaceSchemaLocation="example.xsd"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><name><id/><nameType>argument</nameType>  <section/><division>no</division><Host/><content><Start><class/><interface><deviceId/><new>  <name>Ram</name><FullName>Ram Sath</FullName><version>1.0</version></new></interface></Start>  </content></name></ixml> 

      second column: status

      <?xml version="1.0" encoding="UTF-8"?><ixml xsi:noNamespaceSchemaLocation="demo.xsd"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><name><id/><Type/><divison/><section/><Host/>  <content><Stop><section/></Stop></content></name></ixml> 

      What is the issue here?

      0 Answers