I have a request to create an excel report with sheet containing data for a specific employee (1 sheet per employee). I would like to accomplish this by dynamically using variables or parameters. I've used "Execute SQL Task" with both.
However, when ran, I get the following error:
[Execute SQL Task] Error: Executing the query "CREATE TABLE 'Employee' (
Date Created
DA..." failed with the following error: "Syntax error in CREATE TABLE statement.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Your help would be greatly appreciated!
I figured it out... It seems like there may have been a refresh issue or something of the sort. Nevertheless, here's where I ended up:
Copy the Template: the template needs at least one existing sheet for this to work. I copied the file from a template folder to a "Pending" folder.
Insert the List of Employees into a variable: take the employee records and insert them into a variable using "Recordset Destination"
Create Excel Sheet for each Employee: using a "Foreach Loop Container", put a "Execute SQL Task" and Data Flow Task inside then set the Variable Mapping to an empty variable (I used "Employees"). See below for more details
Execute SQL Task
Variable: Sheet Name
Data Flow Task: Excel Destination
Variable: Sheet Name Only
ForEach Loop Container: Collection
ForEach Loop Container: Variable Mapping