I'm currently working on automating a process that doesn't allow me to use iterative macros or In-Database tools. The process is responsible for grabbing data for a user-defined number of calendar years (YearQuantity) based on a user-defined most recent calendar year (Year1). I envisioned this process using a Counter variable (in a SQL statement) to iterate through all of the proper Calendar years, which are included as criteria in WHERE statements.
Here's the SQL code that I thought would work in the Input Data's SQL Editor:
DECLARE @Counter INT
SET @Counter=0
WHILE (@Counter < %Question.YearQuantity%)
BEGIN
SELECT Database.Table.*
FROM Database.Table
WHERE Database.Table.YYYYMMDD LIKE '%Question.Year1%-@Counter %'
Unfortunately, this code doesn't work despite trying various methods with Pre & Post SQL statements. I would greatly appreciate if somebody could share a solution that doesn't use iterative macros or In-DB tools. Thanks!!