Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Derived Column - String Expression returns WSTR datatype - please help!

$
0
0
Hi,

In my XML, there is a Employee_code column and its values are like 00100,00101,00102,01111 in the XML...but when i connect through XML Source and load into SQL Server, its getting loaded as 100,101,102,1111. When i checked its coming as Integer from the XML and thats why the prefix Zeros are getting cut-off.

I tried to change the DataType by selecting the 'Advanced Editor'--> Output columns - but its not allowing me to do, saying , in XML , its not allowed.So, the 'Employee_code' column is coming as Integer only. So, how can load the data with in target like 00100,00101,00102,01111 instead of 100,101,102,1111.

I am planning to add a expression in 'Derived Column' for this belo logic -
if the Length of the cast(code) =3, then add 00 at the prefix
if the Length of the cast(code) =4, then add 0 at the prefix
if the Length of the cast(code) =5, then leave it as it is 

I wrote the below expression - but the datatype comes as 'WSTR' - But I want STR and in the expression also I have given as STR. But its coming as WSTR. Can you help me to fix this?

Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>