Xml source in SSIS
I am trying to import data from an xml file named book.xml to tables in SSMS.
This is my xml file:
<?xml version="1.0"?>
<bookstore speciality="novel">
<book style ="autobiography">
<author>
<first-name>Joe</first-name>
<last-name>Bob</last-name>
<award>Trenton literary</award>
</author>
</book>
<book style="textbook">
<author>
<first-name>Mary</first-name>
<last-name>Bob</last-name>
<publication>
<first-name>Trinda</first-name>
<last-name>Bob</last-name>
</publication>
</author>
<editor>
<first-name>Britney</first-name>
<last-name>Bob</last-name>
</editor>
<price>18</price>
</book>
</bookstore>
I have these tables in my SSMS :
1. Books
2.Author
3.editor
4.publication
when i passed the output of xml source to my OLE DB destination am getting this error message
error message:column "style" cannot convert between unicode and non unicode string data type.
The datatype which i have defined for "style" column is varchar(50).
How do i solve this issue? Do i need to use an data conversion transformation?? am a begineer in ssis. please help
July 11th, 2011 2:24pm
Yes, you'll need to do data conversion on each column and convert. Here's a good post from Devin Knight to help you convert to correct data types: http://www.bidn.com/blogs/DevinKnight/ssis/1387/ssis-to-sql-server-data-type-translationsJorge Segarra
SQLChicken.com ||
Follow me on Twitter! || SQL University
Please click the Mark as Answer button if a post solves your problem!
Free Windows Admin Tool Kit Click here and download it now
July 11th, 2011 2:28pm
you can add a data conversion transformation after book output of xml source, and convert style to DT_STRhttp://www.rad.pasfu.com
My Submitted sessions at sqlbits.com
July 11th, 2011 2:32pm
Here is step by step approach to convert the data type using the data conversion trasnformation:
1)
2) Configure the Data Conversion Transformation as below :
3) Map the output of the transformation to the destination table (not the XML source input):
Happy to help! Thanks. Regards and good Wishes, Deepak.
In a revamp of my Blog!
Free Windows Admin Tool Kit Click here and download it now
July 11th, 2011 3:26pm
Thanks all for your help.
July 11th, 2011 4:06pm