<?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 Delete all rows from Teradata table to make it empty in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delete-all-rows-from-Teradata-table-to-make-it-empty/m-p/836312#M330675</link>
    <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table on Teradata, and I want, from SAS, to delete all records from the table until it's empty. I know I can drop the table, but is there a way to delete all the rows but keep it as an empty table?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc sql;
&amp;nbsp; &amp;nbsp; delete from TD.MY_TABLE;
quit;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should something like this work? It hangs for me. I had full access to write/update/delete.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 01 Oct 2022 17:42:46 GMT</pubDate>
    <dc:creator>KJazem</dc:creator>
    <dc:date>2022-10-01T17:42:46Z</dc:date>
    <item>
      <title>Delete all rows from Teradata table to make it empty</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-all-rows-from-Teradata-table-to-make-it-empty/m-p/836312#M330675</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table on Teradata, and I want, from SAS, to delete all records from the table until it's empty. I know I can drop the table, but is there a way to delete all the rows but keep it as an empty table?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc sql;
&amp;nbsp; &amp;nbsp; delete from TD.MY_TABLE;
quit;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should something like this work? It hangs for me. I had full access to write/update/delete.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Oct 2022 17:42:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-all-rows-from-Teradata-table-to-make-it-empty/m-p/836312#M330675</guid>
      <dc:creator>KJazem</dc:creator>
      <dc:date>2022-10-01T17:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: Delete all rows from Teradata table to make it empty</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-all-rows-from-Teradata-table-to-make-it-empty/m-p/836316#M330676</link>
      <description>&lt;P&gt;SAS does not have a concept of "delete all rows" (also called truncate in other SQL implementations) so it is deleting each observation individually. That might take a long time on a large Teradata table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try using pass thru to Teradata so you can use Teradata syntax instead of PROC SQL syntax.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.teradatapoint.com/teradata/teradata-truncate-table.htm" target="_blank"&gt;https://www.teradatapoint.com/teradata/teradata-truncate-table.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if you already have a libref connected to teratadata, let's call it TD, then the SAS code would be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
connect using td;
execute by td
(delete my_table all
);
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 01 Oct 2022 18:56:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-all-rows-from-Teradata-table-to-make-it-empty/m-p/836316#M330676</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-01T18:56:47Z</dc:date>
    </item>
  </channel>
</rss>

