<?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 FROM Snowflake table not working in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/DELETE-FROM-Snowflake-table-not-working/m-p/947685#M370938</link>
    <description>&lt;P&gt;Question about deleting rows from a Snowflake table, I need to delete the rows but keep the table for future use.&lt;/P&gt;&lt;P&gt;Two method, the first one works, but not the second one. Any idea?&lt;/P&gt;&lt;DIV&gt;PROC SQL;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CONNECT USING SNOW;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DELETE FROM SNOW.my_table;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;QUIT;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;PROC SQL;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;CONNECT USING SNOW;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;EXECUTE (DELETE FROM my_table) BY SNOW;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;QUIT;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;</description>
    <pubDate>Wed, 16 Oct 2024 14:38:41 GMT</pubDate>
    <dc:creator>mmawwamm</dc:creator>
    <dc:date>2024-10-16T14:38:41Z</dc:date>
    <item>
      <title>DELETE FROM Snowflake table not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DELETE-FROM-Snowflake-table-not-working/m-p/947685#M370938</link>
      <description>&lt;P&gt;Question about deleting rows from a Snowflake table, I need to delete the rows but keep the table for future use.&lt;/P&gt;&lt;P&gt;Two method, the first one works, but not the second one. Any idea?&lt;/P&gt;&lt;DIV&gt;PROC SQL;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CONNECT USING SNOW;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DELETE FROM SNOW.my_table;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;QUIT;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;PROC SQL;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;CONNECT USING SNOW;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;EXECUTE (DELETE FROM my_table) BY SNOW;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;QUIT;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;</description>
      <pubDate>Wed, 16 Oct 2024 14:38:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DELETE-FROM-Snowflake-table-not-working/m-p/947685#M370938</guid>
      <dc:creator>mmawwamm</dc:creator>
      <dc:date>2024-10-16T14:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE FROM Snowflake table not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DELETE-FROM-Snowflake-table-not-working/m-p/947706#M370949</link>
      <description>&lt;P&gt;"Not working" is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the "&amp;lt;/&amp;gt;" to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the "&amp;lt;/&amp;gt;" icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure about Snowflake.&lt;/P&gt;
&lt;P&gt;A data step like this is a common way to keep the structure of a data set in SAS but "empty" it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data lib.dataset;
   set lib.dataset (obs=0);
run;&lt;/PRE&gt;
&lt;P&gt;The Sql equivalent leaves a warning in the log:&lt;/P&gt;
&lt;PRE&gt;proc sql;
   create table have as
   select * 
   from have (obs=0)
  ;
quit;&lt;/PRE&gt;
&lt;P&gt;I have no idea if the Obs= dataset option will work with Snowflake though.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 16:29:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DELETE-FROM-Snowflake-table-not-working/m-p/947706#M370949</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-10-16T16:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE FROM Snowflake table not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DELETE-FROM-Snowflake-table-not-working/m-p/947712#M370952</link>
      <description>&lt;P&gt;You might have to add the schema name used when defining the libref into the explicit Snowflake code.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;EXECUTE (DELETE FROM my_schema.my_table) BY SNOW;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Check the LIBNAME statement that made the SNOW libref to see what schema it is pointing at.&lt;/P&gt;
&lt;P&gt;Check with Snowflake documentation for how it handles schema names.&lt;/P&gt;
&lt;P&gt;Also check with Snowflake documentation for the best way to "empty" a table. Many databases have special syntax for that. (I seem to remember that Oracle used TRUNCATE statement?).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note:&amp;nbsp; You can move the BY SNOW to the front if you want.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;EXECUTE BY SNOW (....);&amp;nbsp; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That way the code looks more like the code used with the FROM CONNECTION TO xxx syntax used when using explicit passthru code in a query.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 16:51:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DELETE-FROM-Snowflake-table-not-working/m-p/947712#M370952</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-10-16T16:51:11Z</dc:date>
    </item>
  </channel>
</rss>

