Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Conversion failed when converting the varchar valu

Author  Topic 

rockstar283
Yak Posting Veteran

96 Posts

Posted - 2012-04-02 : 14:19:35
Hello..I am using a Script component as a source in my DFT..Component contains the following code

public override void CreateNewOutputRows()
{
System.Windows.Forms.MessageBox.Show("Inside CreateNewOutputRows: ");
while (sqlReader.Read())
{
System.Windows.Forms.MessageBox.Show("Inside CreateNewOutputRows1: ");
{

Output0Buffer.AddRow();
Output0Buffer.TAG = sqlReader.GetString(0);
}
}

}
While executing the package..I am getting the following error..'Conversion failed when converting the varchar value xyz to data type int'..I am thinking that this error is caused at the line sqlReader.Read()) as the first message box is showing up properly and then the error occurs..now my query is fine..the value XYZ is also correct..the output column TAG is string as well..then can anyone tell me why it is trying to convert varchar into int??

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-02 : 15:49:38
i'm not sure TAG is string as the error clearly states it trying for data conversion to integer which is causing the error

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

rockstar283
Yak Posting Veteran

96 Posts

Posted - 2012-04-02 : 16:19:02
Thank you for replying friend..TAG is string only..and to reach to that step where I am assigning the value to TAG..it should first distplay the second messagebox right? which is not showing up :(
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-02 : 16:46:53
are you using TAG in any expressions? also is xyz a direct field value or is it an expression itself?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

rockstar283
Yak Posting Veteran

96 Posts

Posted - 2012-04-02 : 17:48:20
problem solved..there was error in my string query..Thanks a lot for your help mate :)
Go to Top of Page
   

- Advertisement -