Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
SolvedPrivate

SSIS output to text file

Posted on 2015-02-02
5
Medium Priority
?
28 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 66

Assisted Solution

by:Jim Horn
Jim Horn earned 450 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 450 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
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.

618 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