0

I have requirement to create automatically columns in sql server table using ssis or sql.(you can suggest)

Scenario is like this,

In ODBC Source table I have 10 columns. Using SSIS transformations I am importing 10 columns data into my destination SQL server table.

On second day I have 12 columns in source.....(Here is the problem) Now I need 12 columns in destination also and number of columns always increment everyday.

How can I handle this using any tool or code ....Please suggest.

Thanks in advance ...

4
  • and on the third day you have 13 columns? SSIS doesn't play well with this situation. It needs consistent metadata. (i.e. column count and data types). Can you explain the nature of this data? Is there an upper limit to the number of columns that will dynamically appear? Commented May 2, 2016 at 7:20
  • No there is no limit ....because its source...but it not more than 10 columns everyday. Commented May 2, 2016 at 7:31
  • You can suggest other tool also or any other method Commented May 2, 2016 at 7:31
  • SSIS is definitely unsuitable for this. If you are comfortable with C#, write a C# console app. This kind of 'add a column to a table every table' seems like a bad design. You should normally be adding a row not a column. Commented May 2, 2016 at 12:48

2 Answers 2

0

You can create BIML and do automation using C# to generate ssis package.

More details are available at below link

Automatically generate SSIS package from BIML script

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

Comments

0

@Nick.McDermaid already said it, but adding columns dynamically to a table is a really bad design decision. For one thing, it'll cause no end of problems when you try to work with the data in the table. How will you know when a blank column means "unknown", means "no data in this load", or "this column didn't exist in the load"?

1 Comment

there is no issue with design, the requirement is like this, for the same i am looking for dynamic column create solution ..and the the table is staging table

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.