- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Delete data from multiple tables
Operating System - HP-UX
1753514
Members
5879
Online
108795
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-17-2009 05:53 AM
тАО03-17-2009 05:53 AM
I want to delete the data from all the tables in this database which having device_id="A1"
How to do it. 2 issues heres
1) There are about 40 tables in this database and don't know which table contained the field device_id .
2) We have several this kind of deviced_id need to be deleted, e.g. device_id="A1", or device _id="A2", "A3". can sql read this info from a table and process? thanks
How to do it. 2 issues heres
1) There are about 40 tables in this database and don't know which table contained the field device_id .
2) We have several this kind of deviced_id need to be deleted, e.g. device_id="A1", or device _id="A2", "A3". can sql read this info from a table and process? thanks
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-17-2009 06:29 AM
тАО03-17-2009 06:29 AM
Re: Delete data from multiple tables
Martin,
This is really DATABASE questing entirely independent of the OS (hpux). As such this question is better asked (for your own sake, and to cut down noise here) in a database specific forum.
What database are you refering to?
If it is oracle, then here are some queries to get you going.
SQL> select table_name from dict where table_name like '%TAB%COL%';
---> USER_TAB_COLS
SQL> describe USER_TAB_COLS
---> TABLE_NAME, COLUMN_NAME
SQL> select TABLE_NAME, COLUMN_NAME from USER_TAB_COLS where COLUMN_NAME like '%DEVICE%ID%'
...
Once you know your tables and column you casn then proceed with the delete commands using either the ...WHERE device_id_col IN (...)
or use a HELPER TABLE with device ids to be listed and then delete correspondig records.
This is really basic SQL stuff, and if you are not ready to deal with this jsut yet, then be sure to work with a peer, GOOGLE a lot, and/or get your hand on a SQL COOKBOOK.
Good Luck!
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 11:35 PM
тАО03-24-2009 11:35 PM
Re: Delete data from multiple tables
Dear Martin
sql >delete from table1, table2 where device id=A1;
Sajjad
sql >delete from table1, table2 where device id=A1;
Sajjad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-25-2009 01:28 AM
тАО03-25-2009 01:28 AM
Solution
Hi Martin,
You need to steps to do this in a practical way:
a) generate the delete script:
select 'delete from '||dtc.table_name||' where DEVICE_ID = ''A1'';'
from dba_tab_columns dtc
where dtc.column_name = 'DEVICE_ID';
b) Validade all the table names, copy the script to a *.sql (Unix) file or to the clipboard (Windows) and execute it in SQL*Plus
Best Regards,
Eric Antunes
You need to steps to do this in a practical way:
a) generate the delete script:
select 'delete from '||dtc.table_name||' where DEVICE_ID = ''A1'';'
from dba_tab_columns dtc
where dtc.column_name = 'DEVICE_ID';
b) Validade all the table names, copy the script to a *.sql (Unix) file or to the clipboard (Windows) and execute it in SQL*Plus
Best Regards,
Eric Antunes
Each and every day is a good day to learn.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP