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 6842939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:09:48+00:00 2026-05-27T00:09:48+00:00

In SSIS 2008 I have a Script Task that checks if a table exists

  • 0

In SSIS 2008 I have a Script Task that checks if a table exists in a database and sets a boolean variable.

In my Data Flow I do a Conditional Split based on that variable, so that I can do the appropriate OLE DB Commands based on whether that table exists or not.

If the table does exist, the package will run correctly. But if the table doesn’t exist, SSIS is checking metadata on the OLE DB Command that isn’t being run, determine the table isn’t there, and failing with an error before doing anything.

There doesn’t seem to be any way to catch or ignore that error (e.g. I tried increasing MaximumErrorCount and various different ErrorRowDescription settings), or to stop it ever validating the command (ValidateExternalMetadata only seems to affect the designer, by design).

I don’t have access to create stored procedures to wrap this kind of test, and OLE DB Commands do not let you use IF OBJECT_ID('') IS NOT NULL prefixes on any statements you’re doing (in this case, a DELETE FROM TableName WHERE X = ?).

Is there any other way around this, short of using a script component to fire off the DELETE command row-by-row manually?

  • 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-05-27T00:09:48+00:00Added an answer on May 27, 2026 at 12:09 am

    You can use Script component to execute DELETE statement for each row in input path but that might be very slow depending on number of rows to be deleted.

    You can:

    1. Store PKs of records that should be deleted to a database table (for instance: TBL_TO_DEL)
    2. Add Execute SQL Task with SQL query to delete records by joining TBL_TO_DEL with table that You want to delete records from
    3. Put precedence constraint on path between your data flow and Execute SQL task (constraint based on your variable)

    This solution is much faster than deleting row by row.

    If for some reason You can’t create new table, check my answer on SSIS Pass Datasource Between Control Flow Tasks to see other ways to pass data to next data flow where You can use OleDb source and OleDb command. Whichever way You choose, key is in constraint that will or will not execute following task (Execute SQL task or data flow) depending on value in variable.

    Note that Execute SQL task will not validate query and as such will fail at runtime if constraint is satisfied and table doesn’t exist. If You use another Data Flow instead of Execute SQL Task, set DelayedValidation property to true. It means that task will be validated at the moment prior to executing particular task, not anytime earlier.

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

Sidebar

Related Questions

I have an SSIS 2008 package that reads data from an Access database (OLEDB
I have a script task (VB 2008) inside an SSIS dtsx package that I'm
I have created a basic Data Flow tasks in SSIS 2008 that is reading
I have a script component in SSIS on SQLServer 2008 R2, that needs to
I have a SSIS 2008 script component which is setup as a transform (so
I have an Execute SQL task (SQL 2008) where I'm using two SSIS variables
I have an SSIS package, which depending on a boolean variable, should either go
I have a [SQL 2008] SSIS package that takes a CSV text file and
I am using SSIS in Visual Studio 2008. I have many XML files that
We have an SSIS package that ran in production on a SQL 2008 box

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.