- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - OpenVMS
- >
- SQL Delete s
-
-
Categories
- Topics
- Hybrid IT with Cloud
- Mobile & IoT
- IT for Data & Analytics
- Transformation
- Strategy and Technology
- Products
- Cloud
- Integrated Systems
- Networking
- Servers and Operating Systems
- Services
- Storage
- Company
- Events
- Partner Solutions and Certifications
- Welcome
- Welcome
- Announcements
- Tips and Tricks
- Feedback
-
Blogs
- Alliances
- Around the Storage Block
- Behind the scenes @ Labs
- Converged Data Center Infrastructure
- Digital Transformation
- Grounded in the Cloud
- HPE Careers
- HPE Storage Tech Insiders
- Infrastructure Insights
- Inspiring Progress
- Internet of Things (IoT)
- My Learning Certification
- Networking
- OEM Solutions
- Servers: The Right Compute
- Telecom IQ
- Transforming IT
-
Quick Links
- Community
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Contact
- Email us
- Tell us what you think
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Enterprise.nxt
- Marketplace
- Aruba Airheads Community
-
Categories
-
Forums
-
Blogs
-
InformationEnglish
SQL Delete s
- 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-08-2008 10:56 AM
10-08-2008 10:56 AM
SQL Delete s
SQL Delete s
Here is part the script I used
select count(*) from problemlog;
19150
Delete from problemlog where DTG <'1-sep-2008 00:00:00';
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-08-2008 01:46 PM
10-08-2008 01:46 PM
Re: SQL Delete s
Re: SQL Delete s
because ...?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-08-2008 02:26 PM
10-08-2008 02:26 PM
Re: SQL Delete s
Re: SQL Delete s
Various databases can have different syntax available for the SQL-level commands, and the use of a delta time might well be feasible here. (For how DCL deals with this, see the HELP library for some information on delta, combination and absolute times and timekeeping. For the SQL documentation, see whichever SQL manual is kicking around for the particular database.)
If the database can't deal with these date formats directly, then some DCL could create a file, write the SQL statements and some DCL into a temporary procedure, and then invoke it. But that can (does) require some details around the SQL database and the context and the run-time environment, and right now this environment and this requirement clear. Writing DCL from DCL is easy; open a file, and start writing commands.
As an alternative, it might be just as easy to run a daily batch job and nuke the last 30 (or 31) days, for instance.
And assuming this is OpenVMS (the host OS and version isn't identified), there's some basic DCL date processing here:
http://64.223.189.234/node/736
And as mentioned earlier, you might well be able to use the native SQL syntax for this date-related processing, too.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-08-2008 07:12 PM
10-08-2008 07:12 PM
Re: SQL Delete s
Re: SQL Delete s
I recommend posting the query a appropriate database related forum IF a GOOGLE search and some documenation scanning does not provide a solution.
But since you have out attention anyway...
Where does the '1-sep-2008' come from?
Looks like a piece of text.
Should it not be a formula?
For example, using ORACLE
First Generate a test table:
SQL> create table aap as select level noot, sysdate - level mies from dual connect by level < 100;
Proof that worked:
SQL> select count(*) from aap;
99
SQL> select * from aap where rownum < 5;
NOOT MIES
---------------------- -------------------------
1 07-OCT-08
2 06-OCT-08
3 05-OCT-08
4 04-OCT-08
Now for an example purge
SQL> delete aap where mies < sysdate - 30;
70 rows deleted
hth,
Hein van den Heuvel
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-09-2008 02:52 AM
10-09-2008 02:52 AM
Re: SQL Delete s
Re: SQL Delete s
The INTERVAL data type could also be worth a look depending on your DBMS.
Cheers Richard Maher
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-09-2008 02:52 AM
10-09-2008 02:52 AM
Re: SQL Delete s
Re: SQL Delete s
>> would delete all files from my problemlog table
is interpreted by my as table problemlog holding date and a filespec.
Either I have to delete the files mentioned in this database, or outside the procedure or program where the query resides.
If inside, you won't get away with Hein's solution, UNLESS all these files are in one directory where just these problem logfiles exist - and nothing but these:
$ DELETE/BEFORE=today-"30 00:00"
(Well, "today-"30 00:00"" may not work in this syntax, but you get the meaning)
If outside, the same DELETE stament - and the same restictions) apply.
OpenVMS Developer & System Manager
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2018 Hewlett Packard Enterprise Development LP