<?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: Keeping the original ID field values in SQL Server by creating a query table in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/keeping-the-original-id-field-values-in-sql-server/m-p/658618#M37292</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Shahar! Your observation that the "Add OLE DB Connection" function is now hidden in a button instead of being part of the add DB connection dialog helped me solve a nagging mystery!&lt;/P&gt;&lt;P&gt;--Eric&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 May 2015 21:01:19 GMT</pubDate>
    <dc:creator>EricMartinson</dc:creator>
    <dc:date>2015-05-11T21:01:19Z</dc:date>
    <item>
      <title>Keeping the original ID field values in SQL Server by creating a query table</title>
      <link>https://community.esri.com/t5/data-management-questions/keeping-the-original-id-field-values-in-sql-server/m-p/658616#M37290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We're migrating from an Enterprise Oracle database to SQL Server. Neither are GEOdatabases. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The tables within contain ID fields which are &lt;/SPAN&gt;&lt;STRONG&gt;Integer&lt;/STRONG&gt;&lt;SPAN&gt; primary keys. ArcGIS recognizes those keys as datatype Object ID, but &lt;/SPAN&gt;&lt;STRONG style="text-decoration: underline;"&gt;only&lt;/STRONG&gt;&lt;SPAN&gt; in SQL Server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Whenever I run a GIS tool that generates a new table (import/export; batch geocoding; etc.) ArcGIS creates a new OBJECTID field in the result table while &lt;/SPAN&gt;&lt;STRONG style="font-style: italic;"&gt;leaving out&lt;/STRONG&gt;&lt;SPAN&gt; the original ID field. Needless to say, the original ID is crucial for later analysis, specially since the new OBJECTID field has no real meaning (just ascending numbers).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The solution was to create a query table, add to it a virtual key field, and run the different tools on the query table. I tried it but got the error &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;"000055: Cannot create a Query Table for this workspace"&lt;/SPAN&gt;&lt;SPAN&gt;. I was surprised to learn that query tables &lt;/SPAN&gt;&lt;STRONG style="text-decoration: underline;"&gt;cannot&lt;/STRONG&gt;&lt;SPAN&gt; be created in a database connection, only in an OLE DB connection (or geodatabase - irrelevant to my case).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, in order to run GIS tools while keeping my original table ID in SQL Server, I had to do the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Find the well-hidden "Add OLE DB Connection" button on ArcCatalog.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Create an OLE DB connection.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Make a new query table from my original table while adding a virtual key.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4. Run the tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;There must be a better way to do this!&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Some points for esri to consider:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Why only SQL Server recognizes the ID fields as Object ID datatype? Why not Oracle?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Can you make an option for not changing the object id field values? If not, can't you add a new OBJECTID field while keeping the original Object ID datatype field in the results?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Why can't I create a query table in a database connection? Why must I go to OLE DB connection? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4. Why does the "Add OLE DB Connection" button exists only in ArcCatalog? Why not in ArcMap as well? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tech Specs:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Oracle 11g&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SQL Server 2012&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS Desktop Standard 10.2.1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Shahar.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2014 06:39:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/keeping-the-original-id-field-values-in-sql-server/m-p/658616#M37290</guid>
      <dc:creator>ShaharLevenson</dc:creator>
      <dc:date>2014-06-24T06:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping the original ID field values in SQL Server by creating a query table</title>
      <link>https://community.esri.com/t5/data-management-questions/keeping-the-original-id-field-values-in-sql-server/m-p/658617#M37291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;EDIT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Summary and a decent solution:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Working in a database that is &lt;STRONG&gt;not geo-enabled&lt;/STRONG&gt;, you may have some difficulties keeping your primary-key fields in ArcGIS tools' results.&lt;/P&gt;&lt;P&gt;2. If your data doesn't have the &lt;SPAN style="color: #4d4d4d; font-family: Arial, Helvetica, sans-serif;"&gt;ArcGIS maintained &lt;/SPAN&gt;OBJECTID field, ArcGIS will look for another candidate.&lt;/P&gt;&lt;P&gt;3. If you have a not-null - unique - integer field (like many primary keys), ArcGIS will treat it as the OBJECTID and will define it's data type as "Object ID". You cannot tell ArcGIS to ignore that field.&lt;/P&gt;&lt;P&gt;4. The problem with this is that when you run a tool that creates a new Feature Class / Table from your data, ArcGIS populates the OBJECTID field with new values, making you lose the option to do joins based on that field.&lt;/P&gt;&lt;P&gt;5. Here are a few workarounds:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a. Create a view from your data in your database and run the tool against the view. ArcGIS doesn't recognize the field in the view as OBJECTID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b. Don't choose integer for your primary key field. Use numeric, float, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c. Add your data to ArcGIS as a query table with a virtual key. Note that there may be a problem if you're using "Database Connection" - Try using "OLE DB Connection".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Oct 2014 07:07:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/keeping-the-original-id-field-values-in-sql-server/m-p/658617#M37291</guid>
      <dc:creator>ShaharLevenson</dc:creator>
      <dc:date>2014-10-05T07:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping the original ID field values in SQL Server by creating a query table</title>
      <link>https://community.esri.com/t5/data-management-questions/keeping-the-original-id-field-values-in-sql-server/m-p/658618#M37292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Shahar! Your observation that the "Add OLE DB Connection" function is now hidden in a button instead of being part of the add DB connection dialog helped me solve a nagging mystery!&lt;/P&gt;&lt;P&gt;--Eric&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 May 2015 21:01:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/keeping-the-original-id-field-values-in-sql-server/m-p/658618#M37292</guid>
      <dc:creator>EricMartinson</dc:creator>
      <dc:date>2015-05-11T21:01:19Z</dc:date>
    </item>
  </channel>
</rss>

