Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8956135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:43:14+00:00 2026-06-15T14:43:14+00:00

i have a ssis project, to start with, i have a Foreach File Enumerator

  • 0

i have a ssis project, to start with, i have a Foreach File Enumerator and inside it are multiple tasks. It works flawlessly under normal circumstances, however if there is no file present in the enumerator directory, an error occurs, the question is, how can i make a validation or some sort for it to avoid it throwing an error on runtime? thanks

img links

ssis
http://s15.postimage.org/l41py15aj/ssis.png
error
http://s15.postimage.org/rj0qupc0b/ssiserror.png

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:43:15+00:00Added an answer on June 15, 2026 at 2:43 pm

    You can have a script task before Foreach loop which basically checks for files and directory .Then have a precedence constraint to halt the package if either directory or files is not present .

    Create 3 variables

     Name        DataType   
     Directory   String
     Files       String
     Exists      int
    

    In the script task just check if the directory is present along with the files .You can modify the code if you need to even enumerate the subfolders or check if specific files are present in the folder

    if (Directory.Exists(Dts.Variables["User::Files"].Value.ToString()))
    {
    if (Directory.GetFiles(Dts.Variables["User::Files"].Value.ToString()).Length != 0)
        {
          Dts.Variables["User::Exists"].Value = 1;
         }
                else
                {
                    Dts.Variables["User::Exists"].Value = 0;
                }
            }
            else 
            {
                Dts.Variables["User::Exists"].Value = 0;
            } 
    

    In the precedence constraint check the value for the variable Exists

        Evaluation operation : Expression
        Expression           : @Exists==1 
    

    Update :

    In the script task editor you need to add the variables in the ReadOnlyVariable section in the script tag

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a a project with multiple packages under the SSIS_Packages folder. Can i
I have a SSIS project that queries a database and get item level data.
I have an SSIS project where one of the steps involves populating a SQL
I have inherited a SSIS project. I have never worked with SSIS before, and
On a datawarehouse project with SSIS/SSAS, I have to generate my own time dimension
I have simple SSIS package which reads data from flat file and insert into
I have a simple SSIS Project. In the control flow I have three steps:
I have created an SSIS package and it works great on my dev machine.
I have created an SSISpackage in my asp.net project.To call the ssis package, i
I have a batch file that runs an SSIS job. I have no knowledge

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.