Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to delete records located on several tables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-04-13 : 07:23:07
Joselito writes "I am working on a database built on SQL Server 7 with many tables. my problem is on how can i delete record(s) located on different tables having conditions like the following:
1. first input the TDNumbers value in a table then after searching for the TDNumbers get the strDeclarationID field.
2. create a query of the value of the strDeclarationID then find/locate it in other tables that will matcgh but this time around the field is not strDeclarationID but something like RootID in the 3 other tables and, ParentID in one table, and ObjID in another table. All selected tables however have the same value based on thw query performed on strDeclarationID.
3. the first 2 steps is easy and here is my problem, after locating and matching all the tables having same value of the strDeclarationID but different field names in the other tables (as mention in step 2), i must delete the queried records of the several tables given, not only the specific fields but the whole record(s) and finallly,
4.gooing back to the first(orginal) table, i must change the value of the field state from "2" to "1". i have a thousand records per table. Note also that the given tables have foreign keys or relation to each other but not necessarily the field we are looking for.thank you and please help."
   

- Advertisement -