Monday, August 11, 2014

Step types: Export

Hey!

Now, I am continuing Step Types blog post series with the step type Export. Before this one, I wrote about Query and Object step types.

Object step type differs from the Query and Object step types in terms of compatibility and of course functionality. This step type -at least in this major version of TransSQL- is incompatible with the others. Export step type must be the only step in a package. So what can you do with an Export step? Actually the name tells about itself, it's used to export some records/rows from a source table to another at the target.

When you choose the Export step type from the Type drop down box, a similar screen appears as shown below.

Export step type screen image.

When you click on the small down arrow button at the right side of the Source table drop down list, you can see the table list from the source database and select one to export its records to another existing table at the target database.

When you click on the down arrow of the Source table drop down box, table list appears with their schemas.
These tables are from the source database.

When you choose a table name to export, then the export query is created for you automatically. You can also edit this query to add some filtering criteria such as

... WHERE [EmailAddress].[ModifiedDate] > '01.01.2009';

There is another informational box whose caption is "Row count" and it shows the total row count of the selected table in this step type. You will probably remember this box from the Query step type too, however in Export step type you can not modify this value, it's read-only. It is calculated automatically in this case. As I said, it's used only for informational purpose for this step type. With this in mind, if you add some criteria to the Export query which changes the number of the rows to be affected, then in the Package Content window you will see that the row count value will be calculated on the fly.

In this screen shot Person.EmailAddress table has been chosen from the "Source table" drop down list.

Target table name is automatically filled with the same schema and table name, however you can change it if the target schema or table name differs from the source schema or table name.

There are two options for IDENTITY_INSERT setting and table trigger if there is any on the target table.

Identity_insert: If you choose ON for the Identity_insert then the Identity values of the source table will be preserved; otherwise, if it's OFF new values will be used at the source table.

Trigger at the target: If Disabled is selected in the "Trigger at the target" option, then the triggers at the target table (if there's any) will not be triggered while the records are imported into the target table. Otherwise the triggers will be triggered as expected.

In this version of TransSQL, you must create the table schema at the target database before exporting data into it.

Now there is one step type left to look into and it is called List. I will talk about it the next time.

Thanks for your time!
Ekrem Onsoy

No comments:

Post a Comment