---
schema_version: "1"
id: a9d1beed12a83a9dcb3fa0384d1ed5d9de13cd458338b81ae2f5cf78e322d3ae
title: QueryDefinition
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/guides/mc-apis/querydefinition.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/querydefinition.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 1d32da79f44600e9e182dbe2af55311f39d31d4499664431715b02bdaa43c86d
products:
  - Marketing Cloud Engagement APIs and Programmatic Languages
  - Marketing Cloud
---
# QueryDefinition

The QueryDefinition object represents a SQL query activity accessed and performed by the SOAP API.

- To update a QueryDefinition where the CategoryID is greater than 0, you need the Email | Interactions | Activities | Query | Move permission.
- To start a QueryDefinition using the perform method, you need the Email | Interactions | Activities | Query | Move permission.

## Properties

<!--complex table-->

| Name                  | Data Type                                                | Description                                                                                                                                                                                                                                                                                                                                   |
| --------------------- | -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CategoryID`          | Int                                                      | Specifies the identifier of the folder.                                                                                                                                                                                                                                                                                                       |
| `Client`              | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object                           | Specifies the account ownership and context of an object.                                                                                                                                                                                                                                                                                     |
| `CorrelationID`       | String                                                   | Identifies correlation of objects across several requests.                                                                                                                                                                                                                                                                                    |
| `CreatedDate`         | DateTime                                                 | The date and time when the object was created.                                                                                                                                                                                                                                                                                                |
| `CustomerKey`         | String                                                   | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object.                                                                                                                                                                                                     |
| `DataExtensionTarget` | [InteractionBaseObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/interactionbaseobject.md) object | Indicates data extension to use as a template when auto-generating a new data extension. To ensure that the query activity targets the correct data extension, specify a unique external key for each data extension. For Enterprise 2.0 accounts, the external key must be unique among business unit and enterprise shared data extensions. |
| `Description`         | String                                                   | Describes and provides information regarding the object.                                                                                                                                                                                                                                                                                      |
| `FileSpec`            | String                                                   | Defines the file-naming pattern associated with an activity (valid substitutions include%%YEAR%%, %%MONTH%%, and %%DAY%%).                                                                                                                                                                                                                    |
| `FileType`            | String                                                   | Specifies column delimiter of a file. Valid values include:<ul><li>CSV</li><li>TAB</li><li>Other</li></ul>                                                                                                                                                                                                                                    |
| `ID`                  | Int                                                      | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID.                                                                                                                                                                                                                                                    |
| `InteractionObjectID` | String                                                   | Returns associated ID for activities within the asynchronous process of the overall conversation or program.                                                                                                                                                                                                                                  |
| `Keyword`             | String                                                   | Not used.                                                                                                                                                                                                                                                                                                                                     |
| `ModifiedDate`        | DateTime                                                 | The date and time when the object was last modified.                                                                                                                                                                                                                                                                                          |
| `Name`                | String                                                   | Name of the object or property.                                                                                                                                                                                                                                                                                                               |
| `ObjectID`            | String                                                   | System-controlled, read-only text string identifier for object.                                                                                                                                                                                                                                                                               |
| `ObjectState`         | String                                                   | Not used.                                                                                                                                                                                                                                                                                                                                     |
| `Owner`               | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object                                 | Describes account ownership of subscriber in an on-your-behalf account.                                                                                                                                                                                                                                                                       |
| `PartnerKey`          | String                                                   | Unique identifier provided by partner for an object. This property is accessible only via API.                                                                                                                                                                                                                                                |
| `PartnerProperties`   | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects           | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API.                                                                                                                                                                                                                       |
| `QueryText`           | String                                                   | Specifies text associated with a query definition.                                                                                                                                                                                                                                                                                            |
| `Status`              | String                                                   | Defines status of object. Status of an address.                                                                                                                                                                                                                                                                                               |
| `TargetType`          | String                                                   | Indicates target type for a query definition.                                                                                                                                                                                                                                                                                                 |
| `TargetUpdateType`    | String                                                   | Indicates the target update type for a query definition.                                                                                                                                                                                                                                                                                      |

## Related Items

- [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md)
