DanishCoder
asked on
Make sure a database is clean for a specific ID
Dear experts,
I'm building an administration system in Classic ASP, and that include profiles.
Now I have a lot of profiles, and some IDs are registered in several tables.
If I delete a profile on the member's list (table1), I will do like this:
...and that profile will be deleted in the table1!
But the ID of that person may be registered in other tables as well.
How do I make sure that when the record is deleted in table1, following will also happen:
In table2: Only update the existing record (remove the profile's ID)
In table3: Find all the records with the deleted profile's ID and delete the rows containing the profiles ID.
It will also occur that the deleted ID in table1 doesn't exist in any other tables.
Thanks in advance!!
/DanishCoder
I'm building an administration system in Classic ASP, and that include profiles.
Now I have a lot of profiles, and some IDs are registered in several tables.
If I delete a profile on the member's list (table1), I will do like this:
DeleteProfileSQL = "DELETE FROM [table1] WHERE [id] = " & Request.QueryString("id")
Conn.Execute(DeleteProfileSQL)
...and that profile will be deleted in the table1!
But the ID of that person may be registered in other tables as well.
How do I make sure that when the record is deleted in table1, following will also happen:
In table2: Only update the existing record (remove the profile's ID)
In table3: Find all the records with the deleted profile's ID and delete the rows containing the profiles ID.
It will also occur that the deleted ID in table1 doesn't exist in any other tables.
Thanks in advance!!
/DanishCoder
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@ramrom
Yes, seems like that was what I was looking for - I just didn't know if there was a better or quicker solution. What I have is:
1. A member table, where the profile is registered, its ID is used in the group table, and volunteer table.
2. A group table, where I need to update the member's ID to 0 or '' when not entered (the group doesn't disappear because a profile in the member's table is deleted).
3. A volunteer table, where I would need to delete the row containing the member's ID
@padas
In this situation I know the table structure, and I suppose you will always know that, as you are the one who builds the table structure - and as ranrom said, both solutions seems to be the same.
Thanks for your time and expertise :)
DanishCoder
Yes, seems like that was what I was looking for - I just didn't know if there was a better or quicker solution. What I have is:
1. A member table, where the profile is registered, its ID is used in the group table, and volunteer table.
2. A group table, where I need to update the member's ID to 0 or '' when not entered (the group doesn't disappear because a profile in the member's table is deleted).
3. A volunteer table, where I would need to delete the row containing the member's ID
@padas
In this situation I know the table structure, and I suppose you will always know that, as you are the one who builds the table structure - and as ranrom said, both solutions seems to be the same.
Thanks for your time and expertise :)
DanishCoder
Other than that our solutions seem to be the same.