6

I am importing a data set from Oracle using SSIS. SSIS is gives me a warning:

Truncation may occur due to retrieving data from database column "Third Party" with a length of 28 to data flow column "Third Party" with a length of 25."

The warning does not make sense. The destination is a SQL Server database where the attribute is [Third Party] as nvarchar(255).

Why is the tool giving me this odd error?

I have tried changing the length of the nvarchar(max). This did not make a difference.

select 
    case 
        when XTNL_HOS_FLG = 1 and VND_MG_APL_FLG = 0 
           then 'Host'          
        when XTNL_HOS_FLG = 0 and VND_MG_APL_FLG = 1 
           then 'Support or Manage' 
        when XTNL_HOS_FLG = 1 and VND_MG_APL_FLG = 1 
           then 'Host and (Support or Manage)'  
        else ''
    end  as "Third Party"
from 
    table1
2

3 Answers 3

10

Look in "Show Advanced Editor" in your Data Flow Task by right-click on Source Target.

enter image description here

Then go to "input and output properties" tab:

enter image description here

And check the length of your columns in the Output Columns:

enter image description here

Do the same on Destination Target:

enter image description here

In the Input Columns:

enter image description here

Depending on the way you got your data, the type and length of columns aren't the same as the database.

2
  • It is more recommended to specify the column length from the SQL command because the Column property may change if the values provided in the query changed
    – Yahfoufi
    Apr 4, 2019 at 7:32
  • I would always recommend if you have a text or CSV file to import the data by finding the max column length and using Unicode to import and then do the conversions in SQL server. This will save a lot of hassle.
    – Rishi
    Apr 4, 2019 at 14:28
0

Since you are using an SQL Command as source you can edit you command and force the source column length and to help the OLEDB source to recognize it. You can use a CAST function to do that:

select CAST(
    case 
        when XTNL_HOS_FLG = 1 and VND_MG_APL_FLG = 0 
           then 'Host'          
        when XTNL_HOS_FLG = 0 and VND_MG_APL_FLG = 1 
           then 'Support or Manage' 
        when XTNL_HOS_FLG = 1 and VND_MG_APL_FLG = 1 
           then 'Host and (Support or Manage)'  
        else ''
    end AS NCHAR(255)) as "Third Party"
from 
    table1
2
  • 1
    @user716255 try to remove the old source component and add a new one with thi sql command.
    – Hadi
    Apr 22, 2019 at 16:59
  • -1. This is not a fix. Even if you change the data to the right length, you will still get the error in SSIS. You do not get around a Conversion Task unless you change the column definition of the source's table. The SSIS warning does not care about casts. That is why I do not see why this answer should be accepted or upvoted. 5 hours ago
0

I did it like this: I used the command left(column,n) to match the output file.

1
  • -1. But that should not have dropped the warning. The warning is about the column definition of the source's table, not about how you change the length. 5 hours ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.