{"id":31,"date":"2014-08-06T22:33:24","date_gmt":"2014-08-06T22:33:24","guid":{"rendered":"http:\/\/www.sqlgeometry.com\/?p=31"},"modified":"2014-12-04T01:38:58","modified_gmt":"2014-12-04T01:38:58","slug":"adding-object-id-to-your-view","status":"publish","type":"post","link":"https:\/\/www.sqlgeometry.com\/?p=31","title":{"rendered":"Adding Object ID to your view"},"content":{"rendered":"<p>QGIS and ESRI both like to see ObjectID (or an identity) in the data returned from a SQL query.<\/p>\n<p>I use two methods to accomplish this.<\/p>\n<p>1. Row_number() Over<\/p>\n<p><code>Select ROW_NUMBER() OVER ( ORDER BY anydatacolumn) as ObjectID<\/code><\/p>\n<p>However, ESRI doesnt like the returned data type so I convert it to an INT like so:<\/p>\n<p><code>Select CONVERT(int,ROW_NUMBER() OVER (ORDER BY anydatacolumn)) as ObjectID<\/code><\/p>\n<p>2. Newid() or NewSequentialId()<\/p>\n<p>This will return a MS UUID (GUID) or sequential GUID. Apparently ESRI doesnt mind GUIDS as a ObjectID. I have yet to test with QGIS.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>QGIS and ESRI both like to see ObjectID (or an identity) in the data returned from a SQL query. I use two methods to accomplish this. 1. Row_number() Over Select ROW_NUMBER() OVER ( ORDER BY anydatacolumn) as ObjectID However, ESRI doesnt like the returned data type so I convert it to an INT like so: &hellip; <a href=\"https:\/\/www.sqlgeometry.com\/?p=31\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Adding Object ID to your view<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=31"}],"version-history":[{"count":3,"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=\/wp\/v2\/posts\/31\/revisions"}],"predecessor-version":[{"id":48,"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=\/wp\/v2\/posts\/31\/revisions\/48"}],"wp:attachment":[{"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}