Showing posts with label final. Show all posts
Showing posts with label final. Show all posts

Sunday, March 11, 2012

Data conversion error

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?It won't convert what's causing this error. You need to do something like this:

SELECT CASE WHEN ISDATE(text_field) = 0 THEN '01/01/01' ELSE CAST(text_field AS DATETIME) END
FROM table

Data Conversion

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.

If they are strings, what are you converting to in SQL Server?|||?|||

Hi,

Lots of different data types the destination table fields are mailny int, bigint varchar, date and decimal

Thanks,

Dave.

|||

Its a lot of fields 300... but doing something flexible as you described I dont know without using code...

In your case I would convert the data directly in the SQL query using CONVERT or using the convertion transform of SSIS...

regards!

|||It's going to be manual somehow... Either you configure the flat file source with the correct data types, or you add a derived column/data conversion component, or you stage the data into SQL Server and write a SQL statement to convert the view.|||

Hi,

I think i've managed to do it, i manualy went through the import using the SQL wizzard and at the final stage saved to an SSIS package copied the data flow ammened it to fit into my project and its running now.

Thanks,

Slash.

Data Conversion

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.

If they are strings, what are you converting to in SQL Server?|||?|||

Hi,

Lots of different data types the destination table fields are mailny int, bigint varchar, date and decimal

Thanks,

Dave.

|||

Its a lot of fields 300... but doing something flexible as you described I dont know without using code...

In your case I would convert the data directly in the SQL query using CONVERT or using the convertion transform of SSIS...

regards!

|||It's going to be manual somehow... Either you configure the flat file source with the correct data types, or you add a derived column/data conversion component, or you stage the data into SQL Server and write a SQL statement to convert the view.|||

Hi,

I think i've managed to do it, i manualy went through the import using the SQL wizzard and at the final stage saved to an SSIS package copied the data flow ammened it to fit into my project and its running now.

Thanks,

Slash.

Data Conversion

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.

If they are strings, what are you converting to in SQL Server?|||?|||

Hi,

Lots of different data types the destination table fields are mailny int, bigint varchar, date and decimal

Thanks,

Dave.

|||

Its a lot of fields 300... but doing something flexible as you described I dont know without using code...

In your case I would convert the data directly in the SQL query using CONVERT or using the convertion transform of SSIS...

regards!

|||It's going to be manual somehow... Either you configure the flat file source with the correct data types, or you add a derived column/data conversion component, or you stage the data into SQL Server and write a SQL statement to convert the view.|||

Hi,

I think i've managed to do it, i manualy went through the import using the SQL wizzard and at the final stage saved to an SSIS package copied the data flow ammened it to fit into my project and its running now.

Thanks,

Slash.

Data Conversion

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.

If they are strings, what are you converting to in SQL Server?|||?|||

Hi,

Lots of different data types the destination table fields are mailny int, bigint varchar, date and decimal

Thanks,

Dave.

|||

Its a lot of fields 300... but doing something flexible as you described I dont know without using code...

In your case I would convert the data directly in the SQL query using CONVERT or using the convertion transform of SSIS...

regards!

|||It's going to be manual somehow... Either you configure the flat file source with the correct data types, or you add a derived column/data conversion component, or you stage the data into SQL Server and write a SQL statement to convert the view.|||

Hi,

I think i've managed to do it, i manualy went through the import using the SQL wizzard and at the final stage saved to an SSIS package copied the data flow ammened it to fit into my project and its running now.

Thanks,

Slash.

Data Conversion

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.

If they are strings, what are you converting to in SQL Server?|||?|||

Hi,

Lots of different data types the destination table fields are mailny int, bigint varchar, date and decimal

Thanks,

Dave.

|||

Its a lot of fields 300... but doing something flexible as you described I dont know without using code...

In your case I would convert the data directly in the SQL query using CONVERT or using the convertion transform of SSIS...

regards!

|||It's going to be manual somehow... Either you configure the flat file source with the correct data types, or you add a derived column/data conversion component, or you stage the data into SQL Server and write a SQL statement to convert the view.|||

Hi,

I think i've managed to do it, i manualy went through the import using the SQL wizzard and at the final stage saved to an SSIS package copied the data flow ammened it to fit into my project and its running now.

Thanks,

Slash.

Data Conversion

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.

If they are strings, what are you converting to in SQL Server?|||?|||

Hi,

Lots of different data types the destination table fields are mailny int, bigint varchar, date and decimal

Thanks,

Dave.

|||

Its a lot of fields 300... but doing something flexible as you described I dont know without using code...

In your case I would convert the data directly in the SQL query using CONVERT or using the convertion transform of SSIS...

regards!

|||It's going to be manual somehow... Either you configure the flat file source with the correct data types, or you add a derived column/data conversion component, or you stage the data into SQL Server and write a SQL statement to convert the view.|||

Hi,

I think i've managed to do it, i manualy went through the import using the SQL wizzard and at the final stage saved to an SSIS package copied the data flow ammened it to fit into my project and its running now.

Thanks,

Slash.

Data Conversion

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.

If they are strings, what are you converting to in SQL Server?|||?|||

Hi,

Lots of different data types the destination table fields are mailny int, bigint varchar, date and decimal

Thanks,

Dave.

|||

Its a lot of fields 300... but doing something flexible as you described I dont know without using code...

In your case I would convert the data directly in the SQL query using CONVERT or using the convertion transform of SSIS...

regards!

|||It's going to be manual somehow... Either you configure the flat file source with the correct data types, or you add a derived column/data conversion component, or you stage the data into SQL Server and write a SQL statement to convert the view.|||

Hi,

I think i've managed to do it, i manualy went through the import using the SQL wizzard and at the final stage saved to an SSIS package copied the data flow ammened it to fit into my project and its running now.

Thanks,

Slash.