Parameter buttons when using SSIS OLE DB data sources such as:
But when using the ADO source to connect to MySQL, without this parameter button, how to pass parameters to the SQL command of the data stream?
Steps
1. On the Control Flow tab, on the Data Flow task that contains the ADO source, right-click Properties, set Expressions.
2. The property expression Editor is set up as follows:
Properties: Select ADO. NET source. SQLCommand, note that the ADO source is the name of the ADO source, and if you change the component name, here is your custom name. SQLCommand.
Expression: Click the button at the back, fill in your SQL statement and the values passed from the variables and parameters, i.e. @[user in this example::P v_watermarkvalue], then click the Calculate Expression button:
Description: Use the string concatenation method, note "and".
My example here is:
"Select CAST (Date_format (OrderDate, '%y%m%d ') as signed) as DateKey, ' order '. *, BranchOffice. Branchofficename from ' order ' inner joins BranchOffice on ' order '. Branchofficesn=branchoffice. BRANCHOFFICESN where ' order '. OrderDate > ' "+ @[user::P v_watermarkvalue]+" ' "
In this way, the ADO source in the Data Flow task gets the value returned from the Get water mark.
By the way, the value in Get water mark is returned:
1. Defining variables
2. Assigning values to variables
3. Set the result set
SSIS passing Parameters to an ADO. NET source query, passing parameters to the ADO.