Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Question on filtering data in SSIS

Author  Topic 

itmasterw
Yak Posting Veteran

90 Posts

Posted - 2013-03-06 : 08:09:03
Hi,
I am very new to SSIS and trying to learn how to use it, but I formally did do DTS packages. In Dts we would often bring in a text or Excel file and put it into a temporary table. From here we would run sql statements (in a sql component) to filter out cretin things that we wanted.
For example, if we had a file that had First name, Last name, address, City, State, and zip code, we could say give me only the records with zip code 15246. This set would then be sent to a permanent table.
I am able to bring in the file and move the data to the tabel, but I cannot see to apply SQL to filter.
How can I do this in SSIS?

Also, do you have any suggestions as to where, on line, I can go to learn SSIS?

Thank you


ITM

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-06 : 11:45:10
you can specify the filter by using conditional task inside data flow task

Add excel source to point to your excel file (or flat file in case of text file), add a conditional task in between to do filtering. Then place a OLEDB destination for inserting data to your table

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

itmasterw
Yak Posting Veteran

90 Posts

Posted - 2013-03-06 : 12:25:32
Thanks for your help, but I do not see where you would put a SQL statement to create a filter here.

Thank you

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/


[/quote]

ITM
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-06 : 12:30:54
no sql statement for filter. the expression will be written inside conditional task where you'll have all the fields from the source file available. There you can define an output and write an expression like

ZipCode == 15246

then join this output path to OLEDB destination where you populate the table

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

itmasterw
Yak Posting Veteran

90 Posts

Posted - 2013-03-07 : 07:51:26
Well this woudl help but isn't there a way to write sql for really advance filtering? Inthe old DTS packages I was able to write really advance sql statements to query a table; like even using things like CTEs in them. I would be able to use even sql functions like date and string fuctions in Sql statements. There must be a way of ding thei here?

Thank you

ITM
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-07 : 09:06:28
then you've to do it execute sql task in control flow. SSIS has two engines one for control flow and another for data flow as against common engine in dts

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -