thanks again for your answer.
The business case is the following.
I have a customer card system with partnership capabilities. A partnership can only have one main card and more partner cards.
The system is operating using a CRM system.
Every customer has its own card number and customer number, but a partnership has only one account. That means, every member of the partnership has its own card but all of the cards points to the same account.My challenge:
if the owner of the main card is deactivated (the deactivation is stored in the CRM database), I have to deactivate this customer in a staging db, and I also have to mark all of the partner cards as main cards and their owners as main participants.
I hope I have explained the situation and not created more confusion
I select the contactId, cardId and accountId in the first query, then using an oledb command I update the customer status in the staging db using the Contact ID. I would like to store the accountIds in a variable in order to lookup the cards and customers (the partners) that points to these accounts and finally take the appropriated actions.