SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


ssis package to create Flat File but if no records returned write "No records to process" in flat...


ssis package to create Flat File but if no records returned write "No records to process" in flat file

Author
Message
bill.mccandlish
bill.mccandlish
Valued Member
Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)

Group: General Forum Members
Points: 71 Visits: 0
I am new to writing ssis packages and am having a problem with creating a flat file.

I need to create a file every hour of records updated since the last time this package was run, but if there are no records found I still need to create the file with a row containing "No records found in the process".

Have been trying use if exists (select ...) Create file else 'write no records found" in file.

any help would be greatly appreciated!
Dan.Humphries
Dan.Humphries
SSCarpal Tunnel
SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)

Group: General Forum Members
Points: 4455 Visits: 1212
In SSIS there is a pretty easy way to do this. In the control tab first do a select count(*) in an SQL task. save the output to a variable. The next step could be one of two paths. if you double click on a trasform path then you can add an expression. If count is 0 then output flat file with text. If the count is > 1 then move to the data flow

Dan

If only I could snap my figures and have all the correct indexes apear and the buffer clean and.... Start day dream here.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search