I am loading data from a MySQL data table. The table has a large text column, and when the number of records is over 15,000 the SSIS connection times out. So I thought I would try bringing the data over in blocks. I created a query to get the number of records from the source table and create an object containing starting and ending record numbers until all the records are accounted for. Then I set up a For-Each control to read the data in. I used an expression to define the query and it creates a query that contains the starting and ending record numbers I need. I can evaluate the expression and paste it into MySQL and it works just as intended.
Everything would be great except for the fact that I have to use MySQL variables in the query. And even though the variable name is between the quotes, when SSIS actually tries to execute the query it tells me that the parameter @curRow
must be defined, but that variable is for use in MySQL. Anyone have any ideas how to get around this? My first thought was to create a string variable in the package named curRow
The expression I am using is:
"SELECT id,
report_html,
CASE
WHEN `TimeStamp` < '1900-01-01 00:00:00'
OR `TimeStamp` IS NULL THEN
CAST('1900-01-01' AS DATETIME)
ELSE `TimeStamp`
END AS `TIMESTAMP`,
@curRow := @curRow + 1 AS row_number
FROM corp_inv, (SELECT @curRow := 0) AS r
HAVING row_number BETWEEN " + (DT_STR, 6, 1252) @[User::LoVal] + "
AND " + (DT_STR, 6, 1252) @[User::HiVal] + ";"
And the query created by the expression (which does pull up the 3,999 records in MySQL) is:
SELECT id,
report_html,
CASE
WHEN `TimeStamp` < '1900-01-01 00:00:00'
OR `TimeStamp` IS NULL THEN
CAST('1900-01-01' AS DATETIME)
ELSE `TimeStamp`
END AS `TIMESTAMP`,
@curRow := @curRow + 1 AS row_number
FROM corp_inv, (SELECT @curRow := 0) AS r
HAVING row_number BETWEEN 1
AND 3999;