.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

SSIS Data Conversion without using the Data Conversion Transformation

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :Sql Server
how can i convert a record from a flat file to a different data type without using the data conversion task?

View Complete Post

More Related Resource Links

Data conversion in SSIS

I am creating an SSIS package, My source DB is ORACLE and destination is SQL Server 2005 I am moving the contents of a Table AO in Oracle DB to  Table B in SQL Server2005 A specific Column in  "Renvenue " in AO table is of data type NUMBER  , it contains  decimal values like 1040.334, 19191.33, 454545.22 I have a corresponding column 'Rev" in Table B ( in SQLserver DB) of datatype Numeric(18,2)   I have created a SSIS package using Data source Reader, DataConversion , OLEDB Destination  in the dataflow task Everything is working fine, but I am getting incorrect data for example 1040.334, 19191.33, 454545.22   for these values I am getting 1040.00 , 19191.00 , 454545.00 the decimal values are not getting transferred to the destination table. I tried converting the datatype to Numeric {DT_NUMBERIC] 18 -2   and even declimal(DT_DECIMAL] scale 2 but still not getting the decimal values   Can some one tell me where am I going wrong...      

SSIS Excel Connection Manager Data Type Conversion Issues with SS Agent Job

Hi All! I have an issue I've been trying to fix but can't seem to figure it out. I was hoping a kind person would point me in the right direction. :o) I have an SSIS package that uses an excel connection manager source, and I want to run this package through a job scheduled in the SQL server agent. The data types for the excel file fields are 2 (DT_WSTR) and 5 (DT_R8). When I run the package directly through the SSIS package (VS solution) all of the data fields are properly imported into the database table. But...when I run this package through the SQL server agent job, ONLY the string (DT_WSTR) fields in each row are being imported, all of the float fields are imported as NULL. I set the data types for these float fields as "float" in the SQL server import table (data type). Even though the excel source float fields are indicating a type of DT_R8 in the excel connection manager and I set the data types in the SQL server table to "float", I also used the data conversion component and set the type to "float" as a fail-safe. I guess I should add to that the data access mode in the excel connection manager is using a custom code to select only those columns that I needed and to trim rows that I didn't need. Here's my code that I have in the excel source editor: select f1, f2, f3, f5, f6, f7, f8 from [mdo$] where f2 <> 'Rep Name'

Data Conversion Transformation question


Hi Experts,

I used the Data conversion transformation object to convert a data format to the right format {im a newbie}, and i was wondering how it did this without me specify the format i want the results to be in? IF i wanted to convert to convert text to numeric, do i just have to add the Data conversion transformation or do i need to configure it?


SSIS Derived Column and Data Conversion Task


I am passing down a variable, filename, as  string and then using Derived Column to pass it down to the destination. The filename is numeric (date) like such: 20101010. So, I need to convert the filename into a date formmat before I pass it to the destination table. Therefor, I am using a data conversion and converting it to a Date format. I tried using both database date or the date format and it keeps failing.

Here is what the failure report:

[Data Conversion [42297]] Error: Data conversion failed while converting column "DateAdded" (29685) to column "Copy of DateAdded" (42310).  The conversion returned status value 2 and status text "The value could not be converted because of a potential loss of data.".  

Any ideas to resolve this issue?



data type conversion using ssis



i am migrating from oracle to sql i am getting data type format error while importing data from oracle to sql for date datatype in oracle. I was using SSIS with data conversion task.

IS there any method i can use to resolve the error with date format?

Thanks in advance


Data Conversion - string to datetime help!!!

Hi all, I need help on concatenate two fields into one then display it as datetime format as such yyyy-mm-dd hh:mm:ss AM/PM. The db is on SQL 2008 SP1. The date and time columns are on the same table and store as varchar. Date has varchar(10) and time has varchar(16). Date column shows result from query is 20100827 while the time column is either 070101.000000 or 070101. The question is how go about concatenate the two together and display in the format above in a report? How should I write my select query for this report? I am using SQL 2008 R2 BI Development Studio to design my report. Thank you. VCHS

Conversion Failed when Converting the nvarchar value 'N' to data type int.

Hi.. I am facing a strange situation. when i executing the following query it is returning the error SELECT  s.row_id as shipment,    SUM(CAST(la5.attr_value AS INT)) AS Cases     FROM    shipment s WITH(NOLOCK)    INNER JOIN shipping_shift ss WITH(NOLOCK) ON s.shipping_shift = ss.row_id    INNER JOIN shift WITH(NOLOCK) ON ss.shift_id = shift.shift_id    INNER JOIN shipment_lot sl WITH(NOLOCK) ON s.po_id = sl.po_id AND s.cust_id = sl.cust_id AND          s.so_line_no = sl.so_line_no and s.ship_date_local = sl.ship_date_local     INNER JOIN lot_attr la5 WITH(NOLOCK) ON sl.lot_no = la5.lot_no AND sl.item_id = la5.item_id AND la5.attr_id = (SELECT attr_id FROM attr WITH(NOLOCK) WHERE attr_desc = 'CaseQty' AND attr_grp = 3)  WHERE s.spare2 = 'RELEASED'       AND shift.shift_desc = 'c'   AND DAY(ss.production_date) = DAY('2010-08-09 00:00:00.000')    AND MONTH(ss.production_date) = MONTH('2010-08-09 00:00:00.000')    AND YEAR(ss.production_date) = YEAR('2010-08-09 00:00:00.000') GROUP BY s.row_id  Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the nvarchar value 'N' to data type int. The column  type of attr_value of lot_attr table is a USER D

