Selecting From Data Extensions in SalesforceMarketingCloud
The driver offers the possibility to select, insert, update, and delete data from data extensions as relational tables. To query a data extension, simple enter its name in the format DataExtensionObject_Name where Name is the name of your data extension.
Selecting data from data extensions
SELECT * FROM DataExtensionObject_fsefes3
SELECT * FROM DataExtensionObject_fsefes3 WHERE FieldName1 = 'One'
Note 1: All filters which work with normal tables/views also work with data extensions.
Note 2: By default the Salesforce Marketing Cloud retrieves data for the LoggedIn ClientId. To retrieve results for more than one ClientID, use semi-colons (;) as a separator. The ClientID can be accounts and sub-accounts, including Enterprise 2.0, On-Your-Behalf, and Lock & Publish accounts.
SELECT * FROM DataExtensionObject_fsefes3 WHERE ClientID = '1234567'
Inserting data into data extensions
INSERT INTO DataExtensionObject_fsefes3(FieldName1, FieldName2, FieldName3) VALUES ('One', 'Two', 'Three')
Updating data from data extensions
UPDATE DataExtensionObject_secondtest15 SET [Name] = 'ChangedFromTheApi' WHERE [Email Address] = '[email protected]'
Note: A primary key has to exist for this data extension for the update to work.
Deleting data from data extensions
DELETE FROM DataExtensionObject_secondtest15 WHERE [Email Address] = '[email protected]'
Note: A primary key has to exist for this data extension for the deletion to work.