|
I have some data in following structure.I want to split the data such a way where ac_no wise database will create & part_no wise table will be created on respective ac_no.
how can i do this in ssis
(comments are locked)
|
|
I think will be better solved with dynamic SQL. Granted, you could run the SQL inside SSIS using an Execute SQL task. I have written two potential solutions to your question, but neither is tested. If you have problems, please respond with comments. You won't need this, but here's the SQL I used to create a table variable with the sample data you provided:
Here's the code you will need to do what you want. Just change
If you really want to use an SSIS Data Flow, you could do this with a script task inside the data flow. In that case, I would override the Input0_ProcessInput method instead of using Input0_ProcessInputRow. Here's a partial example:
You'd still need to execute dynamic SQL for the database and table creation. thanks for ur pely. But if table is already exist.it is not goinf for next database or table creation
Mar 12 '10 at 06:00 AM
Debasish
Tom, I'd upvote you twice if I could for the amount of effort you've put in here
Mar 12 '10 at 10:23 AM
Matt Whitfield ♦♦
Thanks, Matt. I guess it was one of those problems I just really wanted to solve. :)
Mar 12 '10 at 10:47 AM
Tom Staab
(comments are locked)
|
|
hi toma, thanks for your immediate reply. i am not able to understand where you mention dynamic sql to create database. what i have to write there?actually i have 294 ac_no. Plz help me. show mw one example.
(comments are locked)
|
|
plz give some advice
(comments are locked)
|


Not enough detail, Debashis. What do you want in the database? Just the Part_No table? What do you want the Part_No table to look like so far as datatypes for each column and what do you want for indexes? Considering that the databases are based on AC_No, what do you want the database name to look like?
Last but not least, why do you want a separate database for each AC_NO especially since it will only have one table in each?
i want database name as AC001 IF AC_NO IS 1 & TABLE NAME AS AC001PART01 IF PART NO IS 1
I updated my answer to include everything you need.
I modified my code to order the incoming data. That will guarantee databases and tables are created as needed, and all data for a given table is inserted immediately after the table is created.