Select to view content in your preferred language

Creating and Publishing a Database View from a table containing lat/long coordinates

771
2
11-08-2023 07:56 AM
DavidEvans5
Occasional Contributor

Hi There,

I am trying to create a Database View from a table that contains data extracted from our utility billing software with latitude and longitude coordinates for each account. I'm very new to this and I'm relying on an example view I found in an ESRI Community posting here which I've modified by adding a "Select" statement to try to make it include a some of attribute data from the table (ServiceLocation, CurrentAccount etc.).

The view works in to extent that the locations are plotting correctly based on the lat/long coordinates, but  when I attempt to view the attribute table I get a "Failed to retrieve a page of rows" error.  

CREATE VIEW VIPCustomerPointsView 
AS 
SELECT  ServiceLocation, CurrentAccount, ServiceLocationOid, AccountNumber, AccountOid, StartDate, LocationId, GISId, ServiceLatitude, ServiceLongitude, ServiceStreetNumber, ServiceStreetName, ServiceStreetSuffix, ServiceCity, ServiceZipcode

geography::Point(CASE ISNULL(ServiceLatitude,0)
WHEN 0 THEN '37.809737'
ELSE ServiceLatitude END,
CASE ISNULL(ServiceLongitude,0)
WHEN 0 THEN '-85.509352'
ELSE ServiceLongitude END
, 4326)  AS GeomPoint 

FROM DBO.dbo_IdsForGISFinalCable1

 

I'm guessing that I've used the wrong syntax with my select statement or missed something somewhere and that's preventing the View from fetching all the attribute data. If anyone can help by showing me the correct script I should use you all have my sincere appreciation.

Thanks!!

0 Kudos
2 Replies
MarceloMarques
Esri Regular Contributor

if you are using an enterprise geodatabase, then read below.

Views in an enterprise geodatabase—ArcGIS Pro | Documentation

Create Database View (Data Management)—ArcGIS Pro | Documentation

Query layers—ArcGIS Pro | Documentation

| Marcelo Marques | Esri Principal Product Engineer | Cloud & Database Administrator | OCP - Oracle Certified Professional | "In 1992, I embarked on my journey with Esri Technology, and since 1997, I have been working with ArcSDE Geodatabases, right from its initial release. Over the past 32 years, my passion for GIS has only grown stronger." | “ I do not fear computers. I fear the lack of them." Isaac Isimov |
0 Kudos
DavidEvans5
Occasional Contributor

Thankyou Marcelo, We are using an enterprise geodatabase, yes.

I read through the documentation but I didn't really find out what I needed to about the scripting of the View Definition. Sample code, if anyone can provide it, would really help out here.

0 Kudos