QueryDefinition
Represents an SQL query activity that can be executed through the SOAP API in Salesforce Marketing Cloud. Each query definition specifies the SQL text, data extension target, and scheduling information for automated query execution. This table supports query and retrieval operations but does not allow inserts or updates.
Table-Specific Information
Select
The connector uses the Salesforce Marketing Cloud APIs to process the following WHERE clause operators for all but date-time values: =, !=, <>, >, >=, <, <=, IN. For date-time values, only > and < are supported. The connector processes other filters client-side within the connector.
For example, the following (but not only) queries are processed server side:
SELECT * FROM QueryDefinition WHERE ObjectID = 'nzxcaslkjd-123'
SELECT * FROM QueryDefinition WHERE ObjectID IN ('nzxcaslkjd-123', 456)
SELECT * FROM QueryDefinition WHERE CreatedDate > '2017/01/25'
Delete
You must specify the ObjectID in the WHERE clause when executing a delete against this table.
DELETE FROM QueryDefinition WHERE ObjectID = 'nzxcaslkjd-123'
Columns
| Name | Type | ReadOnly | Description |
| ObjectID [KEY] | String | False |
Specifies the system-controlled text string identifier (Id) that uniquely identifies the query definition within the platform. |
| Client_ID | Int | False |
Specifies the Id of the client account that owns or executes the query definition. |
| Name | String | False |
Specifies the user-defined name of the query definition as displayed in automation tools and administrative interfaces. |
| CustomerKey | String | False |
Specifies the user-supplied unique key that identifies the query definition for API operations, imports, and automated activities. |
| Description | String | False |
Provides a detailed explanation of the purpose and behavior of the query definition, including how the resulting data set is intended to be used. |
| QueryText | String | False |
Specifies the SQL query text that defines the records to select, transform, or filter. The platform executes this query against the specified source data extensions. |
| TargetType | String | False |
Specifies the target output type that determines whether the query writes results to a data extension, overwrites an existing target, or appends to an existing data set. |
| DataExtensionTarget_Name | String | False |
Specifies the name of the data extension that is designated as the target for the query results. |
| DataExtensionTarget_CustomerKey | String | False |
Specifies the user-supplied unique key that identifies the target data extension where the query results will be written. |
| DataExtensionTarget_Description | String | False |
Provides a description of the target data extension that clarifies its structure, purpose, or the type of records it is expected to store. |
| TargetUpdateType | String | False |
Specifies the update behavior that is applied when the query writes data to the target (for example, overwrite, add, or update). |
| FileType | String | False |
Specifies the file-delimiter format that applies when exporting query results to a file (for example, 'CSV', 'TAB', or 'Other'). |
| FileSpec | String | False |
Specifies the file-naming pattern that is used when exporting query output to a file. The pattern supports date-based substitutions such as %%YEAR%%, %%MONTH%%, and %%DAY%%. |
| Status | String | False |
Specifies the operational status of the query definition, which indicates whether it is active, paused, running, or has encountered an error. |
| CreatedDate | Datetime | False |
Specifies the date and time when the query definition was initially created. |
| ModifiedDate | Datetime | False |
Specifies the date and time when the query definition was most recently modified. |
| CategoryID | Int | False |
Specifies the Id of the folder that stores the query definition within the account's organizational hierarchy. |