<?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>Question Re: How to parse one SQL script differently for different database versions? in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/how-to-parse-one-sql-script-differently-for-different-database-versions/qaa-p/13829400#M4860243</link>
    <description>&lt;P&gt;Yes, I'm aware that a possible enhancement for a current SA version won't make a pre-V10 engine change its behaviour. Kind of a very "post-mortem feature request":)&lt;/P&gt;</description>
    <pubDate>Tue, 19 Oct 2010 09:21:48 GMT</pubDate>
    <dc:creator>VolkerBarth</dc:creator>
    <dc:date>2010-10-19T09:21:48Z</dc:date>
    <item>
      <title>How to parse one SQL script differently for different database versions?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-parse-one-sql-script-differently-for-different-database-versions/qaq-p/13829397</link>
      <description>&lt;P&gt;I would like to use &lt;STRONG&gt;one SQL script with DDL statements&lt;/STRONG&gt; like CREATE TABLE &lt;STRONG&gt;for different SA versions&lt;/STRONG&gt; and use (slightly) different syntax for these different versions.&lt;/P&gt;

&lt;P&gt;E.g. SA 10 has introduced the VALIDATE authority (and REMOTE DBA authority is no more sufficient to VALIDATE), so for SA10 and newer, the script would contain a statement like&lt;/P&gt;

&lt;LI-CODE lang="sql"&gt;grant validate to &amp;lt;Remote DBA User&amp;gt;;
&lt;/LI-CODE&gt;

&lt;P&gt;Naturally, a pre-V10 engine won't accept this syntax and will raise an error.&lt;/P&gt;

&lt;P&gt;My simple tests with if statements like&lt;/P&gt;

&lt;LI-CODE lang="sql"&gt;if @@version like '12.0%' then
  grant validate to &amp;lt;Remote DBA User&amp;gt;;
end if;
&lt;/LI-CODE&gt;

&lt;P&gt;do fail, as obviously the complete statement gets parsed even if the statements in the if-block won't get executed for a pre-V12 engine.&lt;/P&gt;

&lt;P&gt;So, basically, I would like to use something like C's &lt;EM&gt;#ifdef/#ifdef directives&lt;/EM&gt; for &lt;EM&gt;conditional compilation&lt;/EM&gt;, i.e. a means to suppress the parsing of a script portion when a certain condition is false.&lt;/P&gt;

&lt;P&gt;Is this possible with SQL Anyhwere and DBISQL?&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Just to add: It will not be sufficient to skip such statements completely via &lt;EM&gt;on_error = continue&lt;/EM&gt;. This might be sufficient in the above example, but in general the statements will have to be executed by all versions, and only particular clauses may be different.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2010 08:42:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-parse-one-sql-script-differently-for-different-database-versions/qaq-p/13829397</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2010-10-19T08:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse one SQL script differently for different database versions?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-parse-one-sql-script-differently-for-different-database-versions/qaa-p/13829398#M4860241</link>
      <description>&lt;P&gt;EXECUTE IMMEDIATE won't throw a syntax error if it isn't executed.&lt;/P&gt;

&lt;P&gt;( now, welcome to The World Of ''''''''Quotation Marks'''''''' &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2010 09:05:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-parse-one-sql-script-differently-for-different-database-versions/qaa-p/13829398#M4860241</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2010-10-19T09:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse one SQL script differently for different database versions?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-parse-one-sql-script-differently-for-different-database-versions/qaa-p/13829399#M4860242</link>
      <description>&lt;P&gt;Thanks for the pointer and good to know, but I guess that would make the script much more incomprehensible in my particular requirement...&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2010 09:19:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-parse-one-sql-script-differently-for-different-database-versions/qaa-p/13829399#M4860242</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2010-10-19T09:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse one SQL script differently for different database versions?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-parse-one-sql-script-differently-for-different-database-versions/qaa-p/13829400#M4860243</link>
      <description>&lt;P&gt;Yes, I'm aware that a possible enhancement for a current SA version won't make a pre-V10 engine change its behaviour. Kind of a very "post-mortem feature request":)&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2010 09:21:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-parse-one-sql-script-differently-for-different-database-versions/qaa-p/13829400#M4860243</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2010-10-19T09:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse one SQL script differently for different database versions?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-parse-one-sql-script-differently-for-different-database-versions/qaa-p/13829401#M4860244</link>
      <description>&lt;P&gt;I was sure I'd posted a suggestion about "more directives" in ISQL but I can't find it... it's something I would support as long as it doesn't go CRAZY like C.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2010 18:00:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-parse-one-sql-script-differently-for-different-database-versions/qaa-p/13829401#M4860244</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2010-10-19T18:00:45Z</dc:date>
    </item>
  </channel>
</rss>

