cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
zathe
Level I

JSL fetching records 3x from SQL database

Hiya guys!  I'm querying a boat load of historical data and I've noticed that the fetching rows pop up counts up to about 3x the number of rows that load (number of rows that load is approx. correct).  I'm getting data 1 month at a time (it breaks if I ask for more) and the data logger runs just over 1Hz which means I should get around 2.5e6 rows at a time but the system says it fetches 7.5e6 rows

 

Here is the snippet of code that does the query

Open Database(
	"driver={SQL Server}; Server=XXXXXXXXXX; database=Runtime; trusted_connection=yes;",
	"SET NOCOUNT ON
	DECLARE @StartDate DateTime
	DECLARE @EndDate DateTime  
	SET @StartDate = '2023-5-1 00:00:00' 
	SET @EndDate = '2023-5-31 23:59:59'
	SELECT temp.TagName, DateTime = convert(varchar, DateTime, 126), vValue From (
	SELECT * FROM History WHERE History.TagName IN (" || tagnamelist || ")
	
	AND vValue IS NOT NULL 
	AND wwRetrievalMode = 'Delta'
	AND wwVersion = 'Latest'
	AND DateTime >= @StartDate
	AND DateTime <= @EndDate) temp
	LEFT JOIN AnalogTag ON AnalogTag.TagName = temp.TagName
	LEFT JOIN EngineeringUnit ON AnalogTag.EUKey = EngineeringUnit.EUKey
	LEFT JOIN QualityMap ON QualityMap.QualityDetail = temp.QualityDetail
	WHERE temp.StartDateTime >= @StartDate"
);

And the screen capture of the pop up near the end of the query

Capture.PNG

 

Cheers,

Zach

0 REPLIES 0