简体   繁体   English

SQL Server Historian查询布尔值总时间

[英]SQL Server Historian Query Boolean Total Time

I am trying to query a wonderware historian to calculate total time a tag was reading True (or False) within a set period of time. 我试图查询一个Wonderware历史学家,以计算标签在设定的时间内读取True(或False)的总时间。 I can't get the query to even give me values for the Boolean tag. 我什至无法获得查询,甚至无法为我提供Boolean标签的值。 I am not sure if I am using the wrong retrieval method, but even 'FULL' doesn't result in any results being returned. 我不确定是否使用了错误的检索方法,但是即使“ FULL”也不会导致返回任何结果。 I know that there is data for that tag - the DCS software can trend historical values for that tag with a true/false line. 我知道该标签有数据-DCS软件可以使用真/假行来显示该标签的历史值。

Is there something different with SQL server or T-SQL (which is what I think it uses) that you have to do to get boolean values? 要获取布尔值,SQL Server或T-SQL(我认为它使用的是什么)有什么不同吗?

Providing you have historian client installed, you can try this: 如果您已安装了historian客户端,则可以尝试以下操作:

Use the Historian Client Query tool. 使用Historian客户查询工具。 Under "Query type", choose History values. 在“查询类型”下,选择“历史记录值”。 Browse to your discrete tag. 浏览到您的离散标签。 Choose retrieval mode "Full". 选择检索模式“完全”。 You should be able to press "SQL" to see what query is used in order to retrieve these values. 您应该能够按“ SQL”来查看使用什么查询来检索这些值。

If no values are showing, are you sure the tag value is actually changing in this time period? 如果没有显示任何值,您确定标记值在此时间段内实际上在变化吗? Is ForceStoragePeriod set too high for this tag? 此标签的ForceStoragePeriod是否设置得太高?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM