A Microsoft platform for building enterprise-level data integration and data transformations solutions.
The error message you're receiving suggests that there is an issue extracting the result of your query into a variable of type DBTYPE_STR in your Execute SQL Task. The issue may be related to the way you are using parameters in your query.
One thing to check is whether the parameter you are passing in is the correct data type and size. You mentioned that your input parameter has a data type of varchar(8000), but it would be helpful to double-check that this matches the data type of the parameter in your query. Additionally, if the length of the input parameter is shorter than 8000 characters, you may want to consider using a smaller data type, such as varchar(255).
Another potential issue could be related to the way you are referencing the @SourceTable variable in your query. It looks like you are using dynamic SQL to create a table based on the table name stored in the @SourceTable variable. In your full query, you are using a parameter (?) to pass in the table name, but in your hardcoded query, you are not using a parameter. If the issue persists, you may want to try using a hardcoded table name in your full query to see if that resolves the issue.
Lastly, it's possible that there is an issue with the result set being returned by your query. You mentioned that you set the result set to a single row and saved it in a variable of type varchar(8000). If the result set contains more than one row or if the size of the result set exceeds the maximum length of the variable, this could cause an issue. You may want to check the size of the result set and consider using a larger variable if necessary.
Overall, without more information about your query and package setup, it's difficult to provide a definitive solution. I would recommend double-checking your parameter data types, trying a hardcoded table name in your full query, and verifying the size of your result set. Additionally, if you are still experiencing issues, you may want to look into logging or debugging tools to help you identify the root cause of the issue.