I have small doubt in ssis, text file have location data based on location need to create table dynamicaly in sql server and load related location data using ssis package, source text file have sample data like below
id | name | location 1 | abc |Hyd 2 | banu |chen 3 | jai |bang 4 | hari |Hyd 5 |nani |Hyd 6 | banti |bang 7 |kali |chen
based on this text file load we need to create location tables dynamically and load related data.because of some time may have more location in text file that situation we need to create table dynamically and load it.please tell me how to achive this task using ssis.we need foreach loop container but don't how to achive this.please tell me to solve this issue
1) DFT task (Get distinct locations and respective table names)
2) Foreach loop container task(Create tables and store data)
Foreach loop container configuration -
Add SQL Task in container (to create table if it is not present)
"If Object_Id('" + @[User::Locationtable] + "') IS NULL CREATE TABLE " + @[User::Locationtable] + " ( id int, Name Varchar(50) )"
Add DFT task in container (to import data into respective tables)
Note - you will need to provide default value to "User::Locationtable" variable with table name which is present on database and has same schema, so that you can map the columns in second DFT task.