Thank you. The use of SQL Server DATEADD() function, suggested by Borislav, did the job.
>I would always (as it calculates only once, not for every row) subtract the years BEFORE the SQL statement,
>dComparePurchDate = date(year(today)-Years, month(today), day(today))
>
>>
>>*-- The fields in SQL Server table:
>>*-- PurchDate - Datetime
>>*-- Years - Integer (from 1 to 100)
>>dToday = date()
>>cWhereExpr = "'" + DTOS( cToday ) "' >= (PurchDate + Years) "
>>select * from MyTable where cWhereExpr
>>
>>
>>Example: PurchDate is 2018-01-05 and Years is 10. But the record is included in the resulting query.
>>Shouldn't the PurchDate + Years being much higher than the current date?
>>
>>UPDATE: I think my problem is that I have to convert Years into years since SQL Server sees it as Days. But how? Should I multiply the Years by 365? Or there is a better way to convert the int number into years?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham