<?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: Select statement - Will it be sorted by primary key by default? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-will-it-be-sorted-by-primary-key-by-default/m-p/2270688#M493219</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By default it will take if you do not have any where condition and will not related to primary key..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you keep where condition as per condition and then sorting will not work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i mean sorting will not take automatically and sorting is not related to primary key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for better understanding please keep sort command after completion of sql query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward Points if it is helpful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Seshu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 May 2007 20:04:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-25T20:04:13Z</dc:date>
    <item>
      <title>Select statement - Will it be sorted by primary key by default?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-will-it-be-sorted-by-primary-key-by-default/m-p/2270686#M493217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Could any of you help me to know the following info?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a select statement as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from ...into table int_tab where...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once the select statement is executed, can I assume that the contents of int_tab is automatically sorted by the primary key of the table? Also please tell me how to prove it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please note that the select statement doesn't contain order by clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Thamarai&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 20:00:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-will-it-be-sorted-by-primary-key-by-default/m-p/2270686#M493217</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T20:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement - Will it be sorted by primary key by default?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-will-it-be-sorted-by-primary-key-by-default/m-p/2270687#M493218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes you can assume that.&lt;/P&gt;&lt;P&gt;Records are always fetched in the order, sorted by primary key.&lt;/P&gt;&lt;P&gt;The reason for this is an Index is created by default for the primary key and hence they are sorted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are adding records in internal table after fetching data, then you can use SORTED TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There's no method to prove it but you can try fetching data from different tables by using different WHERE conditions.&lt;/P&gt;&lt;P&gt;I mean to say that just play with the select statement and it will be always sorted by primary key unless you specify ORDER BY clause.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 20:02:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-will-it-be-sorted-by-primary-key-by-default/m-p/2270687#M493218</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T20:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement - Will it be sorted by primary key by default?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-will-it-be-sorted-by-primary-key-by-default/m-p/2270688#M493219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By default it will take if you do not have any where condition and will not related to primary key..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you keep where condition as per condition and then sorting will not work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i mean sorting will not take automatically and sorting is not related to primary key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for better understanding please keep sort command after completion of sql query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward Points if it is helpful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Seshu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 20:04:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-will-it-be-sorted-by-primary-key-by-default/m-p/2270688#M493219</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T20:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement - Will it be sorted by primary key by default?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-will-it-be-sorted-by-primary-key-by-default/m-p/2270689#M493220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since the SELECT statement supports the ORDER BY PRIMARY KEY clause, I don't think you can assume that it will be ordered by the primary key if you omit it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 20:38:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-will-it-be-sorted-by-primary-key-by-default/m-p/2270689#M493220</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T20:38:43Z</dc:date>
    </item>
  </channel>
</rss>

