dan
dan

Reputation: 5784

Is there a way to use SSIS to execute SQL statements that are stored in an Excel file?

I am using Excel to generate a whole slew of INSERT statements, similar to the process described here.

I would like to have an SSIS package that will run through each row of this excel file and run the SQL statements it finds against a database.

Is this possible?

EDIT:

As John points out - there is a better way to do it - generate the insert statement in SSIS instead of Excel. (I'm just getting my head into SSIS).

Upvotes: 0

Views: 1397

Answers (1)

John Saunders
John Saunders

Reputation: 161773

I'm sure it's possible, if a little silly. Why not generate the INSERT statements inside of SSIS?

At any rate, I suppose you'd get an Excel connection manager, use it in an Execute SQL Command task to SELECT the column with the INSERTS from Excel, and output the results to a Recordset. You'd then use a ForEach task to iterate over the recordset, putting each INSERT into a variable. Use the variable to configure an Execute SQL Task inside the ForEach task.

Upvotes: 4

Related Questions