SolvedPrivate

SSIS output to text file

Posted on 2015-02-02
5
22 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Lessons learned during ten years of interviewing for SQL Server Integration Services (SSIS) and other Extract-Transform-Load (ETL) contract roles and two years of staff manager interviewing contractors.
Here's a requirements document template for an integration project (also known as Extract-Transform-Load or ETL) based on my development experience as an SQL Server Information Services (SSIS) developer over the years.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

785 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