![Ssis read xml without root](https://kumkoniak.com/79.jpg)
T.value('(Job/text())','nvarchar(120)')AS TempTable(t)Ĭan anyone help me to resolve the error i am facing. My SQL procedure that i use to save xml data to sql table will be similar to this CREATE PROCEDURE XML Pass XML as Parameter from C# to SQL Stored Procedure in VB.NET Importing data from XML file to SQL database I tried few workarounds by reading the xml document using XMLTextReader, XMLDocument, StreamReader, however i am getting the same error "data at the root level is invalid".
#SSIS READ XML WITHOUT ROOT HOW TO#
I know its because of the first 7 lines in my xml document however i dont know how to remove it from the xml document as I cannot do it manually. When I run the code i'm getting the errorĭata at the root level is invalid. SqlCmd.CommandType = SqlDbType.Xml).Value = dsXml.GetXml() ĭts.TaskResult = (int)ScriptResults.Success ĭts.Variables.Value = 1 ĭts.TaskResult = (int)ScriptResults.Failure ĭts.Variables.Value = 0 SqlCmd = new SqlCommand("usp_XMLtoTable", sqlConn) Using (sqlConn = new SqlConnection(strConnectionStr)) String strConnectionStr = () ĭirectoryInfo di = new DirectoryInfo(strFtpath.ToString()) įileInfo getCSVFile = di.GetFiles("*.xml") a file): File file new File(pathtofile) Then open a FileInputStream: FileInputStream fis new FileInputStream(file) If we try to parse this stream with any XML library at that point we. So first of all you have to open the resource that contains your 'malformed' xml (i. the column names in my sql table would be addon, fieldset and so on.īelow is my script task code public void Main() Basically what we will do is to add programmatically a root element. I am trying to load each data values inside addon, fieldset into a sql table using SSIS script task. PackageDataPoint and there will be various childnodes like ADDON./ADDON, FIELDSET./FIELDSET etc inside each The data for my table resides inside each PackageDataPoint. Content-Type: application/xml charset=utf-8
![Ssis read xml without root](https://kumkoniak.com/79.jpg)