- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: SQL Delete s
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
тАО10-08-2008 10:56 AM
тАО10-08-2008 10:56 AM
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
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2008 01:46 PM
тАО10-08-2008 01:46 PM
Re: SQL Delete s
because ...?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2008 02:26 PM
тАО10-08-2008 02:26 PM
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
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2008 07:12 PM
тАО10-08-2008 07:12 PM
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
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-09-2008 02:52 AM
тАО10-09-2008 02:52 AM
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
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-09-2008 02:52 AM
тАО10-09-2008 02:52 AM
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