Inserting into database table .and database name depends on DealershipId from csv table.how do i choose database name based on csv file input
-
Friday, May 11, 2012 7:05 PM
hi,
i want to insert data into a particular database table.
the database is selected based on dealership id
for ex dealershipid 123 is in database A
dealership id 150 in database B
i am importing the dealershipid from flat file.
i have taken a oledbcommand to select the database name based on filefile input dealershipid
i have given query in oledb command like :select dbname,servername from tablename where dealershipid=?
now my question is how do i capture the selected dbname and server name and insert the data in that selected server database
Thanks
akhila
- Edited by sql learner12 Friday, May 11, 2012 7:08 PM
All Replies
-
Friday, May 11, 2012 7:11 PM
Are there a finite number of dealerships? If so then I'd just use a series of conditional splits and redirect the rows to the correct destination component.
If the dealership list and mappings change over time then I would use a SSIS script destination and handle the individual inserts there where you can easily alter the connection string to suit the record.
Option 3 would be to build a process to split the files by dealershipID so that you could set the destination connection at the start of file processing and use a standard destination component for the entire file.
Chuck
- Marked As Answer by sql learner12 Friday, May 11, 2012 7:16 PM
-
Friday, May 11, 2012 7:15 PMThanks chuck..ill try using the script component :)
akhila

