1

I need to execute a SELECT query with one variable (in the WHERE clause) from an AS/400 source. I have an OLE DB driver, but it does not seem to support using a ? [error is Exception from HRESULT: 0x80040E10 (Microsoft.SqlServer.SQLTaskConnectionsWrap)]

Obviously, this should be do-able by programmatically editing my SQL (I'm guessing from the Script task), but I'm not sure where in the object model I can find the SQL related to my Data Flow task.

If people have other suggestions entirely, I'm open to that as well, I just need to execute a parameterized query where the value replaces the parameter on the client-side before sending the query over. Thanks!

1 Answer 1

4

Your best bet here is to create a variable to hold your sql statement.

Then set up the variable as an expression to insert your where clause from the variable you were using for your first attempt.

Your expression would be similar to:

="select col1, col2 from table_name where col3 = " + @[User::WhereClause]

Then you can set the data access mode to SQL Command from variable in your OLEDB source, and set the variable name in OLEDB source to the variable you created.

This way, all of the logic that you already have set up to set the where clause variable will still work as you intended.

Sign up to request clarification or add additional context in comments.

2 Comments

Unfortunately I don't have enough rep to upvote your answer, but it worked perfectly. Thanks for your help!
Ahh, done & done! Sorry, still figuring out how this place works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.