0

I am trying to query two synchronized data extension and update the result to a data extension

select
O.CloseDate,O.StageName,O.Id,
P.Contact__c.Id,P.Id
From Plot__c_Salesforce P Join Opportunity_Salesforce O 
On P.Opportunity__c.Id = O.Id

But i am getting a syntax errors

An error occurred while checking the query syntax. Errors: Cannot call methods on nvarchar.

An error occurred while checking the query syntax. Errors: Incorrect syntax near ')'.

What i am doing Wrong Could anyone suggest me.

0

I think the issue is that your fields have '.' periods in them. This is reserved for use of table alias association with fields, mostly used in joins, (e.g. tableA.field = tableB.field) which is causing a syntax issue on those with periods in the field name.

Likely to get around this you should use brackets to escape all the chars inside your field name. See below:

select
O.[CloseDate],O.[StageName],O.[Id],
P.[Contact__c.Id],P.[Id]
From [Plot__c_Salesforce] P Join [Opportunity_Salesforce] O 
On P.[Opportunity__c.Id] = O.[Id]

I added the brackets to all of your fields and DEs for the example, but you technically only need to do so on the ones that could break the SQL syntax.

  • Hi Gortonigton Thanks for ur Answer. If i update the above SQL i am receving this error . An error occurred while checking the query syntax. Errors: [Plot__c_Salesforce] is not a known data extension or system data view. You can only query existing data extensions or system data views. – sfdcbeginner Oct 26 '18 at 10:15
  • check to see if this requires the ent. prefix (shared DE, etc) - which is required if you are referencing a DE inside the parent account from a child BU. – Gortonington Nov 13 '18 at 13:47

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.