Expand my Community achievements bar.

SOLVED

Deleting Data from Database Schema

Avatar

Level 3

Hi, 

I am trying to delete Datas inside a database schema using Query and the Update data activity. When I've query the data out, the preview shows 58 records which is correct. However when I run the workflow, it only shows 1 result which is incorrect. The image are as attached. As of now, there is a Primary Key Column called customerId in which currently there are no values inside as I inserted the wrong data. Please let me know what I did wrong and how I could get the result to show as 58 instead of 1. Any suggestion or solutions would be greatly appreciated.

Thankyou

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi,

This does not work for me. However, I use SQL Code activity: 

Delete FROM CusTransactionHist T0 WHERE (T0.sCustomerId IS NULL).

It is the same concept to what you mentioned but using different method.

 

 

Thank you for the suggestion

View solution in original post

4 Replies

Avatar

Level 3

Hi @ChanuteJo 

It seems you are querying a schema where relation with Products is 1:N and there is only one record that has all 58 products associated.

Please, could you share more info about the schema you ar querying in "Product Name is not empty" activity?

Avatar

Level 3

Hi,

So the schema I am try to query is called Transaction History in which has the record that I am trying to delete. The image attached are the Targeting Dimension that I have chosen and the XML of the Schema. 

Thank you

Avatar

Level 3

Hi @ChanuteJo 

I think the issue is with customerID being empty.

 

For the moment, if your goal is to delete all records from Transaction History schema just do this:

1. Use "Product name is not empty" query

2. Add an Update Data activity to delete based on primary key

 

Doing this, as the primary key is the same for all records, you will delete all 58.

 

 

Avatar

Correct answer by
Level 3

Hi,

This does not work for me. However, I use SQL Code activity: 

Delete FROM CusTransactionHist T0 WHERE (T0.sCustomerId IS NULL).

It is the same concept to what you mentioned but using different method.

 

 

Thank you for the suggestion