12

How can I have an SSIS data flow create a table that doesn't exist? Every time I try to run the package, it gives me an error saying that the destination table doesn't exist.

2 Answers 2

14

Since you want your package to create a table and then populate it, you can create one using the Execute SQL task. Just give it the script to create your table.

If you do not have the option of using an Execute SQL or Script task, then you can use a Script Component, but since it executes for every row, you'll have to get creative to have it execute only once.

Also, when you run this package, SSIS going to crib about the table not being found during Validation.

To counter that, in the package properties, in data-flow that populates the table, set Delay Validation property to True

Sign up to request clarification or add additional context in comments.

1 Comment

See comment on HLGEM's answer.
7

WHy not create the table in the step before the dataflow in an execute SQL task?

3 Comments

I have to import data from a fixed-width flat file and I kept getting errors with the bulk insert task, so I figured this would be a lot easier.
If the file will always have the same structure, then simple create the table in a separate script that you run once. Then the table is there when you do the insert. I alawys create needed objects outside the SSIS package if I want to reuse them.
But for some reason, I can't bulk insert into the table because it doesn't like the layout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.