Skip to main content

#SQL For SFMC0 debatiendo

Hi all,

 

I recently found a great Linkedin Learning training on "SQL 101". The material was presented in a very easy to understand way and the examples & use cases were very practical. The format is a set of scenarios of increasing complexity, which teaches you how to critically think about what kind of data you're looking to pull in order to answer a business question, followed by the code that would be required. 

 

I found this method very helpful, as other resources I've looked at tend to be either too high level or too code-snippet oriented to be useful for someone new to SQL.

 

Link: https://www.linkedin.com/learning/sql-essential-training-20685933 (Requires a paid Linkedin subscription).

 

#Marketing Cloud #SQL For SFMC #Data Management

0/9000

Hello,

 

I am not able to run queries in query studio, after query when I am clicking on run button query is not processing also other options like save, open, save as these functions also not working. I have raised this issue with Salesforce team but from their end it is working for my account. I cleared the cache and browser but its not working also my 2 colleagues are facing same issue but it is working for my other colleagues. 

 

Looking for an App exchange help.

Thank you in Advance!

 

#SFMC Implementation #Query Studio #SQL For SFMC #SFMC

0/9000
1 respuesta
  1. 3 abr 2023, 10:52

    Hello @Anirudh Venugopal Warrier,

     

    Primary key violations occur when an attempt is made to insert a record with a primary key value that already exists in the table. Here are a few ways to resolve primary key violations in SQL queries:

    1. Check the input data: Ensure that the input data is correct and does not contain any duplicate values. If the input data is coming from a file or another database, verify that it is correct and does not contain any errors.
    2. Use a MERGE statement: Use a MERGE statement to update existing records and insert new records. A MERGE statement can be used to perform both INSERT and UPDATE operations in a single statement.
    3. Use a subquery: Use a subquery to check if the record already exists before inserting it. The subquery can check for the existence of the primary key value in the table and return a boolean value that can be used to determine whether to insert the record or not.
    4. Use an UPSERT statement: An UPSERT statement is a combination of an INSERT and an UPDATE statement. It will try to insert a record, and if it already exists, it will update the existing record.
    5. Use a transaction: Wrap the INSERT statement in a transaction to ensure that the primary key violation is caught and handled correctly. This will ensure that the entire operation is either committed or rolled back in case of an error.
    6. Remove the primary key constraint: If you do not need the primary key constraint, you can remove it from the table. However, this is not recommended as it can lead to data inconsistencies and make it difficult to maintain the integrity of the data.

    By using one of these methods, you should be able to resolve the primary key violation issue in your SQL query. 

0/9000
2 respuestas
  1. Nobuyuki Watanabe (NAC / FPT Japan Holdings Group) Forum Ambassador
    3 abr 2023, 8:39

    If you want to know the records of the remaining paths, update a Marketing Cloud contact record in Journey Builder using the "update contact" activity. And you can query the DE.If you want to know the records of the remaining paths, update a Marketing Cloud contact record in Journey Builder using the

0/9000

Hi Team,

 

Actually I'm pulling the records exact 4 days before the meeting date on daily basis whose RSVP = 0. IF the meeting date comes on Wednesday or Thursday , since these records will fall under Saturday and Sunday . i just need those records to be pulled on Friday only. (On Friday i need Friday , Saturday and Sunday records)

 

WHERE

(DATENAME(dw, T1.[Meeting Start Date]) ='Wednesday' OR

DATENAME(dw, T1.[Meeting Start Date]) ='Thursday')

AND T1.[Meeting Start Date] >= GETDATE()

AND T1.[Meeting Start Date] <= DATEADD(WEEK, 1, GETDATE())

 

what needs to be chaged in the query

0/9000

Hi Team,

 

Can any one helps me to identify the weekdays and weekends from SQL for SFMC.

 

Thanks

Sharath

0/9000