Need Help With Data Conversion??
Nov 24, 2006
Hi,
The requirement is, we have to transfer from Flat file to OledBDestination. Flat File example is: 001|001|abc|
In the Database Table, Column A and Column B are Numeric(4,3). Column C is varchar(50).We have to write custom component (programmatically) which puts in the Database as
0.001|0.001|abc
I followed the Programmatic Sample, that comes with installation, ChangeCase which changes the case of the column as it moves to Database. I modified the program to meet my requirement. Program Sample is below. In below, I get the decimal Value (as columnValue), and then Divide by Math.Pow(10.0,3) to get 0.001. And I set it to thebuffer.SetDecimal method. For some reason, the decimal values does not show up in the Database. It truncates and gives 0.000. What Am I doing Wrong? Please help and suggest....
Decimal columnValue = buffer.GetDecimal(colInfo.bufferColumnIndex);
columnValue = (Decimal)(Decimal.ToDouble(columnValue) / Math.Pow(10.0, (3)));
buffer.SetDecimal(colInfo.bufferColumnIndex, columnValue);
All Code here:
public override void ProcessInput(int inputID, PipelineBuffer buffer) {
if (!buffer.EndOfRowset){
IDTSInput90 input = ComponentMetaData.InputCollection.GetObjectByID(inputID);
int errorOutputID = -1;
int errorOutputIndex = -1;
int defaultOutputId = -1;
GetErrorOutputInfo(ref errorOutputID, ref errorOutputIndex);
if (errorOutputIndex == 0)
defaultOutputId = ComponentMetaData.OutputCollection[1].ID;
else defaultOutputId = ComponentMetaData.OutputCollection[0].ID;
while (buffer.NextRow()){
if (columnInfos.Length == 0)
buffer.DirectRow(defaultOutputId);
bool isError = false;
/// Iterate the columns in the columnInfos array.
for (int x = 0; x < columnInfos.Length; x++){
ColumnInfo colInfo = columnInfos[x];
/// Is the column null?
if (!buffer.IsNull(colInfo.bufferColumnIndex)){
if (colInfo.dataType == DataType.DT_NUMERIC){
Decimal columnValue = buffer.GetDecimal(colInfo.bufferColumnIndex);
columnValue = (Decimal)(Decimal.ToDouble(columnValue) / Math.Pow(10.0, (3)));
buffer.SetDecimal(colInfo.bufferColumnIndex, columnValue);
if (!isError)
buffer.DirectRow(defaultOutputId);
}
View 2 Replies
ADVERTISEMENT
Jan 7, 2008
Hi Experts,
I am extracting data from SQL Server 2005 to flat file destination. I am using SQL Command to specify the data selection query. One of my query uses Replicate function to derive a column value. When I execute this package it fails with the error "Data conversion failed. The data conversion for column "value" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page".
The reason for the problem is that, it is taking the InputColumnWidth of the flat file destination as 8000 and I specified the OutputColumnWidth as 4.
If I change the OutputColumnWidth to 8000, it is working without any error but resulting in the column width of 8000.
I tried using DerivedColumn Transformation's Type cast and DataConversion Transformation but still I am getting the same error in the respective Transformation components.
Can anyone suggest how to solve this issue.
View 11 Replies
View Related
Feb 12, 2008
Hello,
I am wondering what conversion rules apply, when a string, which contains a number, is saved to a SQL Server 2005 into a column of type decimal.
This is the code I€™m using (C++):
CString cValue = "0.75"
_variant_t vtFieldValue;
vtFieldValue = _variant_t(cValue)
pRecordSet->Fields->Item["MyColumn"]->Value = vtFieldValue;
"pRecordSet" is an ADO recordset. The database column "MyColumn" is of type "decimal(19,10)".
The most important question for me is, if the regional settings of the database server or the regional settings of the client PC are considered during the conversion from the string to the decimal value. For example in standard French regional settings the "." would not be recognized as decimal separator.
I am also wondering if the language of the database instance, in which this data is saved, is considered during this conversion or any other settings of this database instance.
So my general question is: Does anybody know exactly what rules apply during the above mentioned conversion?
Thank you for your help.
Regards,
Volker
View 2 Replies
View Related
Aug 3, 2006
Hello
I have an odd problem that is driving me nutz. I have a very simple SSIS package that imports a 5 colum flatfile into a sql Server 2005 Table.
When I created this package with the wizzard, it will execute perfectly fine and processes all rows into the destination table.
But when I hit F5 to execute it manually it will fail before inserting a single row.
The error it generates is (Spalte 5 is a Datetime in the format DD.MM.YYYY) :
Error: 0xC02020A1 at Datenflusstask, Source - Daten_NC_1_txt [1]: Data conversion failed. The data conversion for column "Spalte 5" returned status value 2 and status text "The value could not be converted because of a potential loss of data.".
Error: 0xC0209029 at Datenflusstask, Source - Daten_NC_1_txt [1]: The "output column "Spalte 5" (25)" failed because error code 0xC0209084 occurred, and the error row disposition on "output column "Spalte 5" (25)" specifies failure on error. An error occurred on the specified object of the specified component.
Error: 0xC0202092 at Datenflusstask, Source - Daten_NC_1_txt [1]: An error occurred while processing file "C:WorkDaten_NC_1.txt" on data row 177.
Edit: Modified the Title so it properly reflects the Problem & the Solution
View 3 Replies
View Related
Aug 29, 2007
Hi,
I am getting this error when my ssis package is running
Data Conversion failed due to Potential Loss of data
the input column is in string format and output is in sql server bigint
the error is occuring when there is an empty string in the input. what should i do to overcome this
It is an ID field and should i convert to bigint or should i leave it as char datatype is it i a good solution or is there a way to over come this.
View 4 Replies
View Related
Jan 3, 2008
Hi,
I have another issue. I have an excel file that I pipe through a "data conversion" task. I have set all the column data types to strings, because there's no way to know beforehand if a particular column will be number or text because the file is very non-standard (it looks more like a formatted report).
After the data conversion, I send all the rows to a script task. In the script task, I do a check on the numeric fields.
for example:
If Not IsNumeric(Row.Price) Then
Row.Price_IsNull = True
End If
However, this check fails each and every time, even if the field contains a number! I don't have this problem when using flat file sources.
So, none of my numeric fields are getting loaded to my ole db destination.
Help, is there a way around this? Or am I forced to just skip this number check altogether? I'd prefer not to.
Thanks
View 10 Replies
View Related
Dec 14, 2005
After testing out the application i write on the local pc. I deploy it to the webserver to test it out. I get this error.
System.Data.SqlClient.SqlException: The conversion of a char data type to a
datetime data type resulted in an out-of-range datetime value.
Notes: all pages that have this error either has a repeater or datagrid which load data when page loading.
At first I thought the problem is with the date, but then I can see
that some other pages that has datagrid ( that has a date field) work
just fine.
anyone having this problem before?? hopefully you guys can help.
Thanks,
View 4 Replies
View Related
Dec 6, 2000
i have a column(of type 'varbinary') which has datetime stored as binary.
how do i convert this binary value back to datetime??
when i do a :
convert(datetime, column_name), i get an error message "Syntax error converting datetime from binary/varbinary string".
when i do a :
convert(datetime, convert(binary, column_name)), i get all the dates as 1900-01-01 00:00:00.000
thanx.
View 1 Replies
View Related
Jun 15, 2000
we are currently trying to extract data from an SQL server (10 tables)to insert into another data source (notes) would any one out there have any tips or best way to go about this
View 1 Replies
View Related
Jul 24, 2004
can i convert the data from my Sql tables to Foxpro 2.6 , using an SP ?
View 3 Replies
View Related
Nov 23, 2004
Hello everyone,
I am running SQL-2000, I have a table that one field ddefined as char. The data is actually Dollar values(no $ signs just 99.25 for example). I need to convert this column from char to Numeric. I am trying to use Enterprise manager to redesign the table but I get "error converting data type VARCHAR to numeric". Enterprise manager shows the field as CHAR. I have no Idea why that error is comming up. I would like any info that could help me with this conversion. Thanks in advance.
Ev
View 5 Replies
View Related
Jun 1, 2006
I have a View that multiplies a decimal (8,5) data type * money data type (no cast or convert) and for some odd reason comes up with a bit result (0 or 1). If I take the select statement out of the View, paste it into Query analyzer and execute it I get a decimal result.
It's easy enough to put a cast into the view but I'm wondering what is going on in the view that returns the bit data type.
View 2 Replies
View Related
Apr 10, 2008
Hi! Please help.
I have 10 table which I need to merge into 1. The problem is the department field on one of the tables is nvarchar(255) while on the other tables is float. I have tried to use cast/convert and I still get error "Msg 8114, Level 16, State 5, Line 1
Error converting data type nvarchar to float."
I am using sqlserver 2005
Please help
View 6 Replies
View Related
Dec 14, 2007
Hi guys!
I merely need your help!
I want to convert the following:
Table1
transaction Date
1235 10/18/2006 7:54:02
1235 9/18/2006 7:54:02
1235 8/18/2006 6:54:02
To
Table2 wherein the latest date will be post and the date should have a length of 10 characters. The following table would be the result
transaction Date
1235 10/18/2006
View 3 Replies
View Related
Apr 7, 2006
I need help!!!! I am about to go nuts! I am getting the following error in SSIS:
Error at Violations Load [SQL Server Destination [3800]]:
The column ""Site No "" can't be inserted because the
conversion between types DT_STR and DT_NUMERIC is not supported.
I have tried using the data conversion task,
modifying all properties to DT_NUMERIC and so on. I just can't
figure it out! I am attempting to load a numeric field from a
flat file into a SQL Server database. I cannot find any
information on this and have tried about everything. I need any
help or suggestions anyone can offer! Thank you in advance for
your help!!
SD
View 2 Replies
View Related
Oct 10, 2007
Hello,
I have a package that's been created programatically. Within the dataflow, there's a source and destination. Now, I need to create a data conversion between the two. Does anyone have VB code to demonstrate this?
Thanks,
JG
View 3 Replies
View Related
Feb 10, 2007
Hi!
I would be grateful for some advice, when getting error. I have 4 Lookups and one Data Conversion, getting the follwing error. Product.articlenr is a 13 number+letter productnumber.
[Lookup Demo [3882]] Warning: The Lookup transformation encountered duplicate reference key values when caching reference data. The Lookup transformation found duplicate key values when caching metadata in PreExecute. This error occurs in Full Cache mode only. Either remove the duplicate key values, or change the cache mode to PARTIAL or NO_CACHE.
[Data Conversion [9467]] Error: Data conversion failed while converting column "articlenr" (8559) to column "Copy of Lookup Product.articlenr" (10059). The conversion returned status value 2 and status text "The value could not be converted because of a potential loss of data.".
[Data Conversion [9467]] Error: The "output column "Copy of Lookup Product.articlenr" (10059)" failed because error code 0xC020907F occurred, and the error row disposition on "output column "Copy of Lookup Product.articlenr" (10059)" specifies failure on error. An error occurred on the specified object of the specified component.
View 8 Replies
View Related
Jul 6, 2007
Hi,
I have a flat file with over 300 fields and need to do a data conversion before SQL final destination, most fields are DT_STRING, is there an easier way of converting the data without having to manualy do the 300 fields.
I have all the data types i want STR converting to in a file.
Any info would be great,
Cheers,
Slash.
View 7 Replies
View Related
Sep 13, 2007
I have single letters in a Flat file and it is in the string format,but now i want to convert it in to int format.I have tried doing this by SSIS but it is not working.
I used data conversion and copy column transformation.
I got a error message.
it automatically correct the meta data mismatch. But when i run the package, it gives the following error message.
Error: 0xC0209029 at Data Flow Task, Data Conversion [75]: The "output column "ReceiptType" (112)" failed because error code 0xC020907F occurred, and the error row disposition on "output column "ReceiptType" (112)" specifies failure on error. An error occurred on the specified object of the specified component.
This is just one error message.
Please can you tell me the steps to do this correctly.
Also I need to know how to run a SSIS package through command line?
Thanks
Nishan
View 16 Replies
View Related
Aug 8, 2006
Hello,
What will the Dataconversion do if I try to convert a source field to a datetime but the data is not a valid date?
Can I just skip the one field?
Thanks,
Michael
View 1 Replies
View Related
Jul 24, 2007
Geographic data format (GDF) is used primarily for navigation systems. I was wondering if anyone was familiar with this format and if I can use either DTS or SSIS to import the GDF flat files into SQL?
View 1 Replies
View Related
Jul 12, 2005
I'm trying to create a jbo to run in SQL that will update my table DeviationMaster in crcwebauth table, with the value from qvqote in table invoice_tbl in database crcbrio...I get an error in the job that says...SQLSTATE 42000 Error 8114 Error converting data type varchar to numericThe field DNumber in the DeviationMaster table is numeric 9, and qvqote is char 6.I know about the cast/convert, but I havent been able to successfully do this. I was hoping someone could show me how to get around this problem.Here is my current SQL statement that triggers the above error:update crcwebauth.dbo.deviationmaster set ldate = (select max(qvdate) from crcbrio.dbo.invoice_tbl where DNumber = qvqote)
View 11 Replies
View Related
Oct 23, 2000
What is the best tool for converting data in to MSSQL 7.0? We get our data in dataflex format and currently use data
junction to migrate the data into tables in sqlserver. Can DTS do this and also include and scrubbing or translation script?
View 1 Replies
View Related
Aug 24, 2001
Can i write a Stored Procedure so as to enter the data in the tables in bulk. Say we have an application through which we can enter the data in some 4-5 tables. For actual testing we need to have a large amount of data being populated in all these tables and its not feasible to do this through the application in a short time. Is there any way out for such a situation so that we can enter the valid data with different confitions in the tables ?
Thanx,
View 1 Replies
View Related
Jun 15, 2004
Hi everyone... sorry, but I'm really new at this! I'm trying to make a table out of an imported Excel file (which is automatically generated as an all-text data type). I wrote a query that takes this excel file and puts it into the format we need (i.e., appropriate column headers, removing "garbage" characters and spaces). Is there any way to format the data going into the table by a specified datatype?
Sorry if this is simplistic or wasting your time, but I'm really stumped :o. However, keep in mind that I started learning SQL this morning and I've already gotten this far :).
View 6 Replies
View Related
May 18, 2004
I'm importing data from a text table, into a temp table, and then on to a final working table. I'm running into difficulty converting data from text into a 'datetime' format. I'm getting the following error:
"Arithmetic overflow error" when trying to convert into a column with the data type "DateTime"
I half expected it to reject all conversions into a Date format because of the source file being in text format, but it allows this conversion in other columns.
If I switch the Data type to 'nvarchar' instead of 'datetime' it converts and pops up with a date format.
My question is: Will this nvarchar that looks like a date behave like a date? For example, if someone tries to perform a calculation with a date format, will the nvarchar suffice, or would it cause problems?
Any ideas?
View 1 Replies
View Related
May 9, 2008
Hi all,
I have 2 conversion related to same table.
a) Date:
I have a table called Table1. It has a field called HDate(nvarchar type). The records are like this;
HDate
H01042008
H01082008
H01102006
H01112008
Each records always start with an H charatcter, the remaining characters always represents date in the format of DDMMYYY.
I want to convert this format into the date format of YYYYMMDD. So once coverted, the record should be as follows;
HDateConverted
2008-04-01
2008-08-01
2006-10-01
2008-11-01
b) In the same table I have another field called NoID of nvarchar type. The records are like this;
NoID
00.
000
001
002
003
004
005
006
007
008
010
I want to convert it to Integer. Once converted the records for above example should be like this;
NoIDConverted
0
0
1
2
3
4
5
6
7
8
10
How can I solve both these conversions?..
Thanks a million for your qucik help.
Zee
View 10 Replies
View Related
May 21, 2008
Hi,
I need to import an excel data to sql table (excel 2003 and sql2005).I created a project in SSIS with appropriate components. Since my data in Excel is in DT_R8 and DT_WSTR format and my SQL data is in DT_I4 and DT_STR format I put a Data Conversion component to convert the data types. It runs without error and doesn't import anything to table!!
Any idea is appreciated
View 1 Replies
View Related
Dec 3, 2007
Hi i've 2 questions.
Q1 . I'd like to know if i have a data conversion before i export my data out to excel will it hold the data types in excel.
Q2. If i sort the data before i export my data out to excel will it hold the sort
View 1 Replies
View Related
Jul 20, 2005
Hi,I have a simple query that does the following :-select desc1,desc2,desc3,desc4,desc5 from testdataSo I select the data for the aboveWhat I would like to achieve without having to go to great lengths thefollowing:-So taking the column desc1 I want to insert this into a tablee.g.Desc1 is record 1 in the tableDesc2 is record 2 in the tableDesc3 is record 3 in the tableDesc4 is record 4 in the tableand so onIs there a tool or a special type declaration that can be used ?RegardsAndrew
View 1 Replies
View Related
Dec 28, 2006
Dear colleagues, I have a big problem with data conversion. For example, on my Windows form (C#) i have one text box and in my table I have field type float. When I use following conversion or casting:
float i = (float)Convert.ToDouble(textBox1.Text);
and insert number 12,3 in my table I have following number 12.30000000000032324!
What I must to do with this conversion and have in my table number 12,3?
View 1 Replies
View Related
Feb 25, 2008
I have created an SSIS package
to run on a SQL 2005 server. This SSIS pkg was migrated from 2000 to 2005. There a Data transform task in that package to transfer data from a tbl on one server to another.
In source tbl, datatype is text, and in dest (2005 tbl) datatype is nvarchar(1000). This data transfer worked just fine , in 2000 but in 2005 it is giving the foll error.
But when I run my package, i get back the following error
'Column "xxx" cannot convert between unicode and non-unicode string data types'.
I tried using the data covnersion task, to convert to DT-STR, But is still failing.
View 11 Replies
View Related
Mar 7, 2008
I currently have a web form that takes a user's social security number. Then I extract the substring of the number to get the last 4 digits. Then i insert the number into a database table. The problem is when I insert the number, if it leads with a zero, the table doesn't recognize the zero. For Example:
PlayerId = Me.SSNBox.Text.ToString 512-58-0897
Id = PlayerId.Substring(5, 4) 0897
Convert.ToInt32(Id) 0897
NewAthleteRow.PLAYER_ID = Id 897
View 4 Replies
View Related