SolvedPrivate

SSIS output to text file

Posted on 2015-02-02
5
21 Views
Last Modified: 2016-02-15
Looking for an easier way to accomplish this in SSIS.  
if number of  rows  in a table CUSTOMER  is 3 or less  ie count(*)  < = 3  write a blank  textfile to  c:\customerinfo.txt else select * from
Customer  to c:\customerinfo.txt
0
Comment
Question by:Nana Hemaa
  • 3
5 Comments
 
LVL 65

Assisted Solution

by:Jim Horn
Jim Horn earned 150 total points
ID: 40585645
In your data flow task that pumps table Customer add a Row Count control, and assign the resulting row count to a variable.

Then in the next control flow, add a precedence constraint that tests the value of that variable, i.e. @@variable_name >= 3, and have the 'true' arrow go to the part that writes the blank text file, 'false' arrow go to the part that SELECT *
0
 

Author Comment

by:Nana Hemaa
ID: 40586743
I added the row count control.   can you explain further how to write the blank text file...

--add a precedence constraint that tests the value of that variable, i.e. @@variable_name >= 3, and have the 'true' --arrow go to the part that writes the blank text file,
0
 
LVL 21

Assisted Solution

by:Alpesh Patel
Alpesh Patel earned 150 total points
ID: 40597754
Hi,

Take rowcount in Variable and using that variable create Source expression and add where condition to that

'select * from
Customer Where ' +
case when variablevalue > 3 then '1=1'  else = '1=2' end
0
 

Accepted Solution

by:
Nana Hemaa earned 0 total points
ID: 40606292
0
 

Author Closing Comment

by:Nana Hemaa
ID: 40613817
Site was more explanatory
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how the fundamental information of how to create a table.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now