• Status: Solved
  • Priority: Medium
  • Security: Private
  • Views: 30
  • Last Modified:

SSIS output to text file

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
Nana Hemaa
Asked:
Nana Hemaa
  • 3
3 Solutions
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
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
 
Nana HemaaAuthor Commented:
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
 
Alpesh PatelAssistant ConsultantCommented:
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
 
Nana HemaaAuthor Commented:
Site was more explanatory
0

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now