AnsweredAssumed Answered

Help getting data from SQLServer with custom query in my JavaScript Application

Question asked by thejohnny on Apr 28, 2016
Latest reply on May 3, 2016 by thejohnny

Here is my current scenario.

 

I need to gain access to a SQL Server called say, SERVER1.  Below is the custom SQL Query that I Need to utilize in order to get the most recent GPS record.  I can't seem to figure out how to utilize this in my JavaScript Application to get this data.  Of course once I get the data I need to dig into it to get the lat/lon, convert it, then map it.  One step at a time. Perhaps using $.ajax to do a GET but not quite sure how to go about this.

 

SQL Query:

 

SELECT S.MSGTEXT
FROM [dbo].[Syslogd] S
INNER JOIN
(SELECT T.[MsgDate] AS 'MSGDATE' ,MAX(L.[MsgTime]) AS 'MSGTIME'
FROM [KiwiSysLog].[dbo].[Syslogd] L
INNER JOIN
(SELECT MAX(MSGDATE) AS 'MSGDATE' FROM [dbo].[Syslogd]) T
ON L.MsgDate = T.MSGDATE
GROUP BY T.MSGDATE) DT
ON S.MsgDate = DT.MSGDATE AND S.MsgTime = DT.MSGTIME

 

 

Results in Microsoft SQL Server Management Studio Express:

$GPGGA,222020.0,3609.839478,N,11509.243300,W,1,08,0.8,618.9,M,-18.0,M,,,9999*4F  $GPRMC,222020.0,A,3609.839478,N,11509.243300,W,1.1,302.7,270416,0.0,E,A,9999*34

 

I appreciate the help.

John

Outcomes