edit: SQL Server 2008
SELECT DISTINCT h.TagName, h.Value, Entry = '5', MIN(h.DateTime)
FROM LineNumber L
INNER REMOTE JOIN INSQL.RunTime.dbo.StringHistory h ON L.Tagname = h.Tagname
WHERE L.Line = 'L155' AND h.Value != 'NULL' AND NULLIF (h.Value,') !- 'NULL'
GROUP BY h.TagName, Value
So the goal of this is to, first, compare the input Line against a database (LineNumber) containing all Tagnames and which Line they relate to. Then look through the StringHistory database for all those Tagnames, and return only the distinct rows in
the select statement. The error(s) I am getting is/are:
OLE DB provider "INSQL" for linked server "INSQL" returned message "History queries must contain at least one valid tagname".
Cannot execute the query "SELECT tbl11007.DateTime Co11015.Tagname etc" against OLE DB provider "INSQL" for linked server "INSQL".
I have a similar query tested and working, but isn't doing a SELECT DISTINCT, just a SELECT. I cannot, for the life of me, figure out what the problem is.
View Complete Post