Showing posts with label couple. Show all posts
Showing posts with label couple. Show all posts

Friday, March 23, 2012

Importing multiple flat files to multiple tables in SSIS

I have a couple of hundred flat files to import into database tables using SSIS.

The files can be divided into groups by the format they use. I understand that I could import each group of files that have a common format at the same time using a Foreach Loop Container.

However, the example for the Foreach Loop Container has multiple files all being imported into the same database table. In my case, each file needs to be imported into a different database table.

Is it possible to import each set of files with the same format into different tables in a simple loop? I can't see a way to make a Data Flow Destination item accept its table name dynamically, which seems to prevent me doing this.

I suppose I could make a different Data Flow Destination item for each file, in the Data Flow. Would that be a reasonable solution, or is there a simpler solution, or should I just resign myself to making a separate Data Flow for every single file?

In an OLEDB destination you can select to use a "Table or view name from variable" -in this way the destination can be dynamic.

|||Thanks, I missed that.|||

Any suggestions on the best way to assign the destination table name variable?

I imagine could do it in a Script item in the Foreach Loop before the Data Flow item is executed, but is there somewhere to do it more in-line, like building it into the Data Flow item's properties somehow?

|||

Use some logic to derive the table name based on the format, which I guess must be derivable from the filename?

You have the filename, so how do you expect to transform this into a table name. I would expect an expression to be used somewhere, the tablename variable for example, but you may need to refer to some logic table. an Execute SQL Task inside the loop could query a SQL table that gave you the destination table from a filename. The Exec SQL Task result could then be assigned to the tablename variable.

Monday, March 19, 2012

Importing DTS From 2000 to 2005

Hi, I'm getting slightly frustrated...!

I've imported a couple of DTSs from 2k to 2005, now I know that they are stored in MSDB and I know that I need to export them to a file before I can work on them in SSIS.

The problem is:

How do I export them to a flat file? I've looked everywhere and it's driving me nuts!

Also I can't seem to find out how to delete them either?! I can see the data sotred in the dtspackages90 table but how do I edit/get rid of them.

Help!

SQuirreLs_r_nutz wrote:

Hi, I'm getting slightly frustrated...!

I've imported a couple of DTSs from 2k to 2005, now I know that they are stored in MSDB and I know that I need to export them to a file before I can work on them in SSIS.

The problem is:

How do I export them to a flat file? I've looked everywhere and it's driving me nuts!

You need to import the package into an existing SSIS project. Then, in Solution Explorer, right-click on "SSIS Packages" and select "Add Existing Package". From there you'll get a dialog box from which you can import your package.

Also I can't seem to find out how to delete them either?! I can see the data sotred in the dtspackages90 table but how do I edit/get rid of them.

Help!

There are two ways to manage packages: SQL Server Management Studio and Dtutil. Either of these tools can be used to delete packages stored in MSDB.

Sunday, February 19, 2012

Importing a text file

I am trying to import a text file into an existing table using the DTS
wizard. I am having trouble getting it to accept a couple of date fields. Is
there a date format that the wizard will accept? If not, how should I
import date fields?
Thanks,
Tim
Hi,
Before I comment anything, can you please copy and paste the data (10 rcords
will do)
in the date column inside the text file.
Thanks
Hari
MCDBA
"Tim" <vbopen@.yahoo.com> wrote in message
news:eAxBov0VEHA.1012@.TK2MSFTNGP09.phx.gbl...
> I am trying to import a text file into an existing table using the DTS
> wizard. I am having trouble getting it to accept a couple of date fields.
Is
> there a date format that the wizard will accept? If not, how should I
> import date fields?
> Thanks,
> --
> Tim
>
|||Hari,
Thanks for the reply.
The problem was that there were some records that did not have a date and
just had " / / ". I edited the file and replaced them with a dummy date and
it imported fine.
Tim
"Hari" <hari_prasad_k@.hotmail.com> wrote in message
news:eCEZQ$1VEHA.2928@.tk2msftngp13.phx.gbl...
> Hi,
> Before I comment anything, can you please copy and paste the data (10
rcords[vbcol=seagreen]
> will do)
> in the date column inside the text file.
> --
> Thanks
> Hari
> MCDBA
> "Tim" <vbopen@.yahoo.com> wrote in message
> news:eAxBov0VEHA.1012@.TK2MSFTNGP09.phx.gbl...
fields.
> Is
>