0

All: I'm using Visual Studio 2013. I'm at my wits end with this: For some odd reason my package ends abruptly at the highlighted area below (It's supposed to go directly to "Update File Log" execute SQL task but it ends at the previous Script Task and completely ignores it.

Any thoughts? Thanks.

enter image description here

Please see code below. The error I get is that absolutely useless "exception has been thrown by target of an invocation". This occurs at the arrow indicator, right before the sqlcommand fires:

SqlConnection myADONETConnection = new SqlConnection()
myADONETConnection = (SqlConnection)
(Dts.Connections["DBconn"].AcquireConnection(Dts.Transaction) as SqlConnection);

MessageBox.Show(tableDDL.ToString());

SqlCommand myCommand = new SqlCommand(tableDDL, myADONETConnection);  <===
myCommand.ExecuteNonQuery();

MessageBox.Show("TABLE IS CREATED");


//Load the data from DataTable to SQL Server Table.
SqlBulkCopy blk = new SqlBulkCopy(myADONETConnection);
blk.DestinationTableName = "[" + filename + "]";
blk.WriteToServer(dt);

MessageBox.Show("TABLE IS filled");

Here is the tableDDL syntax that is getting created - anyone see an issue?

enter image description here

Craig
  • 145
  • 1
  • 12
  • Does "No - Create table" run? Are your constraints set to "and"? You really need to post a screenshot of the property pages for the constraints. Also reduce to the simplest repro possible 0 i.e. don't post a screenshot with _fx_ indicators if that is not the simplest repro – Nick.Mc Dec 18 '18 at 05:52
  • @Nick.McDermaid:Thanks, I edited the picture to reflect that. And yes, the SQL task (no-create table) does indeed run. – Craig Dec 18 '18 at 06:01
  • Edit: The Script Task (no-create table) runs successfully, not SQL task. – Craig Dec 18 '18 at 06:19
  • Does the script task return a 'success' in it's code? Does the SSIS log indicate that it completed successfully? – Nick.Mc Dec 18 '18 at 06:24
  • I posted the above edit screenshot. I'm not sure what you mean, or how to check. All I know is my table got created and the execution results show the above. Also, if there was a failure I would be notified (big red "X"), no? – Craig Dec 18 '18 at 06:32
  • In your posted log, "Update File Log" is actually run.... although it is not indented where I expect it – Nick.Mc Dec 18 '18 at 06:40
  • Yes, I'm confused. I don't understand what is happening. It stands to reason if there is an arrow from one task to another, the trailing task WILL BE executed unless there is an error. This is extremely frustrating as I have deadlines but can't get past this. – Craig Dec 18 '18 at 06:53
  • In your log, it _is_ executed – Nick.Mc Dec 18 '18 at 06:54
  • thx for the input, but this isn't helping. I've had enough for one night. – Craig Dec 18 '18 at 07:07
  • are you sure you are pointing to right db may be its pointing different db then what you expected – Mani Dec 18 '18 at 08:04
  • @Mani: Now for some reason I'm getting errors where before I was not. I updated my post above with some more screenshots. I show the code where the error occurs, and the DDL syntax that I'm trying to create. Any help will be appreciated. – Craig Dec 18 '18 at 08:21
  • I think I got the error message: I had to delete my connection manager and make a new one. For some reason, that worked. My original problem still stands: I don't know why the Update File Log SQL task is being ignored (highlighted yellow circle above). – Craig Dec 18 '18 at 08:39
  • can you put some dummy script task instead of execute sql task and try to run it – Mani Dec 18 '18 at 09:28
  • Look at your log - it is not being ignored. Your log indicates it is being run. What makes you think it's not running? – Nick.Mc Dec 18 '18 at 10:38
  • Does "Update File Log" expect both predecessors to be completed? If so, it would explain why it doesn't get executed (since only 1 of the predecessors will be executed) – ppijnenburg Dec 18 '18 at 10:38
  • Both sides cannot complete as i bet the f(x) is boolean. Copy the final task and put on both paths – KeithL Dec 18 '18 at 14:02
  • @All: You are correct. Removing one of the paths did the trick. I was under the impression either of the two paths to the last task (update file log) would fire regardless of the path. I think I could solve this by placing the 3 tasks (does table exist, yes, no) in a container and then have a path to the update file log task? Thank you all for your patience. – Craig Dec 18 '18 at 19:46
  • See second sentence of my first comment: _Are your constraints set to and?_ – Nick.Mc Dec 19 '18 at 00:42
  • Both the he "Yes" and "NO" precedent were set to "Logical AND". – Craig Dec 19 '18 at 01:22
  • If you change that to OR then only one of the constraints needs to be satisfied – Nick.Mc Dec 20 '18 at 05:37

0 Answers0