• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

Delete one field's data from a table with a relationship

I want to delete the credit card number from the database kept on the server for security purposes. I used a cfquery
<CFQUERY NAME="DeleteCrNo" datasource="database">
DELETE No FROM CustTable  
</CFQUERY>

but the table is related to another table and I get an error cannot be deleted or changed because table 'sales' includes related records.

Can someone tell me how to delete the data from this field?
Thanks!
0
ktjamms2
Asked:
ktjamms2
  • 2
  • 2
1 Solution
 
pinaldaveCommented:
Hi ktjamms2,
1) you need to drop the relations.
If you are deleting them then the relations anyway does not mean to you as you are loosing the information. So you need to remove the realtions.

2) then you can delete them.

Regards,
---Pinal
0
 
pinaldaveCommented:
Hi ktjamms2,

if there is some constrain then you need to remove that constrain also...

Regards,
---Pinal
0
 
ktjamms2Author Commented:
The relationship ties the customer to the item they purchased and therefore necessary. The field is not in both tables
0
 
shooksmCommented:
UPDATE CustTable
SET No = NULL

Or if you no longer want the No column, alter the table and remove it.
0
 
ktjamms2Author Commented:
I need the info from the column. I want to keep the database backed up on some other media and keep the info from being stored in the database on the server.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now