Issue with data conversion

Hi Guys,   Input data format: 9261.00001e+012 Out put Required in NVARCHAR  I am using below expression in derived column but still its not converting. (DT_WSTR,50)new_master_plu Any help much appreciated. Thanks,            

Problem with Conversion of numeric data from sql table to csv

I have a numeric value which is of data type Numeric(38,12) in sql server 2000. Now loading to csv what happens is 2000--data looks like 115,834,000.00 when loaded to csv ---115834000--this is how it looks. but I want it to look like as it is in the database. It would be of great help to me, if anybody can tell me the work around. Thanks, PreenSheen

Help to resolve an error "The conversion of a char data type to a datetime data type resulted in an

Why am I getting an error when executing this: select convert(datetime, '2010-09-12T18:11:48', 120) The message is: "Msg 242, Level 16, State 3, Line 1 The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value." I don’t get the error if I remove “T” from the string. But I need it to work with “T”.

Data conversion failed --flat file connection manager


Hello All,

Can any one help me in this .

[Flat File Source [16]] Error: Data conversion failed. The data conversion for column "acct" returned status value 2 and status text "The value could not be converted because of a potential loss of data.".

[Flat File Source [16]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "output column "acct" (373)" failed because error code 0xC0209084 occurred, and the error row disposition on "output column "acct" (373)" specifies failure on error. An error occurred on the specified object of the specified component.  There may be error messages posted before this with more information about the failure.

[DTS.Pipeline] Error: SSIS Error Code DTS_E_THREADCANCELLED.  Thread "WorkThread1" received a shutdown signal and is terminating. The user requested a shutdown, or an error in another thread is causing the pipeline to shutdown.  There may be error messages posted before this with more information on why the thread was cancelled.


can any one help me in this error :


[Lookup [465]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "component "Lookup" (465)" failed because error code 0xC020901E occurred, and the error row disposit

Accessing data from Data Conversion task




I am new to SSIS. I am creating a package which does the following:

1. Get data depending on a SQL Query (in SSIS I did this as a OLEDB Source with SQL Command)

2. Data conversion 

3. Then insert the data into a SQL table. 

For Step 3, which task Should I use. Id I Use OLE DB destination, into a table, it is giving me Errors.

So Can I access the Output of the Data conversion step in Execute SQL task, if I use it instead of OLEDB destination?

System.Data.SqlClient.SqlException: Conversion failed when converting the varchar value 'Cash' to


Line 64:         CMD = New SqlCommand(SQL, CON)
Line 65:         CMD.Parameters.Add("@payment", SqlDbType.VarChar, 50).Value = payment.Text.Trim
Line 66:         CMD.ExecuteNonQuery()
Line 67:
Line 68:

Hi All,

I'm having the above mentioned error message.

Please help.






Concat and Conversion of char data type to smalldatetime data type resulted in an out-of-range small




I am trying to create a new date as below and add this date to the BDMRY field (smalldatetime data type) in SQL Server 2005.

MostRecentCompletionDate -  (smalldatetime data type)

StudentBirthdate - (smalldatetime data type).

SET BDMRY =  CAST(CAST(YEAR(MostRecentCompletionDate) AS VARCHAR(4)) + '/' +
                      CAST(MONTH(StudentBirthdate) AS VARCHAR(2)) + '/' +
                      CAST(DAY(StudentBirthdate) AS VARCHAR(2)) AS DATETIME)

When I run this I'm getting the error as:

Msg 296, Level 16, State 3, Line 1
The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value.
The statement has been terminated.

It works fine on my laoptop but doesnt work on the production server.

Any help would be greatly appreciated.



Conversion failed when converting the varchar value 'YTD' to data type int.


I have a report that I need to show the four quarters plus a Year To Date (YTD). I am getting a Conversion failed when converting the varchar value 'YTD' to data type int error and need some help. See first code & output. I used this same for a 12 month & YTD report and it works fine - see second code and output- any help is appreciated

First code

DECLARE @BD Datetime
DECLARE @ED Datetime
DECLARE @RptMonth Datetime

SET @ID = '1038'
SET @BD = '01/01/2010'
SET @ED = '12/01/2010'
SET @RptMonth = '07/01/2010'

Datasource_ID int, Actual_YTD float

Data Conversion Task Error


Hi All, i have a table in excel as below. and i am trying to move records from excel to SQL.

Code     Template      ExportType

A002      A002XM08    DST           

---           ------           ---

I have simple SSIS package with Excel Source, data conversion task and OLEDB Destination. and in data conversion i have given the data type string(DT_STR) for each of the column and length of data type same as each column is having in sql database but still it fails at data conversion task and gives the following error: 


Error: 0xC02020C5 at Data Flow Task, Data Conversion [2329]: Data conversion failed while converting column " ExportType" (3519) to column "Copy of ExportType" (3533). The conversion returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.".

Error: 0xC020902A at Data Flow Task, Data Conversion [2329]: The "output column "Copy of ExportType" (3533)" failed because truncation occurred, and the tr

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend