Ver originalSELECT date_formatFROM dm_portal_fechaWHERE date_format >= 10000 *datepart(YEAR, dateadd(DAY, -45, getdate())) + 100 *datepart(MONTH, dateadd(DAY, -45, getdate())) + datepart(DAY, dateadd(DAY, -45, getdate())) AND date_format <= CONVERT(CHAR(8), dateadd(DAY, -1, getdate()), 112)ORDER BY 1