<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SQL Delete s in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/sql-delete-s/m-p/4283487#M44689</link>
    <description>And you chose a VMS forum for this question&lt;BR /&gt;because ...?</description>
    <pubDate>Wed, 08 Oct 2008 20:46:07 GMT</pubDate>
    <dc:creator>Steven Schweda</dc:creator>
    <dc:date>2008-10-08T20:46:07Z</dc:date>
    <item>
      <title>SQL Delete s</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/sql-delete-s/m-p/4283486#M44688</link>
      <description>I want to write a short script that would delete all files from my problemlog table every 30 days. I want to retain only  30 days worth.&lt;BR /&gt;Here is  part the script I used &lt;BR /&gt;&lt;BR /&gt;select count(*) from problemlog;&lt;BR /&gt;  19150 &lt;BR /&gt;Delete from problemlog where DTG &amp;lt;'1-sep-2008 00:00:00';&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Oct 2008 17:56:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/sql-delete-s/m-p/4283486#M44688</guid>
      <dc:creator>Joseph Drozdz</dc:creator>
      <dc:date>2008-10-08T17:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Delete s</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/sql-delete-s/m-p/4283487#M44689</link>
      <description>And you chose a VMS forum for this question&lt;BR /&gt;because ...?</description>
      <pubDate>Wed, 08 Oct 2008 20:46:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/sql-delete-s/m-p/4283487#M44689</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-10-08T20:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Delete s</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/sql-delete-s/m-p/4283488#M44690</link>
      <description>I'm not sure there's a question there, though I get the impression you'd like somebody to write some sort of a tool for you here.&lt;BR /&gt;&lt;BR /&gt;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.)   &lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;And assuming this is OpenVMS (the host OS and version isn't identified), there's some basic DCL date processing here:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://64.223.189.234/node/736" target="_blank"&gt;http://64.223.189.234/node/736&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;And as mentioned earlier, you might well be able to use the native SQL syntax for this date-related processing, too. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Oct 2008 21:26:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/sql-delete-s/m-p/4283488#M44690</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2008-10-08T21:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Delete s</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/sql-delete-s/m-p/4283489#M44691</link>
      <description>&lt;!--!*#--&gt;This question has NOTHING to do OpenVMS and everything with the DATABASE you are using an its capabilities.&lt;BR /&gt;&lt;BR /&gt;I recommend posting the query a appropriate database related forum IF a GOOGLE search and some documenation scanning does not provide a solution.&lt;BR /&gt;&lt;BR /&gt;But since you have out attention anyway...&lt;BR /&gt;Where does the '1-sep-2008' come from?&lt;BR /&gt;Looks like a piece of text. &lt;BR /&gt;Should it not be a formula?&lt;BR /&gt;&lt;BR /&gt;For example, using ORACLE&lt;BR /&gt;&lt;BR /&gt;First Generate a test table:&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; create table aap as select level noot, sysdate - level mies from dual connect by level &amp;lt; 100;&lt;BR /&gt;&lt;BR /&gt;Proof that worked:&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; select count(*) from aap;&lt;BR /&gt;&lt;BR /&gt;99&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; select * from aap where rownum &amp;lt; 5;&lt;BR /&gt;&lt;BR /&gt;NOOT                   MIES                      &lt;BR /&gt;---------------------- ------------------------- &lt;BR /&gt;1                      07-OCT-08                 &lt;BR /&gt;2                      06-OCT-08                 &lt;BR /&gt;3                      05-OCT-08                 &lt;BR /&gt;4                      04-OCT-08                 &lt;BR /&gt;&lt;BR /&gt;Now for an example purge&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; delete aap where mies &amp;lt; sysdate - 30;&lt;BR /&gt;&lt;BR /&gt;70 rows deleted&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein van den Heuvel&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Oct 2008 02:12:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/sql-delete-s/m-p/4283489#M44691</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-10-09T02:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Delete s</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/sql-delete-s/m-p/4283490#M44692</link>
      <description>Hi Joseph,&lt;BR /&gt;&lt;BR /&gt;The INTERVAL data type could also be worth a look depending on your DBMS.&lt;BR /&gt;&lt;BR /&gt;Cheers Richard Maher</description>
      <pubDate>Thu, 09 Oct 2008 09:52:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/sql-delete-s/m-p/4283490#M44692</guid>
      <dc:creator>Richard J Maher</dc:creator>
      <dc:date>2008-10-09T09:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Delete s</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/sql-delete-s/m-p/4283491#M44693</link>
      <description>The timestamp (1-sep-2008 00:00:00) suggests a VMS box; the script part suggest a relational database; but it were better it was explicitly mentioned what VMS version and, in this case far more important, what database and version.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; would delete all files from my problemlog table &lt;BR /&gt;&lt;BR /&gt;is interpreted by my as table problemlog holding date and a filespec.&lt;BR /&gt;&lt;BR /&gt;Either I have to delete the files mentioned in this database, or outside the procedure or program where the query resides.&lt;BR /&gt;&lt;BR /&gt;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:&lt;BR /&gt;&lt;BR /&gt;$ DELETE/BEFORE=today-"30 00:00" &lt;LOCATION&gt;&lt;BR /&gt;&lt;BR /&gt;(Well, "today-"30 00:00"" may not work in this syntax, but you get the meaning)&lt;BR /&gt;&lt;BR /&gt;If outside, the same DELETE stament - and the same restictions) apply.&lt;BR /&gt;&lt;/LOCATION&gt;</description>
      <pubDate>Thu, 09 Oct 2008 09:52:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/sql-delete-s/m-p/4283491#M44693</guid>
      <dc:creator>Willem Grooters</dc:creator>
      <dc:date>2008-10-09T09:52:56Z</dc:date>
    </item>
  </channel>
</rss>

