0

Any one please help me to update column name from _ContactKey to ContactKey i.e removing the _(underscore) through query activity in marketing cloud.

Thanks, Rajesh

  • Could you provide some background info? From where are you querying (which tool) and how does your query look like? – Guy Clairbois Aug 5 '16 at 12:30
  • Sounds like a Synchronized Data Extension? I know those always include a _ContactKey field. It's a system generated field that can't be updated, not sure why you would need / want to either. – AnonWonderer Aug 5 '16 at 22:48
1

In your Query Activity, you will need to use an SQL alias to rename the column heading to match the ContactKey field in your target Data Extension. For example:

SELECT _ContactKey AS ContactKey,
Field1, Field2, Field3
FROM DataExtensionName

Replace FieldN with the other fields required in your query.

| improve this answer | |
  • Thanks for ur quick reply. Below is the query I tried select id,_contactkey,_contactkey as contactkey from user_salesforce and I select the target as user_salesforce and update type as Update. but, it showing error like "Error saving the Query field.The Target Data Extension must have at least one primary key field." Please help on this. Thanks, – Rajesh Aug 8 '16 at 14:09
  • Query activities that use an update type require one or more primary keys in the target Data Extension. Edit the target Data Extension and assign a field (or fields) as a primary key, where the field is unique. For example if the contactkey field will always be a unique value in your Data Extension, then make that a primary key. Alternatively, change your query type to Overwrite as this will not require a primary key in your target Data Extension. – Eliot Harper Aug 8 '16 at 22:10
  • Synchronized Data Extensions properties not able to edit. Need to ask for support team? – Rajesh Aug 9 '16 at 9:37
  • Oh, you didn't say it was a Synchronized Data Extension. I'll have to check but I'm pretty sure you can't add records to Synchronized Data Extensions. What exactly are you trying to achieve? Are you trying to upload data back to Sales Cloud? – Eliot Harper Aug 9 '16 at 10:08
  • I would need to use a query activity and change the column name of _Contactkey to an alias as something that does not start with an underscore to allow the import to work properly. – Rajesh Aug 9 '16 at 13:22

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.