<?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 Using a sql view of another view to generate points on the fly for the past day of phone calls in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/using-a-sql-view-of-another-view-to-generate/m-p/1190576#M44102</link>
    <description>&lt;P&gt;I have joined another database that gives us a limited schema of emergency calls, but is in a state of constant growth.&amp;nbsp; My goal is to get those calls statistics mapped and into a Dashboard.&amp;nbsp; I created a view of another view to generate point geometries of the past 24 hours, but I am not having much success getting the view into Pro to generate a map.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;First view (selects and manipulates a running day of calls):&lt;/P&gt;&lt;P&gt;ALTER VIEW [sdeadmin].[FCALLS_w_LAT_LONG_vw]&lt;BR /&gt;AS&lt;BR /&gt;SELECT [CALL_NO]&lt;BR /&gt;,[CALL_TYPE_FINAL_D]&lt;BR /&gt;,[LOCATION]&lt;BR /&gt;,[LOCATION_ADDRESS]&lt;BR /&gt;,[APARTMENT]&lt;BR /&gt;,[BEAT] AS [STATION]&lt;BR /&gt;,[PRIMARY_UNIT]&lt;BR /&gt;,[XCOORD]&lt;BR /&gt;,[YCOORD]&lt;BR /&gt;,[CALL_CREATED_DATE]&lt;BR /&gt;,SUBSTRING([CALL_CREATED_TIME], 1, 2) + ':' + SUBSTRING([CALL_CREATED_TIME], 3, 2) + ':' + SUBSTRING([CALL_CREATED_TIME], 5, 2) AS [CALL_CREATED_TIME]&lt;BR /&gt;,SUBSTRING([CALL_DISPATCH_TIME], 1, 2) + ':' + SUBSTRING([CALL_DISPATCH_TIME], 3, 2) + ':' + SUBSTRING([CALL_DISPATCH_TIME], 5, 2) AS [CALL_DISPATCH_TIME]&lt;BR /&gt;,SUBSTRING([CALL_ENROUTE_TIME], 1, 2) + ':' + SUBSTRING([CALL_ENROUTE_TIME], 3, 2) + ':' + SUBSTRING([CALL_ENROUTE_TIME], 5, 2) AS [CALL_ENROUTE_TIME]&lt;BR /&gt;,SUBSTRING([CALL_ONSCENE_TIME], 1, 2) + ':' + SUBSTRING([CALL_ONSCENE_TIME], 3, 2) + ':' + SUBSTRING([CALL_ONSCENE_TIME], 5, 2) AS [CALL_ONSCENE_TIME]&lt;BR /&gt;,SUBSTRING([CALL_CLOSE_TIME], 1, 2) + ':' + SUBSTRING([CALL_CLOSE_TIME], 3, 2) + ':' + SUBSTRING([CALL_CLOSE_TIME], 5, 2) AS [CALL_CLOSE_TIME]&lt;BR /&gt;,CAST(REPLACE([XCOORD],',','') AS FLOAT) AS LONG&lt;BR /&gt;,CAST(REPLACE([YCOORD],',','') AS FLOAT) AS LAT&lt;BR /&gt;,GETDATE() - 1 as Date_Time&lt;BR /&gt;FROM [TIBCADWH\Tiburon].[DWLIVE].[dbo].[FCalls]&lt;BR /&gt;WHERE [CALL_TYPE_FINAL_D] NOT IN ('ADMIN STATUS', 'Training') AND [CALL_CREATED_DATE] + CAST(SUBSTRING([CALL_CREATED_TIME], 1, 2) + ':' + SUBSTRING([CALL_CREATED_TIME], 3, 2) + ':' + SUBSTRING([CALL_CREATED_TIME], 5, 2) AS DATETIME) &amp;gt;= DATEADD(DAY,-1, CAST(GETDATE() AS DATE))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second View (pulls final fields, generates OBJECTID from the Call ID that I need to strip out first character in the call number field (unique) to make a numeric value and then create the point geometry:&lt;/P&gt;&lt;P&gt;ALTER View [sdeadmin].[FCALLS_w_Shape_vw]&lt;BR /&gt;AS&lt;BR /&gt;SELECT CAST(SUBSTRING([CALL_NO],2,10) AS INT) as OBJECTID&lt;BR /&gt;,CALL_NO, CALL_TYPE_FINAL_D, LOCATION, LOCATION_ADDRESS, APARTMENT, STATION, PRIMARY_UNIT, XCOORD, YCOORD, CALL_CREATED_DATE, CALL_CREATED_TIME, CALL_DISPATCH_TIME, CALL_ENROUTE_TIME&lt;BR /&gt;,CALL_ONSCENE_TIME, CALL_CLOSE_TIME, LONG, LAT, Date_Time&lt;BR /&gt;,geography::Point(LAT, LONG, 4326) AS SHAPE&lt;/P&gt;&lt;P&gt;FROM [sdeadmin].[FCALLS_w_LAT_LONG_vw]&lt;BR /&gt;GO&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This does create geometries in SSMS and imports into Arc Pro (Enterprise 10.9.1, Pro 2.9.3) but does not draw features or open the table without an error: Underlying DBMS error converting data type varchar to float.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jul 2022 20:38:51 GMT</pubDate>
    <dc:creator>bsanders69</dc:creator>
    <dc:date>2022-07-07T20:38:51Z</dc:date>
    <item>
      <title>Using a sql view of another view to generate points on the fly for the past day of phone calls</title>
      <link>https://community.esri.com/t5/data-management-questions/using-a-sql-view-of-another-view-to-generate/m-p/1190576#M44102</link>
      <description>&lt;P&gt;I have joined another database that gives us a limited schema of emergency calls, but is in a state of constant growth.&amp;nbsp; My goal is to get those calls statistics mapped and into a Dashboard.&amp;nbsp; I created a view of another view to generate point geometries of the past 24 hours, but I am not having much success getting the view into Pro to generate a map.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;First view (selects and manipulates a running day of calls):&lt;/P&gt;&lt;P&gt;ALTER VIEW [sdeadmin].[FCALLS_w_LAT_LONG_vw]&lt;BR /&gt;AS&lt;BR /&gt;SELECT [CALL_NO]&lt;BR /&gt;,[CALL_TYPE_FINAL_D]&lt;BR /&gt;,[LOCATION]&lt;BR /&gt;,[LOCATION_ADDRESS]&lt;BR /&gt;,[APARTMENT]&lt;BR /&gt;,[BEAT] AS [STATION]&lt;BR /&gt;,[PRIMARY_UNIT]&lt;BR /&gt;,[XCOORD]&lt;BR /&gt;,[YCOORD]&lt;BR /&gt;,[CALL_CREATED_DATE]&lt;BR /&gt;,SUBSTRING([CALL_CREATED_TIME], 1, 2) + ':' + SUBSTRING([CALL_CREATED_TIME], 3, 2) + ':' + SUBSTRING([CALL_CREATED_TIME], 5, 2) AS [CALL_CREATED_TIME]&lt;BR /&gt;,SUBSTRING([CALL_DISPATCH_TIME], 1, 2) + ':' + SUBSTRING([CALL_DISPATCH_TIME], 3, 2) + ':' + SUBSTRING([CALL_DISPATCH_TIME], 5, 2) AS [CALL_DISPATCH_TIME]&lt;BR /&gt;,SUBSTRING([CALL_ENROUTE_TIME], 1, 2) + ':' + SUBSTRING([CALL_ENROUTE_TIME], 3, 2) + ':' + SUBSTRING([CALL_ENROUTE_TIME], 5, 2) AS [CALL_ENROUTE_TIME]&lt;BR /&gt;,SUBSTRING([CALL_ONSCENE_TIME], 1, 2) + ':' + SUBSTRING([CALL_ONSCENE_TIME], 3, 2) + ':' + SUBSTRING([CALL_ONSCENE_TIME], 5, 2) AS [CALL_ONSCENE_TIME]&lt;BR /&gt;,SUBSTRING([CALL_CLOSE_TIME], 1, 2) + ':' + SUBSTRING([CALL_CLOSE_TIME], 3, 2) + ':' + SUBSTRING([CALL_CLOSE_TIME], 5, 2) AS [CALL_CLOSE_TIME]&lt;BR /&gt;,CAST(REPLACE([XCOORD],',','') AS FLOAT) AS LONG&lt;BR /&gt;,CAST(REPLACE([YCOORD],',','') AS FLOAT) AS LAT&lt;BR /&gt;,GETDATE() - 1 as Date_Time&lt;BR /&gt;FROM [TIBCADWH\Tiburon].[DWLIVE].[dbo].[FCalls]&lt;BR /&gt;WHERE [CALL_TYPE_FINAL_D] NOT IN ('ADMIN STATUS', 'Training') AND [CALL_CREATED_DATE] + CAST(SUBSTRING([CALL_CREATED_TIME], 1, 2) + ':' + SUBSTRING([CALL_CREATED_TIME], 3, 2) + ':' + SUBSTRING([CALL_CREATED_TIME], 5, 2) AS DATETIME) &amp;gt;= DATEADD(DAY,-1, CAST(GETDATE() AS DATE))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second View (pulls final fields, generates OBJECTID from the Call ID that I need to strip out first character in the call number field (unique) to make a numeric value and then create the point geometry:&lt;/P&gt;&lt;P&gt;ALTER View [sdeadmin].[FCALLS_w_Shape_vw]&lt;BR /&gt;AS&lt;BR /&gt;SELECT CAST(SUBSTRING([CALL_NO],2,10) AS INT) as OBJECTID&lt;BR /&gt;,CALL_NO, CALL_TYPE_FINAL_D, LOCATION, LOCATION_ADDRESS, APARTMENT, STATION, PRIMARY_UNIT, XCOORD, YCOORD, CALL_CREATED_DATE, CALL_CREATED_TIME, CALL_DISPATCH_TIME, CALL_ENROUTE_TIME&lt;BR /&gt;,CALL_ONSCENE_TIME, CALL_CLOSE_TIME, LONG, LAT, Date_Time&lt;BR /&gt;,geography::Point(LAT, LONG, 4326) AS SHAPE&lt;/P&gt;&lt;P&gt;FROM [sdeadmin].[FCALLS_w_LAT_LONG_vw]&lt;BR /&gt;GO&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This does create geometries in SSMS and imports into Arc Pro (Enterprise 10.9.1, Pro 2.9.3) but does not draw features or open the table without an error: Underlying DBMS error converting data type varchar to float.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 20:38:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/using-a-sql-view-of-another-view-to-generate/m-p/1190576#M44102</guid>
      <dc:creator>bsanders69</dc:creator>
      <dc:date>2022-07-07T20:38:51Z</dc:date>
    </item>
  </channel>
</rss>

