Showing posts with label integration. Show all posts
Showing posts with label integration. Show all posts

Wednesday, March 21, 2012

importing flat files to many tables

I'm trying to input a few thousand flat files into a few thousand tables in a sql database

im using integration services with a for each loop to read all the files in a directory

the problem is i can only insert the data from all the files into one table

does anyone know a way to do multiple tables? maybe using some sort of variable?

Yes you can, although the approach differs based on what you are trying to accomplish. If each file goes to a different table, use table name variable as your data access mode. If you want each file to go to each table, use nested foreach loops. Foreach file, foreach table, input data.

Monday, March 19, 2012

Importing Decimal Data Types into SQL Server 2005

I have a simple Integration Services project and the problem is that decimal fields are importing as real (I'm loosing the digits behind the decimal point).

The project contains a data flow task importing a flat file (.csv) to an SQL Server destination. My .csv file has two decimal type fields. Example:

Field 1: 12345.67

Field 2: .123456

My database table that I'm importing to has two fields. The only way that I can get this data to import is to define the fields as "float" in both the text file and database table. I want the database table fields to be defined as decimal or numeric, not float:

Field 1: decimal(7,2)

Field 2: decimal(6,6)

When all fields are defined as decimal (in both the flat file and database file), I get the following results:

Field 1: 12345.00

Field 2: .000000

How does one import decimal data from a flat file (.csv)?

Thank you in advance!

I answered my own question. My eyes were just not seeing the DataScale property of the Advanced connection manager editor window. Once I plugged in the scale value my decimals imported perfectly.

jn