0

I am trying to get the day of a week in a SOQL query but the marketingcloud just shows me this error message:

"Error:'day_in_week' is not a recognized built-in function name."

This is the query I am using in the moment:

SELECT
CreatedDate,
Id
FROM Request__c_Salesforce
WHERE day_in_week(CreatedDate)= 2

Does anybody know how to solve this error?

Best regards!

  • 3
    Marketing Cloud uses SQL not SOQL. Can you clarify what you are using and where? – Adrian Larson Mar 27 '18 at 14:32
  • I am creating a SQL Activity in the automation studio. In the developer guide, it is said that this language is called SOQL or SOSL. Please do not see this as a provocation. If this term should not be correct, please help me to understand why. developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/… – Alexander Schmelzer Mar 27 '18 at 14:40
  • 1
    It's called a SQL activity. That indicates it uses SQL. Of course there is a SOQL Developer Guide but it's not relevant here. We have some frequent MC contributors who can likely help you out. – Adrian Larson Mar 27 '18 at 14:42
  • help.salesforce.com/… This might be a helpful reference. – Tom Callahan Mar 27 '18 at 14:43
  • Yeah I am aware that the name SQL Query Activity is a small hint that it is SQL based. In the first part of the trailheads section, it is said that salesforce defines a the language of a query that contains a "Select" as SOQL. trailhead.salesforce.com/en/modules/database_basics_dotnet/… But I really do not care about the name. What I cared about, is that people can help me to understand the mistake in my code. Nevertheless, I found the answer with your help and searched for "day of the week - sql function". Thank you! – Alexander Schmelzer Mar 28 '18 at 8:20
3

The query that is working:

SELECT
Id,
DateName(dw,CreatedDate) AS weekday
FROM Request__c_Salesforce

Here is a reference for people who are having a similar problem.

https://www.w3schools.com/sql/func_sqlserver_datename.asp

Best regards!

| improve this answer | |
  • Saved my life, thank you for discovering this. – K K Jul 31 '19 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.