0

This is my query:

SELECT FirstName
FROM Account_Salesforce
WHERE (dateadd(year, (2020 - year(PersonBirthdate)), PersonBirthdate) >= dateadd(day, 7, GetDate()) AND dateadd(year, (2020 - year(PersonBirthdate)), PersonBirthdate) <= dateadd(day, 14, GetDate()))

This query should give me people who have their birthday on the 28th of February, until the 6th of March. However it is giving me from the 29th and onwards, I am missing the 28th.

Any ideas?

1
  • I'm not very familiar with marketing cloud, but it might be a time zone problem? It's tomorrow in some places
    – Kasper
    Commented Feb 21, 2020 at 15:15

1 Answer 1

1

I believe the problem could be that when using GetDate(), it includes the time while the values stored for PersonBirthdate would not have time so the calculated date would be something like '2020-02-28 09:22:37.113' instead of '2020-02-28 00:00:00.000'

The date 7 days in the future without time can be obtained using something like:

select dateadd(dd, datediff(dd, 0, GETDATE()), 7)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .