I am trying to load multiple XML files into a SQL Server database. Aiming to insert XML file name (three files item1.xml, item2.xml and item3.xml and xsd are attached) as an additional column along with other column for each file.
I set up three variables
and setup the foreach loop editor
. It loaded each records from three files into a table
.
I attempted to use derived column transformation and file path variable which is holding the file into the expression but that throwing me error

.
Not sure what is wrong. I have attached all the steps for review including files. any help is highly appreciated. Thanks
--Item1.xml
<?xml version="1.0"?>
<Items xmlns="ItemsXSDSchema">
<Item>
<Id>1</Id>
<productnumber>I1145343</productnumber>
<productname>Mousewire</productname>
<Price>19.99</Price>
</Item>
</Items>
--Item2.xml
<?xml version="1.0"?>
<Items xmlns="ItemsXSDSchema">
<Item>
<Id>1</Id>
<productnumber>I1145300</productnumber>
<productname>Apple</productname>
<Price>29.99</Price>
</Item>
</Items>
--item3.xml
<?xml version="1.0"?>
<Items xmlns="ItemsXSDSchema">
<Item>
<Id>1</Id>
<productnumber>I1145387</productnumber>
<productname>Samsung</productname>
<Price>49.00</Price>
</Item>
</Items>
XSD file
<xsd:schema xmlns:schema="ItemsXSDSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sqltypes="http://schemas.microsoft.com/sqlserver/2004/sqltypes" targetNamespace="ItemsXSDSchema" elementFormDefault="qualified">
<xsd:import namespace="http://schemas.microsoft.com/sqlserver/2004/sqltypes" schemaLocation="http://schemas.microsoft.com/sqlserver/2004/sqltypes/sqltypes.xsd" />
<xsd:element name="Items">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="Item">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Id" type="sqltypes:int" />
<xsd:element name="productnumber">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="20" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="productname">
<xsd:simpleType>
<xsd:restriction base="sqltypes:nvarchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52">
<xsd:maxLength value="60" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Price">
<xsd:simpleType>
<xsd:restriction base="sqltypes:numeric">
<xsd:totalDigits value="18" />
<xsd:fractionDigits value="2" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
@[User::filePath]that approximates the expected run-time length. It is as Tim Mylott indicates, the metadata when the column was defined was length 0 so when the package actually runs and the value of filePath isn't the empty string, it blows up as you've overflowed the length of the column