I created a simple database view to summarize our site address data in a MSAG-like format. Basically, it's a list of our road names with the high and low addresses for each, that's grouped by road. Here's the code:
SELECT fullname as "Full Road Name", count(fullname) as "# of Addresses", Min(Cast(addrnum as double precision)) as "Low Address", Max(Cast(addrnum as double precision)) as "High Address", Format(last_edited_date,'d', 'en-US') as "Date Edited"
FROM [GIS].[dbo].[SiteAddressPoint_evw]
Group By fullname, last_edited_date
Order By fullname;
I'd like to publish the table to our Open Data Hub so that people can query it or download it on their own.
Since the data is summarized, I don't have an Object ID field or another type of unique identifier, so I can't add it to a map or register it with our Enterprise Geodatabase.
Does anyone know if there's a workaround or a solution that would allow me to do this? I tried including the ObjectID in the query, but that creates rows for each address and undoes the grouping.
Solved! Go to Solution.
Sometimes I use MIN(OBJECTID). Edit: CAST(MIN(OBJECTID) AS INT)
But I prefer to use Oracle’s ROWNUM pseudocolumn. I imagine SQL Server has an equivalent mechanism.
I normally need to do this: CAST(ROWNUM AS INT) AS ROWNUM_ so that Pro will recognize the number as an integer instead of a double.
Sometimes I use MIN(OBJECTID). Edit: CAST(MIN(OBJECTID) AS INT)
But I prefer to use Oracle’s ROWNUM pseudocolumn. I imagine SQL Server has an equivalent mechanism.
I normally need to do this: CAST(ROWNUM AS INT) AS ROWNUM_ so that Pro will recognize the number as an integer instead of a double.
I thought I had a solution, but I couldn't get it to register with the geodatabase. I used:
Row_Number() Over(Order By fullname) as "ObjectID"
But I didn't think to cast it as an integer. So after I saw your post I updated it to
Cast(Row_Number() Over(Order By fullname) as Int) as "ObjectID"
and that totally word.
Thanks!