0% found this document useful (0 votes)
93 views

In SQ L Database

insql

Uploaded by

anhdv1979
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views

In SQ L Database

insql

Uploaded by

anhdv1979
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 226

Wonderware® FactorySuite®

IndustrialSQL Server™ Historian Database


Reference

Revision E
Last Revision: 7/13/05

Invensys Systems, Inc.


All rights reserved. No part of this documentation shall be reproduced, stored
in a retrieval system, or transmitted by any means, electronic, mechanical,
photocopying, recording, or otherwise, without the prior written permission of
Invensys Systems, Inc. No copyright or patent liability is assumed with respect
to the use of the information contained herein. Although every precaution has
been taken in the preparation of this documentation, the publisher and the
author assume no responsibility for errors or omissions. Neither is any liability
assumed for damages resulting from the use of the information contained
herein.
The information in this documentation is subject to change without notice and
does not represent a commitment on the part of Invensys Systems, Inc. The
software described in this documentation is furnished under a license or
nondisclosure agreement. This software may be used or copied only in
accordance with the terms of these agreements.

© 2002-2005 Invensys Systems, Inc. All Rights Reserved.

Invensys Systems, Inc.


26561 Rancho Parkway South
Lake Forest, CA 92630 U.S.A.
(949) 727-3200
http://www.wonderware.com

Trademarks
All terms mentioned in this documentation that are known to be trademarks or
service marks have been appropriately capitalized. Invensys Systems, Inc.
cannot attest to the accuracy of this information. Use of a term in this
documentation should not be regarded as affecting the validity of any
trademark or service mark.
Alarm Logger, ActiveFactory, ArchestrA, Avantis, DBDump, DBLoad, DT
Analyst, FactoryFocus, FactoryOffice, FactorySuite, FactorySuite A2, InBatch,
InControl, IndustrialRAD, IndustrialSQL Server, InTouch, InTrack,
MaintenanceSuite, MuniSuite, QI Analyst, SCADAlarm, SCADASuite,
SuiteLink, SuiteVoyager, WindowMaker, WindowViewer, Wonderware, and
Wonderware Logger are trademarks of Invensys plc, its subsidiaries and
affiliates. All other brands may be trademarks of their respective owners.
Contents 3

Contents
Before You Begin ............................................. 11
About this Guide ...................................................................................11
IndustrialSQL Server Documentation Set.............................................11
Document Conventions ........................................................................ 12

CHAPTER 1: Table Categories ........................13


History Tables ...................................................................................... 13
History Table Format........................................................................ 14
"Wide" History Table Format ........................................................... 15
"Live" Table Format ......................................................................... 16
Event Tables ......................................................................................... 17
InTouch Integration Tables................................................................... 17
Modification Tracking Tables .............................................................. 18
Namespaces and Grouping Tables ....................................................... 18
Tag Definition Tables ........................................................................... 18
System Configuration Tables ............................................................... 19
ArchestrA Browsing Tables ................................................................. 19

CHAPTER 2: Tables..........................................21
Accessing Information About a Database Table .................................. 21
aaAreaData ........................................................................................... 21
aaAreaXML.......................................................................................... 22
aaAttributeData .................................................................................... 22
aaAttributeDataPending ....................................................................... 23
aaObjectData ........................................................................................ 23
aaObjectDataPending ........................................................................... 24
ActionType ........................................................................................... 24
AnalogSnapshot ................................................................................... 25
AnalogTag ............................................................................................ 25
Annotation............................................................................................ 27
BlobTag ................................................................................................ 28
CalcType............................................................................................... 28
ConfigStatusPending ............................................................................ 28
ConfigStatusSnapshot .......................................................................... 29
Context ................................................................................................. 29
DetectorType ........................................................................................ 30
Deviation .............................................................................................. 30
DiscreteSnapshot.................................................................................. 31
DiscreteTag........................................................................................... 32

IndustrialSQL Server Historian Database Reference


4 Contents

EngineeringUnit ....................................................................................32
EnumeratedTag .....................................................................................33
EnumerationType ..................................................................................33
ErrorLog................................................................................................34
EventHistory .........................................................................................34
EventTag ...............................................................................................35
EventTagPendingDelete........................................................................37
Frequency..............................................................................................37
HistorianSysObjects..............................................................................38
History (INSQL.Runtime.dbo.History) ................................................38
HistoryBlock (INSQL.Runtime.dbo.HistoryBlock) .............................42
InTouchNode.........................................................................................43
InTouchSpecific ....................................................................................44
IODriver ................................................................................................45
IOServer ................................................................................................47
IOServerType ........................................................................................48
Limit......................................................................................................49
LimitName ............................................................................................50
Live (INSQL.Runtime.dbo.Live)..........................................................50
LocalizedText........................................................................................51
Message.................................................................................................52
ModLogColumn....................................................................................52
ModLogTable........................................................................................53
OPCQualityMap....................................................................................54
PrivateGroupTag ...................................................................................54
PrivateNameSpace ................................................................................54
PublicGroupTag ....................................................................................55
PublicNameSpace .................................................................................56
QualityMap ...........................................................................................56
RateOfChange.......................................................................................57
ServerList ..............................................................................................57
SnapshotDetail ......................................................................................58
SnapshotTag ..........................................................................................58
SQLTemplate.........................................................................................59
StateWideHistory (INSQL.Runtime.dbo.StateWideHistory)................59
StorageLocation ....................................................................................62
StorageNode..........................................................................................63
StringSnapshot ......................................................................................65
StringTag ...............................................................................................65
SummaryData........................................................................................66
SummaryHistory ...................................................................................66
SummaryOperation ...............................................................................67
SummaryTagList ...................................................................................68

IndustrialSQL Server Historian Database Reference


Contents 5

SystemParameter.................................................................................. 69
Tag ........................................................................................................ 69
TagRef .................................................................................................. 73
TimeDetectorDetail .............................................................................. 73
TimeDetectorDetailPendingDelete ...................................................... 74
TimeZone ............................................................................................. 74
Topic..................................................................................................... 75
TopicImportInfo ................................................................................... 76
UserDetail............................................................................................. 77
WideHistory (INSQL.Runtime.dbo.WideHistory)............................... 77

CHAPTER 3: Views...........................................83
History Table Views ............................................................................. 83
v_EventSnapshot.................................................................................. 84
v_EventStringSnapshot ........................................................................ 84
v_ModTracking .................................................................................... 85
v_SnapshotData.................................................................................... 86
v_SummaryData................................................................................... 87

CHAPTER 4: Stored Procedures.....................89


Stored Procedures................................................................................. 89
aaActionStringSelect ........................................................................ 89
aaAddTag .......................................................................................... 90
aaAnalogTagDelete........................................................................... 92
aaAnalogTagInsert............................................................................ 92
aaAnalogTagSelect ........................................................................... 96
aaAnalogTagUpdate ......................................................................... 96
aaAnnotationDelete .......................................................................... 97
aaAnnotationInsert............................................................................ 97
aaAnnotationRetrieve ....................................................................... 98
aaAnnotationSelect ........................................................................... 99
aaAnnotationUpdate ......................................................................... 99
aaArchestrANSClear ........................................................................ 99
aaCleanupAfterCommit.................................................................. 100
aaCleanupSystemNotRunning........................................................ 100
aaCommitChanges.......................................................................... 100
aaCommitChangesAtStartup .......................................................... 101
aaContextDelete.............................................................................. 101
aaContextInsert ............................................................................... 102
aaContextSelect .............................................................................. 102
aaContextUpdate ............................................................................ 103
aaDBChangesPending .................................................................... 103
aaDBConfig .................................................................................... 103
aaDeleteOlderEvents ...................................................................... 104
aaDeleteOlderSummaries ............................................................... 104

IndustrialSQL Server Historian Database Reference


6 Contents

aaDeleteTag .....................................................................................104
aaDetectorStringSelect ....................................................................105
aaDiscreteTagDelete........................................................................105
aaDiscreteTagInsert .........................................................................105
aaDiscreteTagSelect ........................................................................108
aaDiscreteTagUpdate.......................................................................108
aaEngineeringUnitDelete ................................................................109
aaEngineeringUnitInsert..................................................................109
aaEngineeringUnitSelect .................................................................110
aaEngineeringUnitUpdate ............................................................... 111
aaEventDetection.............................................................................111
aaEventHistoryInsert .......................................................................112
aaEventHistorySelect ......................................................................113
aaEventSnapshotInsert ....................................................................113
aaEventSnapshotSelect....................................................................114
aaEventTagDelete............................................................................114
aaEventTagDetail ............................................................................115
aaEventTagInsert .............................................................................115
aaEventTagSelect ............................................................................118
aaEventTagSelectAll .......................................................................118
aaEventTagSelectDeleted ................................................................118
aaEventTagSelectDisabled ..............................................................119
aaEventTagSelectInserted................................................................119
aaEventTagSelectUpdated ...............................................................119
aaEventTagUpdate...........................................................................119
aaGetDbRevision.............................................................................120
aaGetLastTagKey ............................................................................120
aaHistorianConfigNSExpand ..........................................................121
aaHistorianNSExpand .....................................................................121
aaHistorianStatusSelect ...................................................................121
aaHistorianStatusSet........................................................................122
aaHistoryBlockSelect ......................................................................123
aaInTouchNodeTagList ...................................................................123
aaIODriverDelete ............................................................................124
aaIODriverInsert..............................................................................124
aaIODriverSelect .............................................................................126
aaIODriverUpdate ...........................................................................126
aaIOServerDelete ............................................................................127
aaIOServerInsert..............................................................................127
aaIOServerSelect .............................................................................129
aaIOServerTypeDelete ....................................................................129
aaIOServerTypeInsert......................................................................130
aaIOServerTypeSelect .....................................................................130
aaIOServerTypeUpdate ...................................................................131
aaIOServerUpdate ...........................................................................131
aaLimitDelete ..................................................................................132
aaLimitInsert....................................................................................132
aaLimitNameDelete.........................................................................133
aaLimitNameInsert ..........................................................................133

IndustrialSQL Server Historian Database Reference


Contents 7

aaLimitNameSelect ........................................................................ 134


aaLimitNameUpdate....................................................................... 134
aaLimitSelect .................................................................................. 135
aaLimitUpdate ................................................................................ 135
aaMessageDelete ............................................................................ 135
aaMessageInsert.............................................................................. 136
aaMessageSelect ............................................................................. 136
aaMessageUpdate ........................................................................... 137
aaModLogStatus ............................................................................. 137
aaPrivateNSAddGroup ................................................................... 138
aaPrivateNSAddLeaf ...................................................................... 138
aaPrivateNSDeleteGroup................................................................ 139
aaPrivateNSDeleteLeaf .................................................................. 139
aaPrivateNSExpand ........................................................................ 139
aaPrivateNSSelect .......................................................................... 140
aaPrivateNSUpdateGroup .............................................................. 140
aaPublicNSAddGroup .................................................................... 141
aaPublicNSAddLeaf ....................................................................... 141
aaPublicNSDeleteGroup................................................................. 142
aaPublicNSDeleteLeaf.................................................................... 142
aaPublicNSExpand ......................................................................... 143
aaPublicNSSelect............................................................................ 143
aaPublicNSUpdateGroup................................................................ 143
aaRedirectToInTouch...................................................................... 144
aaSetAISamples.............................................................................. 145
aaSetCalculatedAISamples............................................................. 145
aaSetServerTimeStamp................................................................... 146
aaSetStorageRule............................................................................ 146
aaSetTagStorage ............................................................................. 148
aaSnapshotDetailSelect .................................................................. 149
aaSnapshotDetailUpdate................................................................. 149
aaSnapToSummary ......................................................................... 150
aaSpaceManager ............................................................................. 150
aaStorageLocationSelect................................................................. 151
aaStorageLocationUpdate............................................................... 151
aaStringTagDelete........................................................................... 152
aaStringTagInsert ............................................................................ 153
aaStringTagSelect ........................................................................... 155
aaStringTagUpdate ......................................................................... 155
aaSummaryActionInsert ................................................................. 156
aaSummaryDetail ........................................................................... 156
aaSummaryOperationDelete........................................................... 157
aaSummaryOperationInsert ............................................................ 158
aaSummaryOperationSelect ........................................................... 158
aaSummaryOperationUpdate.......................................................... 159
aaSummaryTagListDelete............................................................... 159
aaSummaryTagListInsert................................................................ 160
aaSummaryTagListSelect ............................................................... 161
aaSummaryTagListUpdate ............................................................. 161

IndustrialSQL Server Historian Database Reference


8 Contents

aaSystemConfigNSExpand .............................................................162
aaSystemNSExpand ........................................................................162
aaSystemNSExpand2 ......................................................................163
aaSystemParameterSelect................................................................163
aaSystemParameterUpdate ..............................................................164
aaTagConfig ....................................................................................164
aaTagConfigModified......................................................................164
aaTagConfigSelect...........................................................................165
aaTagInfo .........................................................................................165
aaTagType........................................................................................166
aaTimeDetectorDetailInsert.............................................................166
aaTimeDetectorDetailSelect............................................................167
aaTimeDetectorDetailUpdate ..........................................................167
aaTopicDelete ..................................................................................168
aaTopicInsert ...................................................................................168
aaTopicSelect...................................................................................169
aaTopicUpdate.................................................................................170
aaUpdateCalculatedAISamples .......................................................170
aaUserAccessLevelSelect................................................................171
aaUserDetailUpdate.........................................................................171
Extended Stored Procedures ...............................................................171
History Extended Stored Procedures...............................................172
Utility Extended Stored Procedures ................................................173
Extended Stored Procedure Arguments...........................................176
System Extended Stored Procedures ...............................................178
Stored Procedures for Internal Use .....................................................180
Creating Stored Procedures.................................................................181

CHAPTER 5: User-Defined Functions ..........183


faaCheckLicenseViolation ..................................................................183
faaContainedName..............................................................................184
faaGetLocalizedText ...........................................................................184
faaLicensedTagDetails ........................................................................184
faaLicensedTagTotal ...........................................................................185
faaObjectTagName..............................................................................186
faaTagsInLicenseViolation..................................................................186
faaTZgetdate .......................................................................................187
faaUser_ID ..........................................................................................188

CHAPTER 6: Backward Compatibility


Entities ............................................................189
Backward Compatibility Views ..........................................................189
History Table Views ........................................................................189
Summary Views...............................................................................190
NamedSystemParameter..................................................................191

IndustrialSQL Server Historian Database Reference


Contents 9

SystemNameSpace ......................................................................... 192


InSQLSysObjects ........................................................................... 192
v_ErrorLog ..................................................................................... 193
Backward Compatibility Tables ......................................................... 193
AnalogHistory (INSQL.Runtime.dbo.AnalogHistory) .................. 194
AnalogLive (INSQL.Runtime.dbo.AnalogLive)............................ 195
AnalogWideHistory ........................................................................ 195
ComplexHistory.............................................................................. 196
ComplexTag.................................................................................... 196
DiscreteHistory (INSQL.Runtime.dbo.DiscreteHistory) ............... 197
DiscreteLive (INSQL.Runtime.dbo.DiscreteLive)......................... 198
DiscreteWideHistory ..................................................................... 198
GroupTagList.................................................................................. 199
ManualAnalogHistory .................................................................... 199
ManualDiscreteHistory................................................................... 199
ManualStringHistory ...................................................................... 200
NameSpaceIcons ............................................................................ 201
StringHistory (INSQL.Runtime.dbo.StringHistory)....................... 201
StringLive (INSQL.Runtime.dbo.StringLive) ................................ 202
StringWideHistory .......................................................................... 202
TagGroup ........................................................................................ 203
WideTableDictionary...................................................................... 203
Renamed Tables.............................................................................. 203
Backward Compatibility Stored Procedures ...................................... 204
aaAnalogDetail ............................................................................... 204
aaDiscreteDetail.............................................................................. 204
aaStringDetail ................................................................................. 205
ww_CheckClientVersion ................................................................ 205
ww_CheckWhichDb....................................................................... 206
ww_dbCheck .................................................................................. 206
ww_DBConfig................................................................................ 206
ww_LoadInSQLProcedureBody .................................................... 207
ww_MDASAnalogTagInsert .......................................................... 207
ww_MDASAnalogTagUpdate........................................................ 207
ww_MDASDiscreteTagInsert......................................................... 208
ww_MDASDiscreteTagUpdate ...................................................... 208
ww_MDASStringTagInsert ............................................................ 208
ww_MDASStringTagUpdate.......................................................... 209
Renamed Stored Procedures ........................................................... 209
Backward Compatibility Functions.................................................... 213

Index................................................................215

IndustrialSQL Server Historian Database Reference


10 Contents

IndustrialSQL Server Historian Database Reference


Before You Begin 11

Before You Begin

About this Guide


This IndustrialSQL Server™ Historian Database Reference describes the
database model of the IndustrialSQL Server system. Each database entity is
described, and the relationships between the entities are defined. It is very
important that you understand these data structures and relationships to
effectively query the IndustrialSQL Server historian and build productive
client applications that interact with it.

IndustrialSQL Server Documentation Set


The IndustrialSQL Server historian documentation set includes the following
guides:
• IndustrialSQL Server Historian Installation Guide. This guide provides
information on installing the IndustrialSQL Server historian, including
hardware and software requirements and migration instructions.
• IndustrialSQL Server Historian Concepts Guide. This guide provides an
overview of the entire IndustrialSQL Server system and describes each of
the subsystems in detail.
• IndustrialSQL Server Historian Administration Guide. This guide
describes how to administer and maintain an installed IndustrialSQL
Server historian, such as configuring data acquisition and storage,
managing security, and monitoring the system.
• IndustrialSQL Server Historian Database Reference. This guide provides
documentation for all of the IndustrialSQL Server database entities, such
as tables, views, and stored procedures.
• IndustrialSQL Server Historian Enterprise Edition User’s Guide. This
guide describes IndustrialSQL Server failover clustering and provides
details on how to plan, configure, implement, and manage the
IndustrialSQL Server Enterprise historian.
• IndustrialSQL Server Historian Glossary. This guide provides definitions
for terms used throughout the documentation set.
A PDF file for each of these guides is available on the IndustrialSQL Server
historian installation CD. You can easily print information from the PDF files.
The IndustrialSQL Server historian documentation is also provided as an
online Help file, which can be accessed from the System Management Console
management tool.

IndustrialSQL Server Historian Database Reference


12 Before You Begin

Document Conventions
This documentation uses the following conventions:

Convention Used for


Initial Capitals Paths and filenames.
Bold Menus, commands, dialog box names, and dialog box
options.
Monospace Code samples and display text.

IndustrialSQL Server Historian Database Reference


Table Categories 13

C H A P T E R 1

Table Categories

There are eight table categories within the IndustrialSQL Server historian
Runtime database. Tables in a category together facilitate a particular
functionality in the historian.

Note Additional tables and views are provided for backward compatibility
support. For more information, see Chapter 6, "Backward Compatibility
Entities."

Contents
• History Tables
• Event Tables
• InTouch Integration Tables
• Modification Tracking Tables
• Namespaces and Grouping Tables
• Tag Definition Tables
• System Configuration Tables
• ArchestrA Browsing Tables

History Tables
Because normal Microsoft® SQL Server™ functionality cannot handle the
storage and retrieval of huge quantities of rapidly changing data, plant data
storage and retrieval are made possible by the IndustrialSQL Server storage
subsystem, the history tables, and the retrieval system.
Some of the history tables are implemented as normal SQL Server tables, and
the information contained in them is stored in the Runtime database file
(Run90Dat.mdf). Others are implemented as a special type of table called a
remote table, or extension table. Extension tables do not actually exist in the
database, but rather expose data that is stored in special history files (history
blocks) on disk via OLE DB technology.
For more information, see Chapter 6, "Data Retrieval Subsystem," in your
IndustrialSQL Server™ Historian Concepts Guide.

IndustrialSQL Server Historian Database Reference


14 Chapter 1

Acquired tag data can be presented in the history tables in three different
formats: a normal historical format, a "wide" format, and a "live" format.
Information about the history blocks is stored in the special HistoryBlock
extension table.
To make querying from the history tables easier, views have been provided.
Instead of specifying the table name using the required four-part syntax
(INSQL.Runtime.dbo.<tablename>), you can simply use the view name
instead. The history tables and associated views are listed in the following
table. (Backward compatibility tables and views are not included.)

Table Name (OLE DB Provider Syntax) Associated View


History (INSQL.Runtime.dbo.History) History
WideHistory (INSQL.Runtime.dbo.WideHistory) (none)
StateWideHistory (none)
(INSQL.Runtime.dbo.StateWideHistory)
Live (INSQL.Runtime.dbo.Live) Live
HistoryBlock (INSQL.Runtime.dbo.HistoryBlock) HistoryBlock

The History and Live tables can accommodate a mixture of tag types and
should be used for all queries. The vValue column returns a sql_variant for all
tag types. The Value column returns a float value for analog and discrete tags
and a NULL for string tags. The Value column is included to allow for
aggregation and other operations that are not permitted on a sql_variant
column.
You can relate these tables to other tables in the IndustrialSQL Server historian
database.
For more information on each of these tables, see the corresponding table
description in this documentation.

Note The AnalogHistory, DiscreteHistory, StringHistory, AnalogLive,


DiscreteLive, and StringLive tables are provided for backward compatibility
and can only accept tagnames in the SELECT statement that are of the same
type; that is, you cannot mix the tag types in the query without doing a
UNION.

The history tables that are listed in SQL Server Enterprise Manager under the
Tables tree item for the Runtime database (for example, History_OLEDB) are
simply definitions for the OLE DB provider to use; no data is stored in them.
The extension tables that actually provide data to clients are listed for the
INSQL or INSQLD linked servers under the Security tree item.

History Table Format


The History table presents acquired plant data in a historical format, which is
shown as follows:
DateTime TagName Value vValue Quality QualityDetail (continued...)

02:17:01:03 Temp1 78 78 0 192 (continued...)

02:17:01:03 Temp2 79 79 0 192 (continued...)

IndustrialSQL Server Historian Database Reference


Table Categories 15

02:17:01:03 Temp3 77 77 0 192 (continued...)

02:17:01:03 Temp4 80 80 0 192 (continued...)

02:17:01:04 Temp1 77 77 0 192 (continued...)

02:17:01:04 Temp2 78 78 0 192 (continued...)

02:17:01:04 Temp3 76 76 0 192 (continued...)

02:17:01:04 Temp4 79 79 0 192 (continued...)

02:17:01:05 Temp1 76 76 0 192 (continued...)

02:17:01:05 Temp2 77 77 0 192 (continued...)

02:17:01:05 Temp3 78 78 0 192 (continued...)

02:17:01:05 Temp4 80 80 0 192 (continued...)


There is one row for a single tag's value for a particular timestamp.

Note The AnalogHistory, DiscreteHistory, and StringHistory tables are


provided for backward compatibility and can only accept tagnames in the
SELECT statement that are of the same type; that is, you cannot mix the tag
types in the query without doing a UNION. The History table, however, can
accommodate a mixture of tag types and should be used instead of the
AnalogHistory, DiscreteHistory, or StringHistory tables. The Value column
returns a float value for analog and discrete tags, a NULL for string tags. The
vValue column returns a sql_variant for all tag types.

"Wide" History Table Format


The WideHistory table contains the same data as the History table, but in a
different format. The WideHistory table presents data for one or more tag
values for a single timestamp, thus providing a "wide" view of the data. To
query for values in the WideHistory table, you must specify the timestamp and
one or more tagnames as the column names in the query syntax. The results
will contain a column for the timestamp and columns for the value of each
specified tag at that timestamp. In the following example, Temp1, Temp2,
Temp3, and Temp4 are tagnames:
DateTime Temp1 Temp2 Temp3 Temp4

02:17:01:03 78 79 77 80
02:17:01:04 77 78 76 79

02:17:01:05 77 78 76 79

Using the History table to perform the same task is much more difficult.
You can also specify search criteria for the values you want to return (for
example, where Temp1 > 75). The WideHistory table can only be related to
other tables based on the timestamp.

IndustrialSQL Server Historian Database Reference


16 Chapter 1

Note The AnalogWideHistory, DiscreteWideHistory, and StringWideHistory


tables are provided for backward compatibility and can only accept tagnames
in the SELECT statement that are of the same type; that is, you can't mix the
tag types in the query. The WideHistory table, however, can accommodate a
mixture of tag types and should be used instead of the AnalogWideHistory,
DiscreteWideHistory, or StringWideHistory tables.

The WideHistory table column type returns a SQL Server type float for analog,
a SQL Server type int for discrete tags, and an nvarchar(512) for string tags.
The schema of the definition table, WideHistory_OLEDB, indicates a
sql_variant type. This is simply a shorthand notation; it does not represent the
type actually returned.
There is no Quality column for the WideHistory table because there is more
than one tag value for each row returned. However, a value returned for a
specified tag will be set to NULL if the quality of the value is invalid,
inhibited, or unavailable.
The following restrictions apply when performing a query against the
WideHistory table:
• Column names must be specified.
• The table is only accessible via the OPENQUERY statement.
Because tagnames are used for column names, the tagname can include any
characters as defined by the rules for Microsoft SQL Server identifiers. An
identifier that does not comply with the rules for the format of regular
identifiers must always be delimited using brackets ( [ ] ). For more
information on identifiers and delimiters, see your Microsoft SQL Server
documentation.
If you include an illegal column name in your query and do not use delimiters,
no data will be returned.
The StateWideHistory table is similar to the WideHistory table, except that it
allows for retrieval of calculated "time in state" values for multiple tags,
instead of actual history values. This table includes a Value and a vValue
column, and the tag columns contain the time in state for the corresponding
value. For more information on this table, see "StateWideHistory
(INSQL.Runtime.dbo.StateWideHistory)" on page 59. For information on how
to query this table, see "Time-in-State Retrieval Mode" on page 137 in your
IndustrialSQL Server™ Historian Concepts Guide.

"Live" Table Format


The Live table presents the current value of the specified tag(s). The format of
the Live table is as follows. The DateTime column will indicate the time the
value was received.
DateTime TagName Value vValue Quality QualityDetail (continued...)

02:17:01:05 Temp1 77 77 0 192 (continued...)

02:17:01:05 Temp2 78 78 0 192 (continued...)

02:17:01:05 Temp3 76 76 0 192 (continued...)

IndustrialSQL Server Historian Database Reference


Table Categories 17

02:17:01:05 Temp4 79 79 0 192 (continued...)

Note The AnalogLive, DiscreteLive, and StringLive tables are provided for
backward compatibility and can only accept tagnames in the SELECT
statement that are of the same type; that is, you can't mix the tag types in the
query. The Live table, however, can accommodate a mixture of tag types and
should be used instead of the AnalogLive, DiscreteLive, or StringLive tables.

Event Tables
Event tables contain definitions for events, including tags associated with
events, detectors for events, and actions for events. The event system tables
can also store "snapshots" of tag values at the time of an event, as well as
details about the event itself.
A special type of event action is a summarization of tag values. A subset of the
event tables provide the supporting framework for fully automated summary
generation for analog, discrete and string tags. The event system tables are:
ActionType AnalogSnapshot
CalcType DetectorType
DiscreteSnapshot EventHistory
EventTag EventTagPendingDelete*
Frequency SnapshotTag
SQLTemplate StringSnapshot
SummaryData SummaryHistory
SummaryOperation SummaryTagList
Tag TimeDetectorDetail
TimeDetectorDetailPendingDelete*

* System-level table. Do not edit.

InTouch Integration Tables


The InTouch® integration tables contain information about tagname
definitions that are imported into the Runtime database from InTouch HMI
software. The InTouch integration tables are:
InTouchNode InTouchSpecific
TopicImportInfo

IndustrialSQL Server Historian Database Reference


18 Chapter 1

Modification Tracking Tables


The modification tracking tables contain information about changes that are
made to columns in the database. The modification tracking tables are:
HistorianSysObjects ModLogColumn
ModLogTable UserDetail

Namespaces and Grouping Tables


The namespaces and grouping tables contain information that defines how sets
of tags can be grouped together, for purposes such as alarming, displays, event
management and batch management. These tables also define hierarchies for
items in the system, public, or private namespaces. The namespaces and
grouping tables are:
PrivateGroupTag PrivateNameSpace
PublicGroupTag PublicNameSpace
ServerList Tag
TagRef UserDetail

Tag Definition Tables


Types of tags that can be defined in the IndustrialSQL Server historian are
analog, discrete, event, and string. All of these tag types have some attributes
that are the same, such as a tagname, a description, a storage rate, and so on.
These attributes are stored in the Tag table. Information specific to a particular
tag type, such as maximum and minimum values, limits, and engineering units,
is stored in related, type-specific tables. For example, the total definition for an
analog tag would be partially stored in the Tag table and partially stored in the
AnalogTag table.
The tag definition tables are:
AnalogTag Annotation
Context Deviation
DiscreteTag EngineeringUnit
EventTag Limit
LimitName Message
RateOfChange StringTag
Tag TagRef
Topic

IndustrialSQL Server Historian Database Reference


Table Categories 19

System Configuration Tables


All of the parameters for the IndustrialSQL Server historian are stored in the
system configuration tables. This includes information regarding the historian's
physical nodes, site-specific configuration parameters, and parameters
pertaining to the physical I/O equipment to which the system is connected. The
system configuration tables are:
ConfigStatusPending * ConfigStatusSnapshot*
ErrorLog IODriver
IOServer IOServerType
LocalizedText* OPCQualityMap
QualityMap SnapshotDetail
StorageLocation StorageNode
SystemParameter Tag
TimeZone* Topic
UserDetail

* System-level table. Do not edit.

ArchestrA Browsing Tables


The ArchestrA browsing tables store information required to support the
browsing of the ArchestrA model view hierarchy by IndustrialSQL Server
historian clients. The ArchestrA browsing tables are:
aaAreaData aaAreaXML
aaAttributeData aaAttributeDataPending
aaObjectData aaObjectDataPending

These tables are for internal use only.

IndustrialSQL Server Historian Database Reference


20 Chapter 1

IndustrialSQL Server Historian Database Reference


Tables 21

C H A P T E R 2

Tables

All of the information regarding how the system is configured is stored in


tables in the Runtime database. Event history, summary history, and summary
data are also stored in SQL Server tables. You can view details for all tables
using the Microsoft SQL Server Enterprise Manager.

Note Tables that have been retained for backward compatibility are listed in
Chapter 6, "Backward Compatibility Entities."

Contents
• Accessing Information About a Database Table

Accessing Information About a Database Table


To find out basic information about a database table, such as the columns,
primary and foreign keys, and indexes, use the sp_help stored procedure from
the Runtime database. For example:
sp_help AnalogTag
For information about referential integrity for a table, see the
InSQLDatabaseSchema.PDF.

aaAreaData
Contains one row for each item in the latest ArchestrA Area data package.

IndustrialSQL Server Historian Database Reference


22 Chapter 2

The Area data hierarchy is sent from ArchestrA to the historian in the form of
an XML data package. In addition to data about the Areas, this package also
contains data about the Galaxy, WinPlatforms, AppEngines, and
DeviceIntegration Objects.

Column Data Type Description


AreaKey int NOT NULL The unique identifier for the item in the Area
data hierarchy.
Category int NOT NULL The type of the item in the Area data
hierarchy. 0 = Galaxy; 1 = WinPlatform; 3 =
AppEngine; 13 = Area; 11 =
DDESuiteLinkClient, OPCClient or
InTouchProxy; 24 = RedundantDIObject. All
other values are reserved for future use.
AreaName nvarchar(255) NOT NULL The name of the item in the Area data
hierarchy.
ContainedName nvarchar(255) NULL The contained name (if relevant) of the item
in the Area data hierarchy.
(FK) ParentKey int NOT NULL The unique identifier for the parent item of
this item. For the Galaxy item, this value is 0.

aaAreaXML
Contains a single row describing the latest Area data sent from ArchestrA.

Column Data Type Description


Version bigint NULL The version number of the latest ArchestrA
Area data package.
AreaXML ntext NULL Reserved for future use.

aaAttributeData
Contains one row for each attribute referenced by an object in the ArchestrA
namespace.

Column Data Type Description


AttributeName nvarchar(256) NOT NULL The ArchestrA attribute name. This name
corresponds to an IndustrialSQL Server
historian tagname.
(FK) ObjectKey int NOT NULL ObjectKey is a foreign key from the
aaObjectData table.
wwDomainTagKey int NOT NULL The unique numerical identifier for the
ArchestrA attribute (historian tag) in a
specific domain.

IndustrialSQL Server Historian Database Reference


Tables 23

aaAttributeDataPending
Contains one row for each attribute in the latest ArchestrA attribute data
package.

Column Data Type Description


AttributeName nvarchar(256) NOT NULL The ArchestrA attribute name. This name
corresponds to an IndustrialSQL Server
historian tagname.
(FK) ObjectKey int NOT NULL ObjectKey is a foreign key from the
aaObjectDataPending table.

aaObjectData
Contains one row for each object in the ArchestrA namespace.

Column Data Type Description


ObjectKey int NOT NULL The unique identifier for the object. This
column does not have the same numeric value
as ObjectKey column of the
aaObjectDataPending table.
Type int NOT NULL The type of the object. 0 = Area; 1 =
ApplicationObject (regular); 2 = Traceability
object. All other values are reserved for future
use.
aaTagName nvarchar(256) NULL The ArchestrA tag name for the object.
ContainedName nvarchar(256) NULL The ArchestrA contained name for the object.
(FK) ParentKey int NOT NULL The unique identifier for the parent of this
object.
Status tinyint NOT NULL Used to indicate whether a name change has
occurred. 0 = No change; 1 = The tag name
has changed; 2 = The contained name has
changed. The default is 0.

IndustrialSQL Server Historian Database Reference


24 Chapter 2

aaObjectDataPending
Contains one row for each object in the latest ArchestrA object data package.

Column Data Type Description


ObjectKey int NOT NULL The unique identifier for the object. This
identifier is unique only within an object data
package and may be repeated in subsequent
data packages.
Type int NOT NULL The type of the object. 0 = Area; 1 =
ApplicationObject (regular); 2 = Traceability
object. All other values are reserved for future
use.
aaTagName nvarchar(256) NULL The ArchestrA tag name for the object.
ContainedName nvarchar(256) NULL The ArchestrA contained name for the object.
(FK) ParentKey int NOT NULL The unique identifier for the parent of this
object.

ActionType
Contains one row for each type of event action.

Column Data Type Description


ActionTypeKey int IDENTITY The unique identifier for a particular type
of action. Event tags and actions are linked
via this key. The event subsystem relies on
the following values, which are added
during installation: 1 = No action; 2 =
Generic SQL; 3 = Snapshot; 4 = E-mail; 5
= Deadband; 6 = Summary. This value is
automatically generated when a new action
is created.
Name nvarchar(33) NOT NULL The name given to the type of action.
Description nvarchar(50) NULL The description of the action.
EditorClassName nvarchar(80) NULL The name by which the component is
referenced by a client application, such as
the InSQL Console, in order to provide a
visual representation.
ActionClassName nvarchar(80) NULL The name by which the action component
(COM object) is referenced in the system
in order to perform the action.

IndustrialSQL Server Historian Database Reference


Tables 25

AnalogSnapshot
Contains one row for each analog tag value that was configured to be stored
when a defined event occurred. To view analog, discrete, and string snapshot
values at the same time, use the v_SnapshotData view instead. For more
information, see "v_SnapshotData" on page 86.

Column Data Type Description


(FK) SnapshotTagKey int NOT NULL The unique numerical identifier of the tag
included in the snapshot. SnapshotTagKey
is a foreign key from the SnapshotTag
table.
(FK) EventLogKey int NOT NULL The unique numerical identifier for the
event occurrence. EventLogKey is a
foreign key from the EventHistory table.
Value float(8) NULL The value of the tag at the time of the event
occurrence. Measured in engineering units.
Quality tinyint NOT NULL The basic data quality indicator associated
with the data value.
QualityDetail int NULL An internal representation of data quality.

AnalogTag
Contains one row for each defined analog tag. Configuration information
specific to analog tags is stored in this table, while general information for all
tag types is stored in the Tag table.

Column Data Type Description


(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system. TagName is
a foreign key from the Tag table.
(FK) EUKey int NOT NULL The unique numerical identifier for the
engineering unit. EUKey is a foreign key
from the EngineeringUnit table.
MinEU float(25) NOT NULL The minimum value of the tag, measured in
engineering units.
MaxEU float(25) NOT NULL The maximum value of the tag, measured
in engineering units.
MinRaw float(25) NULL The minimum value of the raw acquired
value.
MaxRaw float(25) NULL The maximum value of the raw acquired
value.

IndustrialSQL Server Historian Database Reference


26 Chapter 2

Column Data Type Description


Scaling int NOT NULL The type of algorithm used when scaling
from raw values to engineering units. For
linear scaling, the result is calculated using
linear interpolation between the end points.
0 = None; 1 = Linear; 2 = Square Root.
(Square root is reserved for future use).
RawType int NOT NULL The numeric type for the raw value. 1 =
Euro Float, an outdated data type (4 bytes);
2 = MS Float (4 bytes); 3 = Integer (2 or 4
bytes); 4 = MS Double (reserved for future
use) (8 bytes).
ValueDeadband float(25) NOT NULL The percentage of the difference between
the minimum and maximum engineering
units for the tag. Any data values that
change less than the specified deadband are
not stored. The value deadband applies to
delta storage only. A value of 0 indicates
that a value deadband will not be applied.
InitialValue float(25) NOT NULL The initial value as imported from an
external source (for example, from
InTouch). Reserved for future use.
IntegerSize tinyint NOT NULL The bit size of the analog tag. 12 = 12-bit;
15 = 15-bit; 16 = 16-bit; 32 = 32-bit; 64 =
64-bit (future implementation).
SignedInteger bit NOT NULL Used to specify whether an integer is a
signed number (positive or negative) or an
unsigned number (positive only). 0 =
Unsigned; 1 = Signed.
RateDeadband float(25) NOT NULL The percentage of deviation in the full-
scale value range for an analog tag. The
swinging door (rate) deadband applies to
delta storage only. Time and/or value
deadbands can be used in addition to the
swinging door deadband. Any value greater
than 0 can be used for the deadband. A
value of 0 indicates that a swinging door
deadband will not be applied. For more
information on swinging door storage, see
"Delta Storage" on page 71 in your
IndustrialSQL Server™ Historian
Concepts Guide.

IndustrialSQL Server Historian Database Reference


Tables 27

Column Data Type Description


InterpolationType tinyint NOT NULL The interpolation type for retrieval. 0 =
Stair-stepped interpolation; 1 = Linear
interpolation (if applicable, based on the
tag type); 254 = System default
interpolation mode. The system default
interpolation type is to use the system
default for the analog type, either integer or
real. The system default interpolation type
for an analog type is determined by the
setting of the InterpolationTypeInteger and
InterpolationTypeReal system parameters.
This setting impacts Interpolated, Average,
and Integral retrieval modes.
RolloverValue int NOT NULL The first value that causes the counter to
"roll over." This rollover value is used for
the "counter" retrieval mode. For example,
for a counter that counts from 0 to 9999,
the counter rolls over back to 0 for the
10,000th value it receives. Therefore, set
the rollover value to 10,000.

Annotation
Contains one row for each user annotation about a tag value. Users can make
personal (or public) notes about a tag value, and this information is stored
along with the tag value and timestamp to which the annotation applies. Each
annotation in this table is linked to a database user.

Column Data Type Description


AnnotationKey int IDENTITY The unique numerical identifier for the
annotation. This value is automatically
generated by the system when the
annotation is added.
(FK) UserKey int NOT NULL The unique numerical identifier for a
database user as defined in the UserDetail
table. UserKey is a foreign key from the
UserDetail table.
(FK) TagName nvarchar(256) NULL The unique name of the tag within the
IndustrialSQL Server system. TagName is
a foreign key from the Tag table.
DateCreated datetime NULL The date that the annotation was created.
Content nvarchar(1000) NOT The annotation text.
NULL
DateTime datetime NOT NULL The timestamp of the tag value for which
the user has made an annotation.
Value float(25) NULL The value of the tag at the time of the
annotation.

IndustrialSQL Server Historian Database Reference


28 Chapter 2

BlobTag
Reserved for future use. Do not use this table. Contains one row for each
defined blob tag.

Column Data Type Description


TagName nvarchar(256) NOT NULL Reserved for future use.
MaxLength int NOT NULL Reserved for future use.

CalcType
Contains one row for each type of summary calculation that can be performed
by the event subsystem.

Column Data Type Description


CalcType CalcTypes/char(3) NOT The type of calculation to be performed:
NULL SUM, MAX, MIN, or AVG.
Description nvarchar(50) NULL The description of the calculation.

ConfigStatusPending
Contains one row for each database modification that requires a re-
initialization of the system.

Important! Do not edit this table.

Column Data Type Description


ID int IDENTITY The unique identifier for the database
modification.
Type tinyint NOT NULL Used to indicate the type of object to which
the modifications apply. 0 = IDAS; 1 =
IOServer; 2 = Topic; 3 = Tag; 4 =
StorageLocation; 5 = SnapshotDetail; 6 =
NamedSystemParameter; 7 =
EngineeringUnit.

IndustrialSQL Server Historian Database Reference


Tables 29

Column Data Type Description


ObjectKey int NOT NULL The unique identifier of the modified
object. If the modified object is a system
parameter, the value will be 0. For all other
object types, the value is from one of the
following tables and columns:
IODriver.IODriverKey;
IOServer.IOServerKey; Topic.TopicKey;
Tag.wwTagKey;
StorageLocation.StorageType;
SnapshotDetail.StorageSize.
Status tinyint NULL Used to indicate the type of modification. 1
= Insert; 2 = Update; 3 = Delete; 6 = The
tag's source has changed (that is, if the
value of the IOServerKey or TopicKey
column in the Tag table has changed).

ConfigStatusSnapshot
When changes to the historian system are committed, a snapshot of the content
of the ConfigStatusPending table is stored to this table. The internal
configuration object then finishes processing the reinitialization based on the
data in this table, while any new changes are being stored in the
ConfigStatusPending table.
The columns in this table are identical to the columns in the
ConfigStatusPending table.

Important! Do not edit this table.

Context
Contains one row for each context to which a group of limits, rates of change,
or deviations can belong. Example contexts are "Normal Operation" and "Cold
Shutdown."

Column Data Type Description


ContextKey int IDENTITY The unique numerical identifier for the
context. This value is automatically
generated when a new context is added.
Description nvarchar(50) NOT NULL The description of the context.

IndustrialSQL Server Historian Database Reference


30 Chapter 2

DetectorType
Contains one row for each type of event detector.

Column Data Type Description


DetectorTypeKey int IDENTITY The unique identifier for a particular type
of detector. Event tags and detectors are
linked via this key. The event system relies
on the following values, which are added
during installation: 1 = System; 2 =
External event; 3 = Generic SQL; 4 =
Analog specific value; 5 = Discrete
specific value; 6 = Time-based (schedule).
This value is automatically generated when
a new detector is created.
Name nvarchar(33) NOT NULL The name given to the type of detector.
Description nvarchar(50) NULL The description of the detector.
EditorClassName nvarchar(80) NULL The name by which the component is
referenced by a client application, such as
the InSQL Console, in order to provide a
visual representation.
DetectorClassName nvarchar(80) NULL The name by which the detector
component (COM object) is referenced in
the system in order to perform the
detection.
ExecutionMode tinyint NOT NULL Used to specify the manner in which the
detector executes. 0 = Executed cyclically
by the event subsystem according to the
event tag scan rate; 1 = Asynchronous and
triggered by an external mechanism. The
default is 0.

Deviation
Contains one row for each defined deviation for an analog tag. The deviation is
the percentage of change in a tag's value from a fixed value, called the target.
Each analog tag can have two defined deviations: major and minor. This table
is populated when an InTouch application is imported and is not used by the
IndustrialSQL Server historian.

Column Data Type Description


(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system. TagName is
a foreign key from the Tag table.
(FK) ContextKey int NOT NULL The unique numerical identifier for the
context. ContextKey is a foreign key from
the Context table.

IndustrialSQL Server Historian Database Reference


Tables 31

Column Data Type Description


MinorDeviation real NULL The percentage that the tag can deviate
from the target value before a minor
deviation alarm condition is produced.
MinorChecked bit NOT NULL Used to determine the alarm state of the tag
based on the minor deviation. 0 = Not in an
alarm condition; 1 = In an alarm condition.
MinorPriority int NULL The priority level for the minor deviation.
Valid values are numbers between 1 and
999, with 1 being the highest priority and
999 being the lowest priority.
MajorDeviation real NULL The percentage that the tag can deviate
from the target value before a major
deviation alarm condition is produced.
MajorChecked bit NOT NULL Used to determine the alarm state of the tag
based on the major deviation. 0 = Not in an
alarm condition; 1 = In an alarm condition.
MajorPriority int NULL The priority level for the major deviation.
Valid values are numbers between 1 and
999, with 1 being the highest priority and
999 being the lowest priority.
Target float(8) NULL The reference value of the tagname from
which minor and/or major deviation
percentages are based.
Deadband real NULL The deviation percentage the tag value
must drop below the target before the tag is
taken out of alarm.

DiscreteSnapshot
Contains one row for each discrete tag value that was configured to be stored
when a defined event occurred. To view analog, discrete, and string snapshot
values at the same time, use the v_SnapshotData view instead. For more
information, see "v_SnapshotData" on page 86.

Column Data Type Description


(FK) SnapshotTagKey int NOT NULL The unique numerical identifier of the tag
included in the snapshot. SnapshotTagKey
is a foreign key from the SnapshotTag
table.
(FK) EventLogKey int NOT NULL The unique numerical identifier for the
event occurrence. EventLogKey is a
foreign key from the EventHistory table.
Value tinyint NULL The state of the discrete tag at the time that
the event occurred. 0 = FALSE; 1 = TRUE.

IndustrialSQL Server Historian Database Reference


32 Chapter 2

Column Data Type Description


Quality tinyint NOT NULL The basic data quality indicator associated
with the data value.
QualityDetail int NULL An internal representation of data quality.

DiscreteTag
Contains one row for each defined discrete tag. Configuration information
specific to discrete tags is stored in this table, while general information for all
tag types is stored in the Tag table.

Column Data Type Description


(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system. TagName is
a foreign key from the Tag table.
(FK) MessageKey int NOT NULL The unique numerical identifier for a
TRUE/FALSE message pair that can be
associated with a discrete tag. MessageKey
is a foreign key from the Message table.
InitialValue tinyint NOT NULL The initial value as imported from an
external source (for example, from
InTouch).

EngineeringUnit
Contains one row for each defined engineering unit (unit of measure).

Column Data Type Description


EUKey int IDENTITY The unique numerical identifier for the
engineering unit. This value is
automatically generated by the system
when the engineering unit is added.
Unit nvarchar(32) NULL The unit of measure. Examples are mph,
grams, and pounds.

IndustrialSQL Server Historian Database Reference


Tables 33

Column Data Type Description


DefaultTagRate int NULL The default rate, in milliseconds, at which
tags are cyclically stored, based on
engineering units. Although the system
does not make use of this engineering unit
based tag rate, you can reference this value
in custom SQL scripts. The value you enter
for this tag rate does not affect the default
storage rate set for the tag.
IntegralDivisor float(25) NOT NULL The factor to be applied when integrating a
rate with the units [EngUnits/TimeUnit] to
a quantity with units [EngUnits]. This
factor is called the integral divisor. The
default value of 1 assumes a time unit of
seconds and ensures that a rate of [Unit/
second] is correctly integrated to [Unit].
For a time unit of minutes, set the integral
divisor value to 60; for a unit of hours, set
the integral divisor value to 3600, and so
on. The integral divisor is applied similarly
to rates or quantities that are not expressed
in terms of a time unit. For example, to
convert watts to watt-hours, the integral
divisor is 1/3600. To convert watts to
kilowatt-hours, the integral divisor is 1/
3600000.

EnumeratedTag
Reserved for future use. Do not use this table. Contains one row for each
defined enumerated tag.

Column Data Type Description


TagName nvarchar(256) NOT NULL Reserved for future use.
EnumerationTypeKey int NOT NULL Reserved for future use.
InitialValue int NOT NULL Reserved for future use.

EnumerationType
Reserved for future use. Do not use this table. Contains one row for each
defined enumeration type.

Column Data Type Description


EnumerationTypeKey int NOT NULL Reserved for future use.
EnumerationID bigint NOT NULL Reserved for future use.
EnumerationName nvarchar(256) NULL Reserved for future use.

IndustrialSQL Server Historian Database Reference


34 Chapter 2

ErrorLog
Contains one row for each system message (or error message). Typically, this
table is not used. The actual message text is stored in the LocalizedText table,
and can be retrieved by specifying the error code in the SQL query. Or, you can
use the v_ErrorLog view to retrieve the data included in this table, plus the
actual text.

Column Data type Description


DateTime datetime NOT NULL The date that the message was written to the
system log, in the local time of the
IndustrialSQL Server historian.
Type nvarchar(10) NULL The type of system message.
ErrorCode int NULL The unique identifier for the message.
Parameter nvarchar(256) NULL Optional details pertaining to the message
text. For example, for the message "Disk
space remaining on circular path" the
parameter would contain the number of MB.
TotalCount int NULL Used to prevent "flooding" conditions in the
log file. If a particular message is generated
numerous times during a relatively short
period of time, the message is written to the
log file only once, and the total number of
times that it occurred appears in this column.
ModuleID int NULL A unique number assigned to the
IndustrialSQL Server subsystem that
generated the message.
Host nvarchar(32) NULL The computer on which the IndustrialSQL
Server subsystem runs.
FileName nvarchar(64) NULL Used to indicate the program file that
contains the line of code that an error
message comes from. Used for debugging.
Line int NULL Used to indicate the line of code that an error
message comes from. Used for debugging.

EventHistory
Contains one row for each stored event, as labeled by the tagname. Event data
must be configured to be logged into this table.

Column Data Type Description


EventLogKey int IDENTITY The unique numerical identifier for the
event occurrence. This value is
automatically generated by the system
when the event record is added.
(FK) TagName nvarchar(256) NULL The unique name of the tag within the
IndustrialSQL Server system. TagName is
a foreign key from the EventTag table.

IndustrialSQL Server Historian Database Reference


Tables 35

Column Data Type Description


DateTime datetime NOT NULL The timestamp reflecting when the event
history data was acquired. This is the time
for when the event actually occurred. This
time reflects the time zone of the
IndustrialSQL Server.
DetectDateTime datetime NOT NULL The timestamp reflecting when the event
was detected by the event system.
Edge tinyint NULL The "edge" for the event detection. 0 =
Trailing; 1 = Leading; 2 = Both; 3 = None;
4 = Time Detector; 5 = External Detector.

EventTag
Contains one row for each event definition. Configuration information specific
to event tags is stored in this table, while general information for all tag types is
stored in the Tag table.

Column Data Type Description


(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system. TagName is
a foreign key from the Tag table.
(FK) DetectorTypeKey int NULL The unique identifier for a particular type
of detector. Event tags and detectors are
linked via this key. The event system relies
on the following values, which are added
during installation: 1 = System; 2 =
External event; 3 = Generic SQL; 4 =
Analog specific value; 5 = Discrete
specific value; 6 = Time-based (schedule).
DetectorTypeKey is a foreign key from the
DetectorType table.
(FK) ActionTypeKey int NULL The unique identifier for a particular type
of action. Event tags and actions are linked
via this key. The event subsystem relies on
the following values, which are added
during installation: 1 = No action; 2 =
Generic SQL; 3 = Snapshot; 4 = E-mail; 5
= Deadband; 6 = Summary.
ActionTypeKey is a foreign key from the
ActionType table.
ScanRate int NULL The interval, in milliseconds, at which the
system checks to see if the event conditions
specified by the detector occurred. This
value must be greater than or equal to 500
milliseconds, and less than or equal to 1
hour (3600000 ms).

IndustrialSQL Server Historian Database Reference


36 Chapter 2

Column Data Type Description


TimeDeadband int NOT NULL The minimum time, in milliseconds,
between stored events. If more than one
event occurs during the deadband, only the
most recent will be stored. The system will
not store another event until the specified
time has elapsed. A time deadband of 0
indicates that the system will store all
events. Reserved for future use.
Logged bit NOT NULL Used to specify whether or not to log
events for this tag into the EventHistory
table. Event logging can only be turned off
if no associated actions are configured. 0 =
Not logged; 1 = Logged. The default is 1.
Status tinyint NOT NULL The flag used by the event system at
system startup and during runtime to
determine if the event tag has been
modified. 0 = Posted. Any changes have
been detected and effected by the system. 1
= New. An event tag has been inserted, but
is not yet executing. 2 = Modification. An
event tag has been updated, but the older
one is already executing. 98 = Disabled. 99
= Disabling requested. The event tag does
not execute, even though the definition still
exists in the schema. Note that there may
be a delay of up to 30 seconds before a
change in an event tag is seen by the
running system.
PostDetectorDelay int NOT NULL The amount of time, in milliseconds, that
must elapse after an event is detected
before the event action can be executed.
UseThreadPool bit NOT NULL Used to specify how system threads are
used to process events. 1 = All events are
handled by a single thread and a single
logon to the SQL Server; 0 = Each event
uses a separate system thread and logon.
This will allow the event subsystem to
manage the scan rates of each detector
component concurrently. (Reserved for
future use.)
DetectorString nvarchar(1500) NULL The script that contains the criteria for
event detection. Detector scripts are
executed on the local IndustrialSQL
Server.
ActionString nvarchar(1500) NULL The script that specifies the event action.
Action scripts are executed on the local
IndustrialSQL Server.

IndustrialSQL Server Historian Database Reference


Tables 37

Column Data Type Description


Priority tinyint NOT NULL The priority level for the action, either
critical or normal. The priority level
determines the sorting queue to which the
action will be sent. The critical queue is
used for highly important events. If a
system overload condition occurs, events
that are given a critical priority will always
be processed first. Events that are given a
normal priority will be processed after any
critical events and may possibly be
dropped (that is, not performed) on an
overloaded system. 0 = Normal; 1 =
Critical. The default is 0.
Edge tinyint NOT NULL The "edge" for the event detection. 0 =
Trailing; 1 = Leading; 2 = Both; 3 = None;
4 = Time Detector; 5 = External Detector.

EventTagPendingDelete
Contains one row for each event tag that is pending deletion. This table is used
internally by the system during the deletion process. The columns in this table
are the same as in the EventTag table.

Frequency
Contains one row for each available frequency for summary operations.

Column Data Type Description


FrequencyID int IDENTITY The unique numerical identifier for the
frequency. Used to link a frequency with a
time-based detector. 1= Hourly; 2 = Daily;
3 = Weekly; 4 = Monthly; 5 = Periodic; 6 =
Other (Reserved for future use). This value
is automatically generated by the system
when the summarized tag is added.
Frequency nvarchar(12) NOT NULL The name for the frequency.

IndustrialSQL Server Historian Database Reference


38 Chapter 2

HistorianSysObjects
Contains one row for each object in the database for which changes can be
tracked.

Column Data Type Description


id int NOT NULL The unique identifier for the object.
Type char(2) NULL The type of object. C = CHECK constraint;
D = Default or DEFAULT constraint; F =
FOREIGN KEY constraint; K =
PRIMARY KEY or UNIQUE constraint; L
= Log; P = Stored procedure; R = Rule; RF
= Stored procedure for replication; S =
System table; TR = Trigger; U = User
table; V = View; X = Extended stored
procedure. Currently, only changes for the
user tables (object type U) are tracked.
Name varchar(50) NULL The name of the modified object.

History (INSQL.Runtime.dbo.History)
Contains one row for each stored tag value.

Column Data Type Description


DateTime datetime NOT NULL The timestamp for the returned value. For
delta retrieval, this is typically the time at
which the value was acquired by the
IndustrialSQL Server. For cyclic retrieval,
this is the specific time requested or
calculated (using a SQL function).
TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system.
Value float(25) NULL The value of the tag at the timestamp. The
value is always NULL for string tags.
vValue sql_variant NULL The value of the analog, discrete, or string
tag stored as a sql_variant. Using this
column in a query allows you to have
values with mixed datatypes as a result.
Quality tinyint NOT NULL The basic data quality indicator associated
with the data value.
QualityDetail int NULL An internal representation of data quality.
OPCQuality int NULL The quality value received from the data
source.
wwTagKey int NOT NULL The unique numerical identifier for the tag
within a single IndustrialSQL Server.

IndustrialSQL Server Historian Database Reference


Tables 39

Column Data Type Description


wwRowCount int NULL The number of rows to be returned for a
specified time period. For cyclic retrieval,
the rows are spaced evenly across the time
period, and the default row count is 100
rows. For cyclic retrieval, the row count is
applied for each tag in a query. This
parameter has been deprecated; do not use.
Use the wwCycleCount parameter instead.
wwResolution int NULL The sampling rate, in milliseconds, for
retrieving the data in cyclic mode. The
system returns values stored over the
requested time period at the interval
specified by the resolution. For example, if
you specify a 5000 ms resolution, the
system queries for all data during the time
period and then only returns those values
that occur at each 5000 ms interval, starting
with the start date and ending with the end
date.
wwEdgeDetection nvarchar(20) NULL The type of edge detection result set that
the query will return. Valid values are
NONE, LEADING, TRAILING, and
BOTH.
wwRetrievalMode nvarchar(20) NULL Used to specify how retrieved data is
processed before it is returned to the client.
Valid values are: CYCLIC, DELTA, FULL,
INTERPOLATED, BESTFIT, AVERAGE,
MINIMUM, MAXIMUM, INTEGRAL,
SLOPE, COUNTER, and VALUESTATE.
FULL = All stored values are returned;
CYCLIC = All stored data for tags during
the specified time interval are returned for
the number of retrieval cycles or resolution
specified; DELTA = Only values that
changed during the specified time interval
are returned. For all other modes, a
calculation is performed by the system on
the data and the value(s) are returned. The
default is CYCLIC for retrieval from
analog tables, DELTA for retrieval from
discrete and string tables, and default is
DELTA for retrieval from the History table,
unless the specific retrieval mode implies
otherwise. For example, SLOPE always
has DELTA characteristics.
wwTimeDeadband int NULL The minimum time, in milliseconds,
between returned values for a single tag.
Applies only to delta retrieval.

IndustrialSQL Server Historian Database Reference


40 Chapter 2

Column Data Type Description


wwValueDeadband real NULL The percentage of full scale (range), in
engineering units. Any value changes that
are less than this percentage will not be
returned. Applies only to delta retrieval.
The default is 0.
wwTimeZone nvarchar(50) NULL Used to specify the time zone for retrieval.
By default, the retrieval subsystem will
convert the UTC (Universal Time
Coordinated) timestamps for the stored
data to the local time of the IndustrialSQL
Server computer, including adjustments for
daylight savings time. In order to keep the
timestamps in UTC, set the value of
wwTimeZone to UTC. To convert the
timestamps to a client computer's time
zone, set this parameter to the appropriate
time zone text key from the TimeZone
table.
wwVersion nvarchar(30) NULL If the original data values have been
modified in the database, use this column
to specify which version of the stored data
is to be retrieved. Valid values are:
ORIGINAL or LATEST. If no parameter is
specified, the latest version of the data is
retrieved by default. Modification is
indicated by the QualityDetail.
wwCycleCount int NULL The number of retrieval cycles (sub-
intervals) for the specified time period. The
cycles will be spaced evenly across the
time period. For example, if you specify a
cycle count of four, the time period will be
divided into four even cycles, and one or
more values (depending on the retrieval
mode) will be returned per each cycle.
wwTimeStampRule nvarchar(20) NULL Used to specify whether cyclic results are
timestamped at the beginning of the cycle
or at the end of the cycle. Valid values are
START and END. If no timestamp rule is
specified in the query, then retrieval uses
the setting of the TimeStampRule system
parameter.

IndustrialSQL Server Historian Database Reference


Tables 41

Column Data Type Description


wwInterpolationType nvarchar(20) NULL Used to determine which analog value to
return at a given cycle boundary. Valid
values are STAIRSTEP and LINEAR. If
STAIRSTEP is specified, no interpolation
occurs. The last known point is returned
with the given cycle time. If no valid value
can be found, a NULL is returned. If
LINEAR is specified, the system calculates
a new value at the given cycle time by
interpolating between the last known value
prior to the cycle time and the first value
after the cycle time.
wwQualityRule nvarchar(20) NULL Used to specify whether values with certain
characteristics are explicitly excluded from
consideration by data retrieval. This
parameter will override the setting of the
QualityRule system parameter. Valid
values are GOOD or EXTENDED. A
quality rule of GOOD means that data
values with doubtful OPC quality will not
be used in the retrieval calculations. A
quality rule of EXTENDED means that
data values with both good and doubtful
OPC quality will be used in the retrieval
calculations.
wwStateCalc nvarchar(20) NULL Used to indicate the type of calculation to
return in the StateTime column for the
"value state" retrieval mode. Valid values
are: MINIMUM, MAXIMUM,
AVERAGE, TOTAL, or PERCENT. You
can also use the shortened versions: MIN,
MAX, AVG, or SUM. The default for this
column is TOTAL.
StateTime float(25) NULL The amount of time in the state, expressed
as a float (64-bit) number of milliseconds,
for all time-in-state modes except for
"Percent." For a time-in-state percentage
calculation, this value is the percentage of
the total time interval, in the range 0.0 to
100.0, that the value was in the state.
PercentGood float(25) NULL The ratio of the number of rows that have
"good" quality to the total number of rows
in the retrieval cycle, expressed as a
percentage in the range 0 to 100.
wwParameters nvarchar(128) NULL Used for additional parameters that can be
specified. By default, the value of this
parameter is an empty string.

IndustrialSQL Server Historian Database Reference


42 Chapter 2

HistoryBlock
(INSQL.Runtime.dbo.HistoryBlock)
Contains one row for each block of history data stored on a storage node.

Column Data Type Description


FromDate datetime NOT NULL The starting timestamp for the history
block.
ToDate datetime NOT NULL The ending timestamp for the history
block.
StorageNodeKey int NOT NULL The unique numerical identifier for the
storage node.
Description nvarchar(50) NULL The description of the history block.
OnLine bit NOT NULL Used to indicate whether or not the tag
information for the history block is loaded
into memory. 0 = Not loaded; 1 = Loaded.
HistoryArchived int NOT NULL Used to indicate whether or not the history
block has been archived (backed up). 1 =
No status; 2 = Archived; 3 = Restored; 4 =
Deleted. Reserved for future use.
SummaryArchived int NOT NULL Used to indicate whether or not the tag
summary has been archived (backed up). 1
= No status; 2 = Archived; 3 = Restored; 4
= Deleted. Reserved for future use.
EventArchived int NOT NULL Used to indicate whether or not the event
has been archived (backed up). 1 = No
status; 2 = Archived; 3 = Restored; 4 =
Deleted. Reserved for future use.
StorageAreaType int NOT NULL The paradigm used for storage. 1 =
Circular; 2 = Alternate; 3 = Buffer; 4 =
Permanent. Reserved for future use.
ArchiveDate datetime NULL The date at which the history block was
archived. Reserved for future use.
ArchiveLocation nvarchar(50) NULL The location to which the history block was
archived. Reserved for future use.
Version int NULL The version number for the history block. 1
= Block format used until release 3.0; 2 =
Block format used for releases 3.0 and
later. Reserved for future use.
Compression int NULL The version number for cyclic
compression. 1 = No compression; 2 =
Huffman encoding. Reserved for future
use.
Sequence int NOT NULL The sequence number for the data stream.
(1...n) Reserved for future use.

IndustrialSQL Server Historian Database Reference


Tables 43

Column Data Type Description


TimeZoneOffset int NULL The UTC offset, in minutes, from the local
timestamp for when the history block was
created. For example, a value of 480 would
indicate an 8-hour offset from UTC, which
would be Pacific Standard Time.
wwTimeZone nvarchar(50) NULL Used to specify the time zone for retrieval.
By default, the retrieval subsystem will
convert the UTC (Universal Time
Coordinated) timestamps for the stored
data to the local time of the IndustrialSQL
Server computer, including adjustments for
daylight savings time. In order to keep the
timestamps in UTC, set the value of
wwTimeZone to UTC. To convert the
timestamps to a client computer's time
zone, set this parameter to the appropriate
time zone text key from the TimeZone
table.

InTouchNode
Contains one row for each InTouch node from which a tagname data dictionary
(Tagname.x) is imported into the IndustrialSQL Server historian.

Column Data Type Description


NodeKey int NOT NULL The unique numerical identifier for the
named InTouch node. This value is
automatically generated by the system
when the node is added.
MachineName nvarchar(255) NOT NULL The name of the computer on which the
InTouch application resides.
ApplicationName nvarchar(32) NULL The name of the InTouch application
(VIEW).
Path nvarchar(250) NULL The UNC path to the InTouch Tagname.X
file.
Description nvarchar(50) NULL The description of the InTouch node.
DuplicateChar nvarchar(12) NOT NULL The string that was prefixed or suffixed to
the tagname to make it unique.
PrefixOrSuffix bit NOT NULL Used to indicate whether unique tags were
created by prefixing or suffixing the unique
string for the node. 0 = Suffix; 1 = Prefix.
Internal use only.
AlwaysModifyName bit NOT NULL Used to indicate whether a uniqueness
string was added to every tag for the node.
Internal use only.

IndustrialSQL Server Historian Database Reference


44 Chapter 2

Column Data Type Description


ImportPlantTags tinyint NOT NULL Used to indicate whether plant tags were
imported. (In InTouch, plant tags are called
I/O tags.) Internal use only.
ImportSystemTags tinyint NOT NULL Used to indicate whether system tags were
imported. Internal use only.
ImportMemoryTags tinyint NOT NULL Used to indicate whether memory tags
were imported. Internal use only.
ImportAllTags int NOT NULL Used to indicate whether all tags were
imported. Internal use only.
FixedStorageRate tinyint NOT NULL The cyclic storage rate, in seconds, for
imported tags. Internal use only.
ImportRoute tinyint NOT NULL Used to indicate the type of import that was
last performed for the node. Internal use
only.

InTouchSpecific
Contains one row of import-related information for each data dictionary
(Tagname.x) imported from InTouch HMI software.

Column Data Type Description


(FK) NodeKey int NOT NULL The unique numerical identifier for the
named InTouch node. NodeKey is a
foreign key from the InTouchNode table.
(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system. TagName is
a foreign key from the Tag table.
OriginalName nvarchar(32) NOT NULL The original tagname in the InTouch HMI
software. This may be different than the
IndustrialSQL Server tagname if a new
name was generated to ensure uniqueness.
TypeInfo int NOT NULL The type of tag in the InTouch HMI
software. For more information on
InTouch tag types, see your InTouch
documentation. Internal use only.
InInSQL bit NOT NULL Used to specify whether or not the tag
information has been imported from
InTouch into the IndustrialSQL Server
database. Internal use only.
Comment nvarchar(50) NULL The original description for the tag that
was imported from InTouch.

IndustrialSQL Server Historian Database Reference


Tables 45

IODriver
Contains one row for each IDAS providing data to the IndustrialSQL Server
historian.

Column Data Type Description


IODriverKey int IDENTITY The unique identifier for an IDAS. This
value is automatically generated by the
system when the IDAS is added.
(FK) StorageNodeKey int NOT NULL The unique numerical identifier for the
storage node. StorageNodeKey is a
foreign key from the StorageNode table.
ComputerName nvarchar(255) NOT NULL The name of the computer on which the
IDAS runs.
AltComputerName nvarchar(255) NULL The name of the computer on which an
optional, redundant IDAS runs. This
should be set to an empty string if no
redundant IDAS is specified. Make sure
that the IDAS software is installed on
the target failover computer. If the
failure of the primary IDAS is detected
by the system, the failover IDAS is
automatically started. The failover
IDAS is shut down after the primary
IDAS is back online. By default, this
column is an empty string.
StoreForwardMode tinyint NOT NULL Used to specify whether or not store-
and-forward capability is enabled. If
enabled, and the network connection
between the IDAS and the storage node
fails, data will be "buffered" to the
location specified by the store-and-
forward path. Valid values are: 0 =
Disabled; 1 = Enabled; 2 =
Autonomous. The Autonomous mode
(2) is an extension of the normal store-
and-forward mode (1). It allows the
IDAS to start up using an IDAS
configuration file and collect data in
store-and-forward mode if the network
connection to the IndustrialSQL Server
is not available.

IndustrialSQL Server Historian Database Reference


46 Chapter 2

Column Data Type Description


StoreForwardPath nvarchar(255) NULL Used to specify the path for the IDAS
data buffer on the local hard drive of the
IDAS computer. The path should be
absolute (for example, c:\IDASBuffer).
Data is written to this path until the
minimum threshold for the buffer is
reached. Remote buffer paths are not
supported. If a invalid path or no path is
specified, data is stored to the default
path, which is C:\Document and
Settings\All Users\Application
Data\ArchestrA\SF.
MinMBThreshold int NOT NULL The minimum amount of free disk
space, in megabytes, at which IDAS
stops collecting data in the store-and-
forward buffer.
Status tinyint NULL Automatically updated by the system if
a change is made to IDAS: 0 = No
change; 1 = Insertion; 2 = Modification;
3 = Deletion.
Enabled bit NOT NULL Used to indicate whether the IDAS is
enabled or not. 0 = Not enabled; 1 =
enabled. Disabling the IDAS allows for
the configuration to be retained in the
database, even though the IDAS is
removed from the system.
StoreForwardDuration int NOT NULL The minimum duration, in seconds, for
the IDAS to function in store-and-
forward mode. The IDAS functions in
store-and-forward mode for this length
of time even if the condition that caused
IDAS to function in store-and-forward
mode no longer exists. The maximum
duration is 3600 seconds, and the
minimum is 15 seconds.
AutonomousStartupTimeout int NOT NULL The amount of time, in seconds, that the
autonomous IDAS should wait for
configuration commands when started
by the Configuration service before
going to the autonomous mode. This
timeout may need to be increased only if
you have a large number of IDASs
configured as autonomous on a slow
network.
BufferCount int NOT NULL The number of 64 KB buffers pre-
allocated for buffering data. This
number may need to be increased to
accommodate high data rates.

IndustrialSQL Server Historian Database Reference


Tables 47

Column Data Type Description


FileChunkSize int NOT NULL The size, in bytes, of the data "chunks"
that are sent to the historian when store-
and-forward data is forwarded. The size
of the chunks can be decreased to
accommodate slower networks.
Decrease this number only if the
forwarding delay is greater than zero.
ForwardingDelay int NOT NULL The time interval, in milliseconds, at
which "chunks" of store-and-forward
data are forwarded to the historian. The
length of the interval may need to be
increased to accommodate slower
networks.
ConnectionTimeout int NOT NULL The amount of time, in seconds, that the
Configuration service attempts to
communicate with an IDAS for
configuration/reconfiguration. If this
timeout elapses, the Configuration
service assumes that the IDAS
connection has been dropped. This
number may need to be increased to
accommodate slower networks.

IOServer
Contains one row for each I/O Server providing data to the IndustrialSQL
Server historian.

Column Data Type Description


IOServerKey int IDENTITY The unique numerical identifier for the I/O
Server. This value is automatically
generated by the system when the I/O
Server is added.
(FK) StorageNodeKey int NOT NULL The unique numerical identifier for the
storage node. StorageNodeKey is a foreign
key from the StorageNode table.
(FK) IODriverKey int NULL The unique identifier for an IDAS.
IODriverKey is a foreign key from the
IODriver table.
(FK) ApplicationName nvarchar(32) NULL The application name of the I/O Server.
This name is usually the same as the
executable file name. ApplicationName is a
foreign key from the IOServerType table.
Path nvarchar(255) NULL The full UNC path (including the filename)
to locate the executable file for the I/O
Server. If the I/O Server type key is
specified, the filename may be omitted.

IndustrialSQL Server Historian Database Reference


48 Chapter 2

Column Data Type Description


ComputerName nvarchar(255) NULL The name of the computer on which the I/O
Server runs.
AltComputerName nvarchar(255) NULL The name of the computer on which an
optional, failover I/O Server runs. The
failover I/O Server must be running in
order for the switch to be made.
AutoStart bit NOT NULL Used to control how the I/O Server starts
up. 0 = Automatic startup when the system
starts. 1 = Manual startup required.
Currently not used.
ExeType int NOT NULL The type of executable for the I/O Server.
Used by the InSQL Console to determine
how to start the I/O Server. 0 = Service; 1 =
Console application; 2 = Windows
application.
InitializationStatus tinyint NOT NULL A control flag used to ensure that each I/O
Server has been asked for the data type
(integer or real) of each tag that it will send.
Only needed after a database modification.
ProtocolType tinyint NOT NULL The protocol used by the IndustrialSQL
Server to communicate with the I/O Server.
1 = DDE; 2 = SuiteLink™; 3 =
IndustrialSQL Server named pipe driver
(for compatibility with IndustrialSQL
Server 3.0 and previous versions). If the
IndustrialSQL Server is running on the
Windows Server 2003 operating system,
DDE is not supported.
Description nvarchar(50) NULL The description of the I/O Server.
Status tinyint NULL Automatically updated by the system if a
change is made to the I/O Server: 0 = No
change; 1 = Insertion; 2 = Modification; 3
= Deletion.

IOServerType
Contains one row for every known I/O Server type. Information about a new I/
O Server is added to this table when the server is installed. This table is
populated with the latest information about Wonderware I/O Servers at the
time of shipping.

Column Data Type Description


ApplicationName nvarchar(32) NOT NULL The application name of the I/O Server.
This name is usually the same as the
executable file name.
Description nvarchar(50) NULL The description of the I/O Server type.

IndustrialSQL Server Historian Database Reference


Tables 49

Column Data Type Description


ExeName nvarchar(255) NULL The name of the I/O Server's executable
file.
Revision nchar(20) NULL The revision number for the I/O Server.
Platform Platforms/nchar(20) The operating system required by the I/O
NULL Server. Valid operating systems are:
WINDOWS NT, WINDOWS 95,
WINDOWS 98, WINDOWS XP,
WINDOWS 2000, WINDOWS 2003.

Limit
Contains one row for each monitored limit for a specified tag. A limit can be
associated with one or more tags and/or contexts.

Column Data Type Description


(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system. TagName is
a foreign key from the AnalogTag table.
(FK) ContextKey int NOT NULL The unique numerical identifier for the
context. ContextKey is a foreign key from
the Context table.
LimitType tinyint NOT NULL The type of limit; that is, whether it is a
rising (up) or falling (down) limit. 0 =
Rising; 1 = Falling.
Value float(8) NOT NULL The value that is used as a specific limit for
a tag. In theory, a tag can have an infinite
number of limits defined.
(FK) LimitNameKey int NOT NULL The unique numerical identifier associated
with the limit name. LimitNameKey is a
foreign key from the LimitName table.
Priority int NOT NULL The priority for the limit. Priorities can
range from 1 to over 2 billion, with 1 being
the highest priority.
Checked bit NOT NULL Used to specify whether a tag imported
from InTouch is configured for automatic
limit checking. Only checked limits are
imported. 0 = Checking disabled; 1 =
Checking enabled.
Description nvarchar(50) NULL The description of the limit.

IndustrialSQL Server Historian Database Reference


50 Chapter 2

LimitName
Contains one row for each name that is associated with a defined limit.
Examples are "high," "low," and "maintenance."

Column Data Type Description


LimitNameKey int IDENTITY The unique numerical identifier associated
with the limit name. This value is
automatically generated by the system
when the limit is added.
Name nvarchar(20) NULL The name for the limit.

Live (INSQL.Runtime.dbo.Live)
Contains one row for each analog, discrete, or string tag. The value of each tag
in this table is updated every time a new value is received.

Column Data Type Description


DateTime datetime NOT NULL The timestamp reflecting when the data
last changed.
TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system.
Value float(25) NULL The value of the tag at date/time. This
value is always NULL for string tags.
vValue sql_variant NULL The value of the analog, discrete, or string
tag stored as a sql_variant. Using this
column in a query allows you to have
values with mixed datatypes as a result.
Quality tinyint NOT NULL The basic data quality indicator associated
with the data value.
QualityDetail int NULL An internal representation of data quality.
OPCQuality int NULL The quality value received from the data
source.
wwTagKey int NOT NULL The unique numerical identifier for the tag
within a single IndustrialSQL Server.
wwRetrievalMode nvarchar(20) NULL For queries against this table, the value of
this column is ignored.
wwTimeDeadband int NULL For queries against this table, the value of
this column is ignored.
wwValueDeadband real NULL For queries against this table, the value of
this column is ignored.

IndustrialSQL Server Historian Database Reference


Tables 51

Column Data Type Description


wwTimeZone nvarchar(50) NULL Used to specify the time zone for retrieval.
By default, the retrieval subsystem will
convert the UTC (Universal Time
Coordinated) timestamps for the stored
data to the local time of the IndustrialSQL
Server computer, including adjustments for
daylight savings time. In order to keep the
timestamps in UTC, set the value of
wwTimeZone to UTC. To convert the
timestamps to a client computer's time
zone, set this parameter to the appropriate
time zone text key from the TimeZone
table.
wwParameters nvarchar(128) NULL Used for additional parameters that can be
specified. By default, the value of this
parameter is an empty string.

LocalizedText
Contains one row for each string of text that can be returned to a client from
the IndustrialSQL Server historian (for example, error messages and status
messages).

Note If you add new text to the LocalizedText table, you must stop and restart
the IndustrialSQL Server historian in order for the changes to go into effect.

TextKey LanguageID LocalizedText


TextKey int NOT NULL The unique identifier for the message.
LanguageID int NOT NULL The locale ID for the language used. This
ID is also used in the SQL Server
syslanguages table.
LocalizedText nvarchar(256) NULL The content of the message.

IndustrialSQL Server Historian Database Reference


52 Chapter 2

Message
Contains one row for each on/off message pair that can be associated with a
discrete tag. For example, a message pair may be "Open" and "Closed" and
could be associated with valve and switch positions.

Column Data Type Description


MessageKey int IDENTITY The unique numerical identifier for a
TRUE/FALSE message pair that can be
associated with a discrete tag. This value is
automatically generated by the system
when the message pair is added.
Message0 nvarchar(64) NULL The message associated with the FALSE
state of the discrete tag. The maximum
number of characters is 64. A discrete tag
set to 0 is in the FALSE state.
Message1 nvarchar(64) NULL The message associated with the TRUE
state of the discrete tag. The maximum
number of characters is 64. A discrete tag
set to 1 is in the TRUE state.

ModLogColumn
Contains one row for each database column on which an INSERT, UPDATE,
or DELETE has been performed.

Column Data Type Description


(FK) ModTableKey int NOT NULL The unique numerical identifier for the
modification. ModTableKey is a foreign
key from the ModLogTable table.
ColumnName varchar(30) NOT NULL The name of the modified column.
OldValue sql_variant NULL The value stored in the column before the
modification was made, if the modification
was to a configuration table. For
modifications to history data using SQL
INSERT and UPDATE statements, this
column contains the timestamp of the
earliest data affected by the INSERT or
UPDATE operation. If multiple changes
are made to the same data, then only the
most recent change will be contained in this
column. This column is not used for
modifications made to history data using a
CSV file.
NewValue sql_variant NULL The new value stored in the column, if the
modification was to a configuration table.
For modifications to history data, this
column contains the total count of
consecutive value updates attempted.

IndustrialSQL Server Historian Database Reference


Tables 53

For more information on modification tracking, see "Modification Tracking" in


Chapter 2, "System-Level Functionality," in your IndustrialSQL Server™
Historian Concepts Guide.

ModLogTable
Contains one row for each database table on which an INSERT, UPDATE, or
DELETE has been performed.

Column Data Type Description


ModTableKey int IDENTITY The unique numerical identifier for the
modification. This value is automatically
generated by the system when a new
modification record is added.
(FK) id int NOT NULL The unique identifier for the object that was
modified. id is a foreign key from the
HistorianSysObjects table.
ModType char(1) NOT NULL The type of modification. U = Update; I =
Insert; D = Delete; 1 = SQL insert; 2 = SQL
original insert; 3 = SQL update; 4 = CSV
insert; 5 = CSV original insert; 6 = CSV
update; 7 = CSV multi-point update; 8 =
CSV "fast load" insert.
RowKey sql_variant NOT NULL The key identifier for the column modified
in the table. For example, TagName for the
Tag table, Name for the Topic table, and so
on.
UserKey int NOT NULL The unique numerical identifier for a
database user as defined in the UserDetail
table. This value is from the UserDetail
table. Currently not used.
DateTime datetime NOT NULL The timestamp of when the modification
occurred.
UserName nvarchar(256) NOT NULL The name of the database user that made
the modification. The value of this column
reflects the Windows authentication user
name (for example,
DOMAIN\user_login_name) or the SQL
Server authentication user name (for
example, dbo), depending on how the user
is logged into the SQL Server when the
modification is made. In the case of a CSV
file import, this column contains the user
name as it appears in the CSV file.

For more information on modification tracking, see "Modification Tracking" in


Chapter 2, "System-Level Functionality," in your IndustrialSQL Server™
Historian Concepts Guide.

IndustrialSQL Server Historian Database Reference


54 Chapter 2

OPCQualityMap
Contains one row for each defined OPC quality.

Column Data Type Description


OPCQuality tinyint NOT NULL The quality value received from the data
source.
Description nvarchar(100) NULL The text that describes what the OPC
quality value means. Do not modify this
description.

PrivateGroupTag
Contains one row for each instance of a tag in a user's private namespace.

Column Data Type Description


(FK) NameKey int NOT NULL The unique identifier for the object in the
namespace. NameKey is a foreign key
from the PrivateNameSpace table.
(FK) UserKey int NOT NULL The unique numerical identifier for a
database user as defined in the UserDetail
table. UserKey is a foreign key from the
UserDetail table.
(FK) wwDomainTagKey int NOT NULL The unique numerical identifier for a tag in
a specific domain. wwDomainTagKey is a
foreign key from the TagRef table.

PrivateNameSpace
Contains one row for each object in the private namespace. Objects in the
private namespace can include plant machines, areas, tags, and so on, and are
organized in a hierarchy. Allows for more than one name to map to a single tag.

Column Data Type Description


(FK) UserKey int NOT NULL The unique numerical identifier for a
database user as defined in the UserDetail
table. UserKey is a foreign key from the
UserDetail table.
NameKey int IDENTITY The unique identifier for the object in the
namespace. This value is automatically
generated by the system when the object is
added.

IndustrialSQL Server Historian Database Reference


Tables 55

Column Data Type Description


Type int NULL The value that specifies the type of
namespace. 1 to 6 = Tag; 1 to 2 million =
System; 2+ million = Groups. Within the
system range, the following values
designate ArchestrA object types: 1999023
= Galaxy; 1999001 = WinPlatform object;
1999003 = AppEngine object; 1999013 =
Area object; 1999011 =
DDESuiteLinkClient, OPCClient, and
InTouchProxy objects; 1999024 =
RedundantDIObject object; 1999033 =
Undeployed object represented by a
generic name; 1999901 =
ApplicationObject; 1999902 = Traceability
object.
Name nvarchar(255) NULL The name of this object in the hierarchy.
ConfigStor ntext(16) NULL If the namespace object has configuration
information associated with it (for
example, configuration information for a
set of trend curves, the name of the file that
contains the configuration information).
(FK) ParentKey int NOT NULL The unique identifier for a named object in
this namespace.

PublicGroupTag
Contains one row for each instance of a tag in the public namespace.

Column Data Type Description


(FK) NameKey int NOT NULL The unique identifier for the object in the
namespace. NameKey is a foreign key
from the PublicNameSpace table.
(FK) wwDomainTagKey int NOT NULL The unique numerical identifier for a tag in
a specific domain. wwDomainTagKey is a
foreign key from the TagRef table.

IndustrialSQL Server Historian Database Reference


56 Chapter 2

PublicNameSpace
Contains one row for each object in the public namespace. Objects in the
public namespace can include plant machines, areas, and so on, and are
organized in a hierarchy. Allows more than one name to map to a single tag.

Column Data Type Description


NameKey int IDENTITY The unique identifier for the object in the
namespace. This value is automatically
generated by the system when the object is
added.
Type int NULL The value that specifies the type of
namespace. 1 to 6 = Tag; 1 to 2 million =
System; 2+ million = Groups. Within the
system range, the following values
designate ArchestrA object types: 1999023
= Galaxy; 1999001 = WinPlatform object;
1999003 = AppEngine object; 1999013 =
Area object; 1999011 =
DDESuiteLinkClient, OPCClient, and
InTouchProxy objects; 1999024 =
RedundantDIObject object; 1999033 =
Undeployed object represented by a
generic name; 1999901 =
ApplicationObject; 1999902 = Traceability
object.
Name nvarchar(255) NULL The name of this object in the hierarchy.
ConfigStor ntext NULL If the namespace object has configuration
information associated with it (for
example, configuration information for a
set of trend curves, the name of the file that
contains the configuration information).
(FK) ParentKey int NOT NULL The unique identifier for a named object in
this namespace.

QualityMap
Contains one row for every permutation of quality detail for a tag value.

Column Data Type Description


QualityDetail int NOT NULL An internal representation of data quality.
QualityString nvarchar(200) NULL The text string that describes what the
quality detail value means.

IndustrialSQL Server Historian Database Reference


Tables 57

RateOfChange
Contains one row for each monitored rate of change for a tag.

Column Data Type Description


(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system. TagName is
a foreign key from the AnalogTag table.
(FK) ContextKey int NOT NULL The unique numerical identifier for the
context. ContextKey is a foreign key from
the Context table.
Value float(8) NOT NULL The percentage of change for a tag during
the amount of time specified by the time
base.
TimeBase int NOT NULL The unit of time against which the rate of
change will be measured.
Priority int NOT NULL The priority for the rate of change.
Priorities can range from 1 to over 2
billion, with 1 being the highest priority.
Checked bit NOT NULL Used to specify whether a tag imported
from InTouch was configured for
automatic rate of change checking. 0 =
Checking disabled; 1 = Checking enabled.

ServerList
Contains one row for each server used in an enterprise system. Allows for the
creation of the system namespace, which contains a list of servers, and a flat
namespace of tags per server.

Column Data Type Description


ServerKey int IDENTITY The unique numerical identifier for the
IndustrialSQL Server. This value is
automatically generated by the system
when the server is added.
ComputerName nvarchar(50) NOT NULL The Microsoft network name of the server
computer.
Description nvarchar(50) NULL The description of the server.

IndustrialSQL Server Historian Database Reference


58 Chapter 2

SnapshotDetail
Contains one row for each storage size configuration for tags. This table is
used by the storage subsystem to manage the snapshot files.

Column Data Type Description


StorageSize int NOT NULL The storage size, in bytes, of the tag value:
-1 = Blob; 0 = Variable length string; 1 = 1
byte; 2 = 2 byte; 4 = 4 byte; 8 = 8 byte.
SnapshotSize int NOT NULL The maximum size of the snapshot, in
bytes. If this limit is reached, a new
snapshot is created. The default is
2,097,152 bytes (2 MB).
ImageTime int NOT NULL The interval, in seconds, between updates
to the snapshot file. The snapshot file is
updated with tag value information from
the snapshot buffer, which resides in
memory. The default is 30 seconds, and the
maximum value is 60 seconds.
ThresholdTime int NOT NULL The maximum amount of time, in seconds,
that can elapse before a new snapshot is
automatically created, provided that the
value for the snapshot size has not been
reached. The default is 3600 seconds (1
hour).
Status tinyint NULL Automatically updated by the system if a
change is made to the snapshot: 0 = No
change; 1 = Insertion; 2 = Modification; 3
= Deletion.

SnapshotTag
Contains one row for each tag that is included in the snapshot action associated
with a given event tag.

Column Data Type Description


SnapshotTagKey int IDENTITY The unique numerical identifier of the tag
included in the snapshot. This value is
automatically generated by the system
when the snapshot is added.
(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system. This tag is
the snapshot tag. TagName is a foreign key
from the Tag table.

IndustrialSQL Server Historian Database Reference


Tables 59

Column Data Type Description


(FK) EventTagName nvarchar(256) NOT NULL The name of the event tag to which the
snapshot tag is related. EventTagName is a
foreign key from the EventTag table.
TagType int NOT NULL Used to indicate the type of tag. 1 =
Analog; 2 = Discrete; 3 = String. The
default is 1.

SQLTemplate
Contains one row for each pre-defined SQL script, which can be copied and
used as a basis for an event detection or action script.

Column Data Type Description


TemplateKey int IDENTITY The unique numerical identifier for a SQL
template. This value is automatically
generated when a new SQL template is
created.
Description nvarchar(50) NULL The description of the SQL template.
Type int NULL The type of SQL template. 0 = Detector; 1
= Action.
Script ntext(16) NULL A pre-defined SQL script. This script can
be copied and used as an event detection or
action script.

StateWideHistory
(INSQL.Runtime.dbo.StateWideHistory)
Contains one row for the amount of time one or more analog, discrete, or string
tags have been in a particular state, thus providing a "wide" view of the data.

Column Data Type Description


DateTime datetime NOT NULL The timestamp for the start of the time-in-
state period.
vValue sql_variant NULL The string representation of the state, the
ordinal for state types that do not have a
string representation, or NULL for a gap or
"bad" value.

IndustrialSQL Server Historian Database Reference


60 Chapter 2

Column Data Type Description


Tag1 float(25) NULL The amount of time, in milliseconds, that
the tag has spent in the state indicated by
the vValue column, unless the value of
wwStateCalc is "Percent," in which case
this column contains the percentage of the
total time spent in the state, within a range
of 0.0 to 100.0.
Tag2 float(25) NULL The amount of time, in milliseconds, that
the tag has spent in the state indicated by
the vValue column, unless the value of
wwStateCalc is "Percent," in which case
this column contains the percentage of the
total time spent in the state, within a range
of 0.0 to 100.0.
ManyOtherTags float(25) NULL A "placeholder" column for one or more
tags in the wide table format. In the wide
table format, tagnames are used as column
names. The ManyOtherTags column is
"duplicated" for as many tags as are
specified in the database query.
wwRowCount int NULL The number of rows to be returned for a
specified time period. For cyclic retrieval,
the rows are spaced evenly across the time
period, and the default row count is 100
rows. For cyclic retrieval, the row count is
applied for each tag in a query. This
parameter has been deprecated; do not use.
Use the wwCycleCount parameter instead.
wwResolution int NULL The sampling rate, in milliseconds, for
retrieving the data in cyclic mode. The
system returns values stored over the
requested time period at the interval
specified by the resolution. For example, if
you specify a 5000 ms resolution, the
system queries for all data during the time
period and then only returns those values
that occur at each 5000 ms interval, starting
with the start date and ending with the end
date.
wwRetrievalMode nvarchar(20) NULL Used to specify the time-in-state retrieval
mode. The valid value is: VALUESTATE.
wwTimeDeadband int NULL The minimum time, in milliseconds,
between returned values for a single tag.
Applies only to delta retrieval.
wwValueDeadband real NULL The percentage of full scale (range), in
engineering units. Any value changes that
are less than this percentage will not be
returned. Applies only to delta retrieval.
The default is 0.

IndustrialSQL Server Historian Database Reference


Tables 61

Column Data Type Description


wwTimeZone nvarchar(50) NULL Used to specify the time zone for retrieval.
By default, the retrieval subsystem will
convert the UTC (Universal Time
Coordinated) timestamps for the stored
data to the local time of the IndustrialSQL
Server computer, including adjustments for
daylight savings time. In order to keep the
timestamps in UTC, set the value of
wwTimeZone to UTC. To convert the
timestamps to a client computer's time
zone, set this parameter to the appropriate
time zone text key from the TimeZone
table.
wwVersion nvarchar(30) NULL If the original data values have been
modified in the database, use this column
to specify which version of the stored data
is to be retrieved. Valid values are:
ORIGINAL or LATEST. If no parameter is
specified, the latest version of the data is
retrieved by default. Modification is
indicated by the QualityDetail.
wwCycleCount int NULL The number of retrieval cycles (sub-
intervals) for the specified time period. The
cycles will be spaced evenly across the
time period. For example, if you specify a
cycle count of four, the time period will be
divided into four even cycles, and one or
more values (depending on the retrieval
mode) will be returned per each cycle.
wwTimeStampRule nvarchar(20) NULL Used to specify whether cyclic results are
timestamped at the beginning of the cycle
or at the end of the cycle. Valid values are
START and END. If no timestamp rule is
specified in the query, then retrieval uses
the setting of the TimeStampRule system
parameter.
wwQualityRule nvarchar(20) NULL Used specify whether values with certain
characteristics are explicitly excluded from
consideration by data retrieval. This
parameter will override the setting of the
QualityRule system parameter. Valid
values are GOOD or EXTENDED. A
quality rule of GOOD means that data
values with doubtful OPC quality will not
be used in the retrieval calculations. A
quality rule of EXTENDED means that
data values with both good and doubtful
OPC quality will be used in the retrieval
calculations.

IndustrialSQL Server Historian Database Reference


62 Chapter 2

Column Data Type Description


wwStateCalc nvarchar(20) NULL Used to indicate the type of calculation to
return in the StateTime column for the
"value state" retrieval mode. Valid values
are: MINIMUM, MAXIMUM,
AVERAGE, TOTAL, or PERCENT. You
can also use the shortened versions: MIN,
MAX, AVG, or SUM. The default for this
column is TOTAL.
wwParameters nvarchar(128) NULL Used for additional parameters that can be
specified. By default, the value of this
parameter is an empty string.

StorageLocation
Contains one row for each defined storage location on a specific storage node.

Column Data Type Description


StorageType int NOT NULL The type of storage used for the specified
location. 1 = Circular; 2 = Alternate; 3 =
Buffer; 4 = Permanent. There can only be
one storage location of each type.
SortOrder int NOT NULL Applies only to the alternate area. If more
than one location is defined, the sort order
determines the order in which the alternate
areas are used. Reserved for future use.
(FK) StorageNodeKey int NOT NULL The unique numerical identifier for the
storage node. StorageNodeKey is a foreign
key from the StorageNode table.
Path nvarchar(255) NOT NULL The path to the storage location. The
circular storage location must be a local
drive on the server machine, and the path
must be specified using normal drive letter
notation (for example,
c:\InSQL\Data\Circular). The alternate,
buffer, and permanent storage locations can
be anywhere on the network, provided that
the ArchestrA service user has full access
to those network locations. For the
Windows 2000 operating system, remote
storage locations can be specified either as
mapped drives or by using UNC notation.
For the Windows Server 2003 operating
system, the locations must be specified
using UNC notation.If empty, the default
<SystemDataPath>\InSQL\Data\Circular
is used.

IndustrialSQL Server Historian Database Reference


Tables 63

Column Data Type Description


MaxMBSize int NOT NULL The limit, in megabytes, for the amount of
data to be stored to the specified location.
The maximum size applies to circular and
alternate storage only. If the maximum size
is set to 0, all available space at the storage
location is used.
MinMBThreshold int NOT NULL The minimum amount of disk space, in
megabytes, at which the system attempts to
start freeing up space. The threshold
applies to circular and alternate storage
only. Typically, you should multiply the
size of the average history block (before
any compression) by 1.5 to determine the
minimum threshold.
Status tinyint NULL Automatically updated by the system if a
change is made to the storage location: 0 =
No change; 1 = Insertion; 2 =
Modification; 3 = Deletion.
MaxAgeThreshold int NOT NULL The age, in days, of data that will be
deleted by system to free up disk space.
The threshold applies to circular and
alternate storage only. The minimum age is
2 days. A value of 0 indicates that no age
threshold is applied.

StorageNode
Contains one row for each defined storage node.

Note Only one storage node is supported for this release.

To satisfy referential integrity constraints between the StorageNode table and


the Tag table, at least one row must exist in the StorageNode table and
references to the column StorageNodeKey in the Tag table must exist as rows
in this table.

Column Data Type Description


StorageNodeKey int IDENTITY The unique numerical identifier for the
storage node. This value is automatically
generated by the system when the storage
node is added.
ComputerName nvarchar(255) NOT NULL The Microsoft network name of the
computer on which the storage node
resides.
Description nvarchar(50) NULL The description that identifies the role of
the storage computer.

IndustrialSQL Server Historian Database Reference


64 Chapter 2

Column Data Type Description


DbStatus int NOT NULL For releases prior to 8.0, used to store the
status of server reinitializations. 2 =
Certain columns in the Tag, AnalogTag,
DiscreteTag, StringTag, Topic, and
IOServer tables were changed; 3 =
Reinitialization needed; 4 = Commit phase
of a database update is in progress; 0 =
Reinitialization complete. A negative value
indicates that an error was encountered
during reinitialization. Internal use only.
DbModAcquisition int NOT NULL Used with DbStatus to indicate to the back
end whether the acquisition subsystem
needs to be restarted. 0 = Restart not
needed; 1 = Restart needed. Currently not
used.
DbError varchar(255) NULL The description of the error that occurs if a
database commit fails. Currently not used.
DbModStorage int NOT NULL Used with DbStatus to indicate to the back
end whether the storage subsystem needs
to be restarted. 0 = Restart not needed; 1 =
Restart needed. Currently not used.
DbModServer int NOT NULL Used with DbStatus to indicate to the back
end whether the database server needs to
be restarted. 0 = Restart not needed; 1 =
Restart needed. Currently not used.
DbModAll int NOT NULL Used with DbStatus to indicate to the back
end whether all subsystems need to be
restarted. 0 = Restart not needed; 1 =
Restart needed. This value overrides the
value in all subsystem columns. Currently
not used.
DbRevision int NOT NULL Current revision number of the database.
This value is automatically incremented if
DbStatus = 2.

IndustrialSQL Server Historian Database Reference


Tables 65

StringSnapshot
Contains one row for each string tag value that was configured to be stored
when a defined event occurred. To view analog, discrete, and string snapshot
values at the same time, use the v_SnapshotData view instead. For more
information, see "v_SnapshotData" on page 86.

Column Data Type Description


(FK) SnapshotTagKey int NOT NULL The unique numerical identifier of the tag
included in the snapshot. SnapshotTagKey
is a foreign key from the SnapshotTag
table.
(FK) EventLogKey int NOT NULL The unique numerical identifier for the
event occurrence. EventLogKey is a
foreign key from the EventHistory table.
Value nvarchar(512) NULL The value of the string tag at the event
timestamp.
Quality tinyint NOT NULL The basic data quality indicator associated
with the data value.
QualityDetail int NULL An internal representation of data quality.

StringTag
Contains one row for each defined string tag. Configuration information
specific to string tags is stored in this table, while general information for all
tag types is stored in the Tag table.

Column Data Type Description


(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system. TagName is
a foreign key from the Tag table.
MaxLength smallint NOT NULL The maximum number of characters for the
string. Valid values are: 8, 16, 24, 32, 48,
64, 128, 131, 256, 512.
InitialValue nvarchar(512) NOT NULL The initial value as imported from an
external source (for example, from
InTouch).
DoubleByte tinyint NOT NULL Used to specify whether or not to store the
string as a double-byte string. 0 = Not
stored as double-byte; 1 = Stored as
double-byte. The default is 0.

IndustrialSQL Server Historian Database Reference


66 Chapter 2

SummaryData
Contains one row for each summarized value, or result, for a tag. The Quality
column contains the highest quality value of the raw data from which the result
is calculated.

Column Data Type Description


(FK) LogKey int NOT NULL The unique numerical identifier of the
summary's historical log. LogKey is a
foreign key from the SummaryHistory
table.
(FK) SumVarKey int NOT NULL The unique numerical identifier for a
summarized tag. SumVarKey is a foreign
key from the SummaryTagList table.
Value float(8) NULL The value of the summary.
Quality tinyint NOT NULL The basic data quality indicator associated
with the data value.
Modified int NOT NULL Used to specify whether or not the data has
been modified. This value is optional. 1 =
Modified; 0 = Not modified.

SummaryHistory
Contains one row for each occurrence of a summary operation. Rows are
inserted even if the operation did not return data.

Column Data Type Description


LogKey int IDENTITY The unique numerical identifier of the
summary's historical log. This value is
automatically generated by the system
when the record is added.
(FK) OperationKey int NOT NULL The unique numerical identifier for the
summary operation. OperationKey is a
foreign key from the SummaryOperation
table.
SummaryDate datetime NOT NULL The date applicable to the results of the
calculation. It is either the time of the
beginning or end of the calculation period,
as specified by the summary operation
definition.
SumDateTimeStamp tinyint NULL Duplication of the TimeStamp column of
the SummaryOperation table at the
SummaryDate. This column allows you to
keep the original calculation timestamp
setting performed, in case of a later
modification of the summary operation
definition.

IndustrialSQL Server Historian Database Reference


Tables 67

Column Data Type Description


SumDateCalcType varchar(3) NULL Duplication of the CalcType column of the
SummaryOperation table at the
SummaryDate. This column allows you to
keep the original calculation type
performed, in case of a later modification
of the summary operation definition.
SumDateDuration real NULL Duplication of the Duration column of the
SummaryOperation table at the
SummaryDate. This column allows you to
keep the original calculation duration used
in case of a later modification of the
summary operation definition.
SumDateResolution int NULL Duplication of the Resolution column of
the SummaryOperation table at the
SummaryDate. This column allows you to
keep the original calculation resolution
used, in case of a later modification of the
summary operation definition.
Status tinyint NOT NULL The flag indicating the status of the
operation. 0 = Operation completed
successfully; Not 0 = Operation is in
progress or has failed. Reserved for future
use.
OperationStart datetime NULL The timestamp at which the calculation
started for the operation.
OperationEnd datetime NULL The timestamp at which the calculation
completed for the operation.

SummaryOperation
Contains one row for each defined summary operation that is associated with
the event tag specified in the TagName column.

Column Data Type Description


OperationKey int IDENTITY The unique numerical identifier for the
summary operation. This value is
automatically generated by the system
when the operation is added.
(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system. TagName is
a foreign key from the EventTag table.
(FK) CalcType char(3) NOT NULL The type of calculation to be performed:
SUM, MAX, MIN, or AVG. CalcType is a
foreign key from the CalcType table.
Description nvarchar(50) NULL The description of the summary operation.

IndustrialSQL Server Historian Database Reference


68 Chapter 2

Column Data Type Description


Duration real NOT NULL The period, in seconds, for which the
calculation is performed.
Resolution int NOT NULL The sampling rate, in milliseconds, for
retrieving the data in cyclic mode. The
system returns values stored over the
requested time period at the interval
specified by the resolution. For example, if
you specify a 5000 ms resolution, the
system queries for all data during the time
period and then only returns those values
that occur at each 5000 ms interval, starting
with the start date and ending with the end
date.
TimeStamp tinyint NOT NULL The timestamp to use when storing the
result of the calculation. This can either be
the time of when the calculation period
starts or the time when it ends.0 =
Beginning of the calculation period; 1 =
End of the calculation period.
Frequency nvarchar(12) NULL The name for the frequency.
SourceType varchar(3) NULL The type of summary, set to 'DYN' (for
"dynamic" data). Used for backward
compatibility with Industrial Workbook.

SummaryTagList
Contains one row for each combination of a summarized tag and a specific
summary operation. This table is a linking table that allows tags to be
associated with a type of operation.

Column Data Type Description


SumVarKey int IDENTITY The unique numerical identifier for a
summarized tag. This value is
automatically generated by the system
when the summarized tag is added.
(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system. TagName is
a foreign key from the Tag table.
(FK) OperationKey int NOT NULL The unique numerical identifier for the
summary operation. OperationKey is a
foreign key from the SummaryOperation
table.
LowerLimit float(8) NULL The lower limit of validity for the tag's
value. Values lower than this limit are not
used in the calculation. By default, this
value is set to -1000000000.

IndustrialSQL Server Historian Database Reference


Tables 69

Column Data Type Description


UpperLimit float(8) NULL The upper limit of validity for the tag's
value. Values higher than this limit are not
used in the calculation. By default, this
value is set to 1000000000.
Description nvarchar(50) NULL The description of the summarized tag.
This normally describes the result of the
operation, although this description can be
the same as that of the tag on which the
operation is performed.

SystemParameter
Contains one row for each system parameter.

Column Data Type Description


Name nvarchar(50) NOT NULL The unique name for the system parameter.
Value sql_variant NULL The value of the system parameter.
Editable bit NOT NULL Used to determine if the value of the named
system parameter can be changed using the
InSQL Console. 1 = Editable; 0 = Not
editable.
Description nvarchar(255) NULL The description of the system parameter.
Status tinyint NULL Automatically updated by the system if a
change is made to the named system
parameter: 0 = No change; 1 = Insertion; 2
= Modification; 3 = Deletion.

Tag
Contains one row for each tag in the system and includes the basic definition
for the tag, such as the I/O Server that supplies the values.

Column Data Type Description


TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system.
(FK) IOServerKey int NULL The unique numerical identifier for the I/O
Server. IOServerKey is a foreign key from
the IOServer table.
(FK) StorageNodeKey int NOT NULL The unique numerical identifier for the
storage node. StorageNodeKey is a foreign
key from the StorageNode table.
wwTagKey int IDENTITY The unique numerical identifier for the tag
within a single IndustrialSQL Server. This
value is automatically generated by the
system when the tag is added.

IndustrialSQL Server Historian Database Reference


70 Chapter 2

Column Data Type Description


(FK) TopicKey int NULL The unique numerical identifier for the
topic. TopicKey is a foreign key from the
Topic table.
Description nvarchar(512) NULL The description of the tag.
AcquisitionType tinyint NOT NULL The method by which the tag's value is
acquired. If the tag value is acquired from
an I/O Server, specify the name of the I/O
Server, topic, and item. 0 = Not acquired; 1
= Acquired via an I/O Server; 2 = Acquired
via MDAS or a manual update; 3 = System
driver.
StorageType smallint NOT NULL The type of storage defined for the tag. 0 =
Not stored; 1 = Cyclic; 2 = Delta; 3 =
Forced storage; 17 = The storage type has
been changed from cyclic to "not stored."
18 = The storage type has been changed
from delta to "not stored." 19 = The storage
type has been changed from "forced" to
"not stored."
AcquisitionRate int NULL For polled tags of AcquisitionType 1, the
poll rate in milliseconds. Reserved for
future use.
StorageRate int NOT NULL The rate at which the tag is stored if the
storage type is cyclic. The rate is in
milliseconds.
ItemName nvarchar(256) NULL The address string of the tag.
TagType int NOT NULL The type of tag. 1 = Analog; 2 = Discrete; 3
= String; 4 = Complex; 5 = Event.
TimeDeadband int NULL The minimum time, in milliseconds,
between stored values for a single tag. Any
value changes that occur within the time
deadband are not stored. The time
deadband applies to delta storage only. A
time deadband of 0 indicates that the
system will store the value of the tag each
time it changes.
DateCreated datetime NOT NULL The date that the tag was created. If not
specified, this date will be automatically
generated.
CreatedBy nvarchar(256) NOT NULL The name of the user or application that
created the tag. If not specified, this name
will be automatically generated.

IndustrialSQL Server Historian Database Reference


Tables 71

Column Data Type Description


CurrentEditor int NULL Used to specify which application or
editing environment controls the tag
definition. Tags imported from the InTouch
HMI software use InTouch as the current
editor. If modifications are made to an
imported tag in the historian Configuration
Editor, then the current editor for the tag is
changed to InSQL. If a re-import is
performed, any modifications made using
the Configuration Editor are preserved.
You can manually maintain InTouch as the
current editor for re-importing; however,
all changes made to the tag using the
Configuration Editor are lost during the re-
import. Tags (attributes) that are initially
configured using Industrial Application
Server (IAS) use IAS as the current editor.
If you modify an IAS tag using the
historian Configuration Editor, then the
current editor for the tag is changed to
InSQL. However, the next time you
redeploy the engine, the changes are not
preserved. 0 = IndustrialSQL Server; 1 =
InTouch; 2 = Application other than
IndustrialSQL Server or InTouch.
SamplesInActiveImage int NULL The number of samples that the active
image holds for the tag. 0 indicates that the
active image is using the default of 65
values. The higher the number of samples,
the higher the load on memory resources.
AIRetrievalMode tinyint NULL Used to specify the behavior of retrieval for
data in active image. You can either
retrieve from all acquired data values that
are currently in the active image, or only
the data values that are configured to be
stored on disk. Data on disk may be a
subset of that in the active image,
depending on the storage rate for the
tag.Valid values are: 0 = All of the values
received into the active image will be
included in the returned data (default); 1 =
Only the values that will be moved into
storage will be included in the returned
data.
Status tinyint NULL Automatically updated by the system if a
change is made to the tag: 0 = No change; 1
= Insertion; 2 = Modification; 3 = Deletion.

IndustrialSQL Server Historian Database Reference


72 Chapter 2

Column Data Type Description


CalculatedAISamples int NULL The number of values required in the active
image to hold data for 1 min (+15%), as
calculated by the system. This value is
updated only if the AIAutoResize system
parameter is set to 1 and the number of
required samples is greater than 65. This
value is written to the
SamplesInActiveImage column of the Tag
table at system startup.
ServerTimeStamp bit NOT NULL Used to indicate whether local
timestamping by the IndustrialSQL Server
is used. 0 = The IDAS timestamp is used; 1
= The IndustrialSQL Server time is used
for the timestamp. If a fast-changing tag is
configured to use server timestamping, the
packet of data that is sent to the storage
subsystem may contain multiple data
values with the same timestamp, which
may affect data calculations, such as for
swinging door storage.
DeadbandType smallint NOT NULL The type of delta storage deadband to be
applied for the tag. This setting is only in
effect if delta storage is configured for the
tag. 1= Time and/or value deadband; 2 =
Rate (swinging door) deadband.
CEVersion tinyint NOT NULL The version number used to track changes
to the information in the Tag table. Any
change to the data in a row will cause the
version indicator to change. The
Configuration Editor (and other client
tools) can detect the changed version and
reload the corresponding tag details.
Changes to this column are not tracked by
the modification tracking system.

IndustrialSQL Server Historian Database Reference


Tables 73

TagRef
Contains one row for each tag in the system. This table is used as a reference
table for the Tag table, so that the TagName column is not propagated as the
primary key of child tables.

Column Data Type Description


wwDomainTagKey int IDENTITY The unique numerical identifier for a tag in
a specific domain. This value is
automatically generated by the system
when the tag is added.
wwTagKey int NOT NULL The unique numerical identifier for the tag
within a single IndustrialSQL Server.
wwTagKey is populated from the Tag
table, but is not a foreign key.
(FK) ServerKey int NOT NULL The unique numerical identifier for the
IndustrialSQL Server. ServerKey is a
foreign key from the ServerList table.
(FK) TagName nvarchar(256) NULL The unique name of the tag within the
IndustrialSQL Server system. TagName is
a foreign key from the Tag table.
TagType int NOT NULL The type of tag. 1 = Analog; 2 = Discrete;
3 = String; 4 = Complex; 5 = Event.

TimeDetectorDetail
Contains a least one row for each event tag associated with a time detector.

Column Data Type Description


TimeDetectorDetailKey int IDENTITY The unique numerical identifier for each
time-based event tag. This value is
automatically generated by the system
when a time-based event tag is created.
(FK) FrequencyID int NOT NULL The unique numerical identifier for the
frequency. Used to link a frequency with a
time-based detector. 1= Hourly; 2 = Daily;
3 = Weekly; 4 = Monthly; 5 = Periodic; 6 =
Other (Reserved for future use).
FrequencyID is a foreign key from the
Frequency table.
(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system. TagName is
a foreign key from the EventTag table.
Periodicity int NULL The interval period in minutes between
detector events. Only used for a periodic
detection.

IndustrialSQL Server Historian Database Reference


74 Chapter 2

Column Data Type Description


StartDateTime datetime NULL The timestamp from which the time
detector starts. Only used for a periodic
detection.
RunTimeDay tinyint NULL In the context of a weekly detector,
RunTimeDay maps the week day number
(0 = Sunday – 6 = Saturday). In the context
of a monthly detector, RunTimeDay maps
to the day of the month. Not used for
periodic detections.
RunTimeHour tinyint NULL The hour of the day at which the time
detector triggers. Not used for periodic
detections.
RunTimeMin tinyint NULL The minute of the hour at which the time
detector triggers. Not used for periodic
detections.

TimeDetectorDetailPendingDelete
Contains one row for each time detector that is pending deletion. This table is
used internally by the system during the deletion process.
The columns in this table are the same as in the TimeDetectorDetail table.

TimeZone
Contains one row for each time zone as defined by the Windows® operating
system. This table is automatically populated by the system.

Column Data Type Description


TimeZoneID smallint NULL The unique numerical identifier for the
time zone.
TimeZone nvarchar(100) NULL The name of the time zone.
Description nvarchar(100) NULL The description of the time zone that
includes the hour offset from UTC (GMT)
and major cities or regions in the time
zone.
Offset smallint NOT NULL The offset, in minutes, for daylight savings
time, when in effect.
RegistryName nvarchar(100) NULL The Windows registry name of the time
zone, which is always in English.

IndustrialSQL Server Historian Database Reference


Tables 75

Topic
Contains one row for each topic to be read from an I/O Server.

Column Data Type Description


TopicKey int IDENTITY The unique numerical identifier for the
topic. This value is automatically
generated by the system when the topic is
added.
(FK) IOServerKey int NOT NULL The unique numerical identifier for the I/O
Server. IOServerKey is a foreign key from
the IOServer table.
(FK) StorageNodeKey int NOT NULL The unique numerical identifier for the
storage node. StorageNodeKey is a foreign
key from the StorageNode table.
Name nvarchar(80) NOT NULL The name of the topic.
TimeOut int NOT NULL The time span, in milliseconds, in which a
data point must be received on the topic. If
no data point is received in this time span,
the topic is considered "dead." The
historian disconnects and then attempts to
reconnect to the topic.
Status tinyint NULL Automatically updated by the system if a
change is made to the topic: 0 = No
change; 1 = Insertion; 2 = Modification; 3
= Deletion.
LateData bit NOT NULL Used to enable acquisition of "late" data. 0
= Late data disabled; 1 = Late data
enabled.
IdleDuration int NOT NULL The amount of time, in seconds, before
data is processed from the I/O Server. For
example, if you set this value to 60
seconds, data from this I/O Server is
cached and only processed by the storage
engine after no more data has been
received from the I/O Server for at least 60
seconds.
ProcessingInterval int NOT NULL The amount of time, in seconds, after
which late data from the I/O Server is
processed, regardless of the idle duration.
If the nature of the data is such that the idle
duration is never satisfied, the historian
storage engine processes data from the
topic at least one time every processing
interval. The processing interval defaults to
twice the idle duration and cannot be set to
a value less than the idle duration.

IndustrialSQL Server Historian Database Reference


76 Chapter 2

TopicImportInfo
Contains one row for each topic definition imported from an InTouch node.

Column Data Type Description


(FK) NodeKey int NOT NULL The unique numerical identifier for the
named InTouch node. This value is
automatically generated by the system
when the node is added.
DdeSourceKey int NOT NULL The unique identifier for the DDE source.
Assigned by the IndustrialSQL Server
system when data is imported.
SourceName nchar(50) NOT NULL The DDE access name from InTouch.
ApplicationName nchar(50) NULL The name of the InTouch application from
which the topic definition is imported.
TopicName nchar(50) NOT NULL The name of the topic definition that is
imported.
RequestInitialData bit NOT NULL Used to determine if the topic was
configured to request initial data. See the
InTouch documentation for more
information. Internal use only.
AlwaysAdvise bit NOT NULL Used to determine if the topic was
configured to poll all items for data. See
the InTouch documentation for more
information. Internal use only.
DefaultStorageRate int NOT NULL The cyclic storage rate for the topic.
Internal use only.
DefaultStorageType int NOT NULL The default storage type for the topic.
Internal use only.
TimeDeadband int NOT NULL The minimum time, in milliseconds,
between returned values for a single tag.
Applies only to delta retrieval.
ValueDeadband float(25) NOT NULL Either the InTouch log deadband or the
IndustrialSQL Server historian deadband,
as specified by the DeadbandType column.
Internal use only.
DeadbandType tinyint NULL The type of deadband used. Internal use
only.
Import bit NOT NULL Used to indicate whether the topic has
previously been imported from InTouch
into IndustrialSQL Server. Internal use
only.
ProtocolType tinyint NOT NULL The protocol used by the IndustrialSQL
Server to communicate with the I/O Server.
Internal use only.

IndustrialSQL Server Historian Database Reference


Tables 77

Column Data Type Description


IODriverKey int NULL The unique identifier for an IDAS.
RateDeadband float(25) NOT NULL The rate deadband that was specified
during the InTouch topic import. Internal
use only. This rate deadband is not used for
swinging door storage. For more
information on the rate deadband for
swinging door storage, see "AnalogTag"
on page 25.

UserDetail
Contains one row for each IndustrialSQL Server historian user. Used to store
additional user information that is not stored in the Microsoft SQL Server
Runtime.sysusers table. Applicable for both users and groups of users.
When the IndustrialSQL Server historian is installed, a SQL job is created on
the Microsoft SQL Server that will automatically update this table every hour.
In order for this job to be executed, however, the SQL Server Agent must be
running. For more information about jobs, see your Microsoft Online Books.

Column Data Type Description


UserKey int NOT NULL The unique numerical identifier for a
database user as defined in the UserDetail
table.
UserName nvarchar(30) NOT NULL The name of the database user.
AccessLevel int NOT NULL The security level for the user. 1 is the
lowest level and 9999 is the highest. Used
to limit access of certain users.
uid int NOT NULL The identifier for the user. This ID is
referenced from the Microsoft SQL Server
sysusers table.
gid int NOT NULL The identifier for the group in which a user
belongs. This ID is referenced from the
Microsoft SQL Server sysusers table.

WideHistory (INSQL.Runtime.dbo.WideHistory)
Contains one row of values for multiple analog, discrete, or string tags for a
single timestamp, thus providing a "wide" view of the data.

IndustrialSQL Server Historian Database Reference


78 Chapter 2

Because tagnames are used as column names for the returned data (indicated
by Tag1, Tag2, and ManyOtherTags), the value data types will be of the
appropriate type for associated tags

Column Data Type Description


DateTime datetime NOT NULL The timestamp for the returned value. For
delta retrieval, this is typically the time at
which the value was acquired by the
IndustrialSQL Server. For cyclic retrieval,
this is the specific time requested or
calculated (using a SQL function).
Tag1 (as per the tag type) NULL The name of a tag to query.
Tag2 (as per the tag type) NULL The name of a tag to query.
ManyOtherTags (as per the tag type) NULL A "placeholder" column for one or more
tags in the wide table format. In the wide
table format, tagnames are used as column
names. The ManyOtherTags column is
"duplicated" for as many tags as are
specified in the database query.
wwRowCount int NULL The number of rows to be returned for a
specified time period. For cyclic retrieval,
the rows are spaced evenly across the time
period, and the default row count is 100
rows. For cyclic retrieval, the row count is
applied for each tag in a query. This
parameter has been deprecated; do not use.
Use the wwCycleCount parameter instead.
wwResolution int NULL The sampling rate, in milliseconds, for
retrieving the data in cyclic mode. The
system returns values stored over the
requested time period at the interval
specified by the resolution. For example, if
you specify a 5000 ms resolution, the
system queries for all data during the time
period and then only returns those values
that occur at each 5000 ms interval, starting
with the start date and ending with the end
date.
wwEdgeDetection nvarchar(20) NULL The type of edge detection result set that
the query will return. Valid values are
NONE, LEADING, TRAILING, and
BOTH.

IndustrialSQL Server Historian Database Reference


Tables 79

Column Data Type Description


wwRetrievalMode nvarchar(20) NULL Used to specify how retrieved data is
processed before it is returned to the client.
Valid values are: CYCLIC, DELTA, FULL,
INTERPOLATED, BESTFIT, AVERAGE,
MINIMUM, MAXIMUM, INTEGRAL,
SLOPE, COUNTER, and VALUESTATE.
FULL = All stored values are returned;
CYCLIC = All stored data for tags during
the specified time interval are returned for
the number of retrieval cycles or resolution
specified; DELTA = Only values that
changed during the specified time interval
are returned. For all other modes, a
calculation is performed by the system on
the data and the value(s) are returned. The
default is CYCLIC for retrieval from
analog tables, DELTA for retrieval from
discrete and string tables, and default is
DELTA for retrieval from the History table,
unless the specific retrieval mode implies
otherwise. For example, SLOPE always
has DELTA characteristics.
wwTimeDeadband int NULL The minimum time, in milliseconds,
between returned values for a single tag.
Applies only to delta retrieval.
wwValueDeadband real NULL The percentage of full scale (range), in
engineering units. Any value changes that
are less than this percentage will not be
returned. Applies only to delta retrieval.
The default is 0.
wwTimeZone nvarchar(50) NULL Used to specify the time zone for retrieval.
By default, the retrieval subsystem will
convert the UTC (Universal Time
Coordinated) timestamps for the stored
data to the local time of the IndustrialSQL
Server computer, including adjustments for
daylight savings time. In order to keep the
timestamps in UTC, set the value of
wwTimeZone to UTC. To convert the
timestamps to a client computer's time
zone, set this parameter to the appropriate
time zone text key from the TimeZone
table.

IndustrialSQL Server Historian Database Reference


80 Chapter 2

Column Data Type Description


wwVersion nvarchar(30) NULL If the original data values have been
modified in the database, use this column
to specify which version of the stored data
is to be retrieved. Valid values are:
ORIGINAL or LATEST. If no parameter is
specified, the latest version of the data is
retrieved by default. Modification is
indicated by the QualityDetail.
wwCycleCount int NULL The number of retrieval cycles (sub-
intervals) for the specified time period. The
cycles will be spaced evenly across the
time period. For example, if you specify a
cycle count of four, the time period will be
divided into four even cycles, and one or
more values (depending on the retrieval
mode) will be returned per each cycle.
wwTimeStampRule nvarchar(20) NULL Used to specify whether cyclic results are
timestamped at the beginning of the cycle
or at the end of the cycle. Valid values are
START and END. If no timestamp rule is
specified in the query, then retrieval uses
the setting of the TimeStampRule system
parameter.
wwInterpolationType nvarchar(20) NULL Used to determine which analog value to
return at a given cycle boundary. Valid
values are STAIRSTEP and LINEAR. If
STAIRSTEP is specified, no interpolation
occurs. The last known point is returned
with the given cycle time. If no valid value
can be found, a NULL is returned. If
LINEAR is specified, the system calculates
a new value at the given cycle time by
interpolating between the last known value
prior to the cycle time and the first value
after the cycle time.

IndustrialSQL Server Historian Database Reference


Tables 81

Column Data Type Description


wwQualityRule nvarchar(20) NULL Used specify whether values with certain
characteristics are explicitly excluded from
consideration by data retrieval. This
parameter will override the setting of the
QualityRule system parameter. Valid
values are GOOD or EXTENDED. A
quality rule of GOOD means that data
values with doubtful OPC quality will not
be used in the retrieval calculations. A
quality rule of EXTENDED means that
data values with both good and doubtful
OPC quality will be used in the retrieval
calculations.
wwParameters nvarchar(128) NULL Used for additional parameters that can be
specified. By default, the value of this
parameter is an empty string.

IndustrialSQL Server Historian Database Reference


82 Chapter 2

IndustrialSQL Server Historian Database Reference


Views 83

C H A P T E R 3

Views

A view is a logical way of looking at data from one or more tables in the
database. A view is a "virtual" table; that is, it does not actually exist in the
database. A view contains pointers to the actual tables in the database. Views
can be used to include a subset of information stored in one or more tables,
while leaving out other information. Views are part of normal SQL Server
functionality.
To make it easier to query data from some of the IndustrialSQL Server
historian tables, a number of views onto the data are provided. Queries are
performed on these views as if they were normal physical tables.

Contents
• History Table Views
• v_EventSnapshot
• v_EventStringSnapshot
• v_ModTracking
• v_SnapshotData
• v_SummaryData

History Table Views


Views have been created for the extension tables to make querying these tables
easier. Normally, you must use the full reference for an extension table in the
query, which is linked_server.catalog.schema.objectname. An extension
table view allows you to simply use the view name instead, eliminating the
need to provide the long reference.
All of the following views reflect the same table structure as the extension
tables after which they are named.

This view: References this extension table:


History INSQL.Runtime.dbo.History
HistoryBlock INSQL.Runtime.dbo.HistoryBlock
Live INSQL.Runtime.dbo.Live

IndustrialSQL Server Historian Database Reference


84 Chapter 3

v_EventSnapshot
Returns one row for each snapshot value for an analog and/or discrete tag
(specified by the TagName column) associated with a particular snapshot event
(specified by the Event column).

Column Data type Description


Event nvarchar(256) NULL The unique name of the tag within the
IndustrialSQL Server system.
EventTime datetime NOT NULL The timestamp reflecting when the event
history data was acquired. This is the time
for when the event actually occurred. This
time reflects the time zone of the
IndustrialSQL Server.
DetectionTime datetime NOT NULL The timestamp reflecting when the event
was detected by the event system.
Edge varchar(8) NOT NULL The "edge" for the event detection. For
more information on edge detection, see
"wwEdgeDetection" on page 151 in your
IndustrialSQL Server™ Historian
Concepts Guide.
TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system.
Value float(8) NULL The value of the tag at the time of the event
occurrence. Measured in engineering units.
Quality tinyint NULL The basic data quality indicator associated
with the data value.
QualityDetail int NULL An internal representation of data quality.

Note When an event is not linked to a snapshot action, the TagName column
is set to '-' and the Value, Quality, and QualityDetail columns are set to
NULL.

v_EventStringSnapshot
Returns one row for each snapshot value for a string tag (specified by the
TagName column) associated with a particular snapshot event (specified by the
Event column).

Column data type Description


Event nvarchar(256) NULL The unique name of the tag within the
IndustrialSQL Server system.
EventTime datetime NOT NULL The timestamp reflecting when the event
history data was acquired. This is the time
for when the event actually occurred. This
time reflects the time zone of the
IndustrialSQL Server.

IndustrialSQL Server Historian Database Reference


Views 85

Column data type Description


DetectionTime datetime NOT NULL The timestamp reflecting when the event
was detected by the event system.
Edge varchar(8) NOT NULL The "edge" for the event detection.
TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system.
Value nvarchar(512) NULL The value of the string tag at the event
timestamp.
Quality tinyint NULL The basic data quality indicator associated
with the data value.
QualityDetail int NULL An internal representation of data quality.

v_ModTracking
Returns one row for each database modification made. For more information,
see "Viewing Database Modifications" on page 183 in your IndustrialSQL
Server™ Historian Administration Guide.

Column Data type Description


DateTime datetime NOT NULL The timestamp of when the modification
occurred.
Table varchar(50) NULL The name of the modified object.
Column varchar(30) NOT NULL The name of the modified column.
ModType char(1) NOT NULL The type of modification. U = Update; I =
Insert; D = Delete; 1 = SQL insert; 2 =
SQL original insert; 3 = SQL update; 4 =
CSV insert; 5 = CSV original insert; 6 =
CSV update; 7 = CSV multi-point update;
8 = CSV "fast load" insert.
RowKey sql_variant NOT NULL The key identifier for the column modified
in the table. For example, TagName for the
Tag table, Name for the Topic table, and so
on.
NewValue sql_variant NULL The new value stored in the column, if the
modification was to a configuration table.
For modifications to history data, this
column contains the total count of
consecutive value updates attempted.

IndustrialSQL Server Historian Database Reference


86 Chapter 3

Column Data type Description


OldValue sql_variant NULL The value stored in the column before the
modification was made, if the modification
was to a configuration table. For
modifications to history data using SQL
INSERT and UPDATE statements, this
column contains the timestamp of the
earliest data affected by the INSERT or
UPDATE operation. If multiple changes
are made to the same data, then only the
most recent change will be contained in
this column. This column is not used for
modifications made to history data using a
CSV file.
User nvarchar(256) NOT NULL The name of the database user that made
the modification. The value of this column
reflects the Windows authentication user
name (for example,
DOMAIN\user_login_name) or the SQL
Server authentication user name (for
example, dbo), depending on how the user
is logged into the SQL Server when the
modification is made. In the case of a CSV
file import, this column contains the user
name as it appears in the CSV file.

v_SnapshotData
Returns one row for each snapshot value for an analog, discrete, and/or string
tag (specified by the TagName column) associated with a particular snapshot
event (specified by the Event column).

Column Data type Description


Event nvarchar(256) NULL The unique name of the tag within the
IndustrialSQL Server system.
EventTime datetime NOT NULL The timestamp reflecting when the event
history data was acquired. This is the time
for when the event actually occurred. This
time reflects the time zone of the
IndustrialSQL Server.
DetectionTime datetime NOT NULL The timestamp reflecting when the event
was detected by the event system.
Edge varchar(8) NOT NULL The "edge" for the event detection.
TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system.
Value nvarchar(512) NULL The value of the snapshot tag at the event
timestamp.

IndustrialSQL Server Historian Database Reference


Views 87

Column Data type Description


Quality tinyint NULL The basic data quality indicator associated
with the data value.
QualityDetail int NULL An internal representation of data quality.

v_SummaryData
Returns one row for each summarization of a tag (specified by the TagName
column) for an associated summary event tag (specified by the EventTag
column). The resolution is applied to data before the calculation is performed.
The quality value returned is the highest quality value of the raw data from
which the result is calculated. For more information, see "Summary Actions"
on page 202 in your IndustrialSQL Server™ Historian Concepts Guide.

Column Data type Description


TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system.
CalcType varchar(3) NULL The type of calculation to be performed:
SUM, MAX, MIN, or AVG.
SummaryDate datetime NOT NULL The date applicable to the results of the
calculation. It is either the time of the
beginning or end of the calculation period,
as specified by the summary operation
definition.
Value float(8) NULL The value of the summary.
Quality tinyint NOT NULL The basic data quality indicator associated
with the data value.
Duration real NULL The period, in seconds, for which the
calculation is performed.
Resolution int NULL The sampling rate, in milliseconds, for
retrieving the data in cyclic mode. The
system returns values stored over the
requested time period at the interval
specified by the resolution. For example, if
you specify a 5000 ms resolution, the
system queries for all data during the time
period and then only returns those values
that occur at each 5000 ms interval, starting
with the start date and ending with the end
date.
TimeStamp tinyint NULL The timestamp to use when storing the
result of the calculation. This can either be
the time of when the calculation period
starts or the time when it ends.
EventTag nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system.

IndustrialSQL Server Historian Database Reference


88 Chapter 3

IndustrialSQL Server Historian Database Reference


Stored Procedures 89

C H A P T E R 4

Stored Procedures

A stored procedure is a pre-compiled group of SQL statements. By using a


stored procedure, you can execute a group of sequentially performed actions in
one query. In addition to the stored procedures supplied with Microsoft SQL
Server, there are three types of stored procedures designed to be used with the
IndustrialSQL Server historian: system stored procedures, user stored
procedures, and extended stored procedures.

Contents
• Stored Procedures
• Extended Stored Procedures
• Stored Procedures for Internal Use
• Creating Stored Procedures

Stored Procedures
Some stored procedures are useful when performing database queries to return
information about specific tags in the system. These stored procedures allow
you to return information on a tag's definition or to narrow the scope of a query
on a data storage table. You can use these stored procedures when querying the
database using ad-hoc query tools, such as SQL Server Query Analyzer.
Other stored procedures are used to configure the IndustrialSQL Server
historian. These system stored procedures are normally executed during startup
and during changes to the system configuration. These stored procedures are
used mainly by the historian setup program, the event subsystem, the System
Management Console, and client applications.

Note Stored procedures prefixed with "ww_" are provided only for backward
compatibility. For more information, see "Renamed Stored Procedures" on
page 209.

aaActionStringSelect
Selects the action string for a specified event tag.

IndustrialSQL Server Historian Database Reference


90 Chapter 4

Syntax
aaActionStringSelect TagName
Arguments
TagName
The unique name of the tag within the IndustrialSQL Server system.This
value is of data type nvarchar(256), with no default.
Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaDetectorStringSelect

aaAddTag
Inserts a tag into the database.

Note Do not use this stored procedure.

Syntax
aaAddTag wTagName, wTopicKey, wIOServerKey,
wStorageNodeKey, wDescription, wAcquisitionType,
wStorageType, wAcquisitionRate, wStorageRate,
wItemName, wTagType, wTimeDeadband, wCurrentEditor
Arguments
wTagName
The unique name of the tag within the IndustrialSQL Server system.This
value is of data type nvarchar(256), with no default.
wTopicKey
The unique numerical identifier for the topic. This value is of data type int,
with no default.
wIOServerKey
The unique numerical identifier for the I/O Server. This value is of data
type int, with no default.
wStorageNodeKey
The unique numerical identifier for the storage node. This value is of data
type int, with no default.
wDescription
The description of the tag. This value is of data type nvarchar(512), with
no default.
wAcquisitionType
The method by which the tag's value is acquired. If the tag value is
acquired from an I/O Server, specify the name of the I/O Server, topic, and
item. 0 = Not acquired; 1 = Acquired via an I/O Server; 2 = Acquired via
MDAS or a manual update; 3 = System driver. This value is of data type
tinyint, with no default.

IndustrialSQL Server Historian Database Reference


Stored Procedures 91

wStorageType
The type of storage defined for the tag. 0 = Not stored; 1 = Cyclic; 2 =
Delta; 3 = Forced storage; 17 = The storage type has been changed from
cyclic to "not stored." 18 = The storage type has been changed from delta
to "not stored." 19 = The storage type has been changed from "forced" to
"not stored." This value is of data type smallint, with no default.
wAcquisitionRate
For polled tags of AcquisitionType 1, the poll rate in milliseconds.
Reserved for future use. This value is of data type int, with no default.
wStorageRate
The rate at which the tag is stored if the storage type is cyclic. This value
is of data type int, with no default.
wItemName
The address string of the tag. This value is of data type nvarchar(256),
with no default.
wTagType
The type of tag. 1 = Analog; 2 = Discrete; 3 = String; 4 = Complex; 5 =
Event. This value is of data type int, with no default.
wTimeDeadband
The minimum time, in milliseconds, between stored values for a single
tag. Any value changes that occur within the time deadband are not stored.
The time deadband applies to delta storage only. A time deadband of 0
indicates that the system will store the value of the tag each time it
changes. This value is of data type int, with no default.
wCurrentEditor
Used to specify which application or editing environment controls the tag
definition. Tags imported from the InTouch HMI software use InTouch as
the current editor. If modifications are made to an imported tag in the
historian Configuration Editor, then the current editor for the tag is
changed to InSQL. If a re-import is performed, any modifications made
using the Configuration Editor are preserved. You can manually maintain
InTouch as the current editor for re-importing; however, all changes made
to the tag using the Configuration Editor are lost during the re-import.
Tags (attributes) that are initially configured using Industrial Application
Server (IAS) use IAS as the current editor. If you modify an IAS tag using
the historian Configuration Editor, then the current editor for the tag is
changed to InSQL. However, the next time you redeploy the engine, the
changes are not preserved. 0 = IndustrialSQL Server; 1 = InTouch; 2 =
Application other than IndustrialSQL Server or InTouch. This value is of
data type int, with no default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaDeleteTag

IndustrialSQL Server Historian Database Reference


92 Chapter 4

aaAnalogTagDelete
Deletes an analog tag.
Syntax
aaAnalogTagDelete wwTagKey
Arguments
wwTagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with no default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaAnalogTagInsert
aaAnalogTagSelect
aaAnalogTagUpdate

aaAnalogTagInsert
Inserts an analog tag.
Syntax
aaAnalogTagInsert TagName, Description, AcquisitionType,
StorageType, StorageRate, ItemName, TimeDeadband,
CreatedBy, DateCreated, CurrentEditor, EUKey, MinEU,
MaxEU, MinRaw, MaxRaw, Scaling, RawType, ValueDeadband,
InitialValue, IntegerSize, SignedInteger, TopicKey,
IOServerKey, StorageNodeKey, AIRetrievalMode,
SamplesInActiveImage, RateDeadband, InterpolationType,
RolloverValue, ServerTimeStamp, DeadbandType
Arguments
TagName
The unique name of the tag within the IndustrialSQL Server system. This
value is of data type nvarchar(256), with no default.
Description
The description of the tag. This value is of data type nvarchar(512), with a
default of an empty string.
AcquisitionType
The method by which the tag's value is acquired. If the tag value is
acquired from an I/O Server, specify the name of the I/O Server, topic, and
item. 0 = Not acquired; 1 = Acquired via an I/O Server; 2 = Acquired via
MDAS or a manual update; 3 = System driver. This value is of data type
tinyint, with a default of 1.

IndustrialSQL Server Historian Database Reference


Stored Procedures 93

StorageType
The type of storage defined for the tag. 0 = Not stored; 1 = Cyclic; 2 =
Delta; 3 = Forced storage; 17 = The storage type has been changed from
cyclic to "not stored." 18 = The storage type has been changed from delta
to "not stored." 19 = The storage type has been changed from "forced" to
"not stored." This value is of data type smallint, with a default of 2.
StorageRate
The rate at which the tag is stored if the storage type is cyclic. The rate is
in milliseconds. This value is of data type int, with a default of 10000.
ItemName
The address string of the tag. This value is of data type nvarchar(256),
with a default of an empty string.
TimeDeadband
The minimum time, in milliseconds, between stored values for a single
tag. Any value changes that occur within the time deadband are not stored.
The time deadband applies to delta storage only. A time deadband of 0
indicates that the system will store the value of the tag each time it
changes. This value is of data type int, with a default of 0.
CreatedBy
The name of the user or application that created the tag. This value is of
data type nvarchar(256), with a default of an empty string.
DateCreated
The date that the tag was created. This value is of data type datetime, with
a default of NULL.
CurrentEditor
Used to specify which application or editing environment controls the tag
definition. Tags imported from the InTouch HMI software use InTouch as
the current editor. If modifications are made to an imported tag in the
historian Configuration Editor, then the current editor for the tag is
changed to InSQL. If a re-import is performed, any modifications made
using the Configuration Editor are preserved. You can manually maintain
InTouch as the current editor for re-importing; however, all changes made
to the tag using the Configuration Editor are lost during the re-import.
Tags (attributes) that are initially configured using Industrial Application
Server (IAS) use IAS as the current editor. If you modify an IAS tag using
the historian Configuration Editor, then the current editor for the tag is
changed to InSQL. However, the next time you redeploy the engine, the
changes are not preserved. 0 = IndustrialSQL Server; 1 = InTouch; 2 =
Application other than IndustrialSQL Server or InTouch. This value is of
data type int, with a default of 0.
EUKey
The unique numerical identifier for the engineering unit. This value is of
data type int, with a default of 1.
MinEU
The minimum value of the tag, measured in engineering units. This value
is of data type float(25), with a default of 0.
MaxEU
The maximum value of the tag, measured in engineering units. This value
is of data type float(25), with a default of 100.

IndustrialSQL Server Historian Database Reference


94 Chapter 4

MinRaw
The minimum value of the raw acquired value. This value is of data type
float(25), with a default of 0.
MaxRaw
The maximum value of the raw acquired value. This value is of data type
float(25), with a default of 4095.
Scaling
The type of algorithm used when scaling from raw values to engineering
units. For linear scaling, the result is calculated using linear interpolation
between the end points. 0 = None; 1 = Linear; 2 = Square Root. (Square
root is reserved for future use). This value is of data type int, with a default
of 1.
RawType
The numeric type for the raw value. 1 = Euro Float, an outdated data type
(4 bytes); 2 = MS Float (4 bytes); 3 = Integer (2 or 4 bytes); 4 = MS
Double (reserved for future use) (8 bytes). This value is of data type int,
with a default of 3.
ValueDeadband
The percentage of the difference between the minimum and maximum
engineering units for the tag. Any data values that change less than the
specified deadband are not stored. The value deadband applies to delta
storage only. A value of 0 indicates that a value deadband will not be
applied. This value is of data type float(25), with a default of 0.
InitialValue
The initial value as imported from an external source (for example, from
InTouch). This value is of data type float(25), with a default of 0.
IntegerSize
The bit size of the analog tag. 12 = 12-bit; 15 = 15-bit; 16 = 16-bit; 32 =
32-bit; 64 = 64-bit (future implementation). This value is of data type
tinyint, with a default of 16.
SignedInteger
Used to specify whether an integer is a signed number (positive or
negative) or an unsigned number (positive only). 0 = Unsigned; 1 =
Signed. This value is of data type bit, with a default of 0.
TopicKey
The unique numerical identifier for the topic. This value is of data type int,
with a default of NULL.
IOServerKey
The unique numerical identifier for the I/O Server. This value is of data
type int, with a default of NULL.
StorageNodeKey
The unique numerical identifier for the storage node. This value is of data
type int, with a default of 1.

IndustrialSQL Server Historian Database Reference


Stored Procedures 95

AIRetrievalMode
Used to specify the behavior of retrieval for data in active image. You can
either retrieve from all acquired data values that are currently in the active
image, or only the data values that are configured to be stored on disk.
Data on disk may be a subset of that in the active image, depending on the
storage rate for the tag.Valid values are: 0 = All of the values received into
the active image will be included in the returned data (default); 1 = Only
the values that will be moved into storage will be included in the returned
data. This value is of data type tinyint, with a default of 0.
SamplesInActiveImage
The number of samples that the active image holds for the tag. 0 indicates
that the active image is using the default of 65 values. The higher the
number of samples, the higher the load on memory resources. This value
is of data type int, with a default of 0.
RateDeadband
Used to percentage of deviation in the full-scale value range for an analog
tag. The swinging door (rate) deadband applies to delta storage only. Time
and/or value deadbands can be used in addition to the swinging door
deadband. Any value greater than 0 can be used for the deadband. A value
of 0 indicates that a swinging door deadband will not be applied. This
value is of data type float(25), with a default of 0.
InterpolationType
The interpolation type for retrieval. 0 = Stair-stepped interpolation; 1 =
Linear interpolation (if applicable, based on the tag type); 254 = System
default interpolation mode. The system default interpolation type is to use
the system default for the analog type, either integer or real. The system
default interpolation type for an analog type is determined by the setting of
the InterpolationTypeInteger and InterpolationTypeReal system
parameters. This setting impacts Interpolated, Average, and Integral
retrieval modes. This value is of data type tinyint, with a default of 254.
RolloverValue
The first value that causes the counter to "roll over." This rollover value is
used for the "counter" retrieval mode. For example, for a counter that
counts from 0 to 9999, the counter rolls over back to 0 for the 10,000th
value it receives. Therefore, set the rollover value to 10,000. This value is
of data type int, with a default of 0.
ServerTimeStamp
Used to specify whether local timestamping by the IndustrialSQL Server
is used. 0 = The IDAS timestamp is used; 1 = The IndustrialSQL Server
time is used for the timestamp. If a fast-changing tag is configured to use
server timestamping, the packet of data that is sent to the storage
subsystem may contain multiple data values with the same timestamp,
which may affect data calculations, such as for swinging door storage.
This value is of data type bit, with a default of 0.
DeadbandType
The type of delta storage deadband to be applied for the tag. This setting is
only in effect if delta storage is configured for the tag. 1= Time and/or
value deadband; 2 = Rate (swinging door) deadband. This value is of data
type smallint, with a default of 1.

IndustrialSQL Server Historian Database Reference


96 Chapter 4

Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaAnalogTagSelect
aaAnalogTagDelete
aaAnalogTagUpdate

aaAnalogTagSelect
Selects an analog tag.
Syntax
aaAnalogTagSelect wwTagKey
Arguments
wwTagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with a default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaAnalogTagInsert
aaAnalogTagDelete
aaAnalogTagUpdate

aaAnalogTagUpdate
Updates an analog tag.
Syntax
aaAnalogTagUpdate wwTagKey, TagName, Description,
AcquisitionType, StorageType, StorageRate, ItemName,
TimeDeadband, CreatedBy, DateCreated, CurrentEditor,
EUKey, MinEU, MaxEU, MinRaw, MaxRaw, Scaling, RawType,
ValueDeadband, InitialValue, IntegerSize,
SignedInteger, TopicKey, IOServerKey, StorageNodeKey,
AIRetrievalMode, SamplesInActiveImage, RateDeadband,
InterpolationType, RolloverValue, ServerTimeStamp,
DeadbandType
Arguments
wwTagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with no default.

IndustrialSQL Server Historian Database Reference


Stored Procedures 97

The remaining arguments are the same as the aaAnalogTagInsert stored


procedure. However, only the Description, AcquisitionType, ItemName,
CreatedBy, DateCreated, CurrentEditor, SamplesInActiveImage,
RateDeadband, InterpolationType, RolloverValue, ServerTimeStamp, and
DeadbandType arguments have defaults.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaAnalogTagSelect
aaAnalogTagDelete
aaAnalogTagInsert

aaAnnotationDelete
Deletes an annotation.
Syntax
aaAnnotationDelete AnnotationKey
Arguments
AnnotationKey
The unique numerical identifier for the annotation. This value is of data
type int, with no default.
Permission
Execute permission defaults to the aaUsers, aaPowerUsers, and
aaAdministrators groups.
See Also
aaAnnotationSelect
aaAnnotationUpdate
aaAnnotationInsert
aaAnnotationRetrieve

aaAnnotationInsert
Inserts an annotation.
Syntax
aaAnnotationInsert TagName, UserKey, DateTime,
DateCreated, Content, Value
Arguments
TagName
The unique name of the tag within the IndustrialSQL Server system. This
value is of data type nvarchar(256), with no default.
UserKey
The unique numerical identifier for a database user as defined in the
UserDetail table. This value is of data type int, with a default of NULL.

IndustrialSQL Server Historian Database Reference


98 Chapter 4

DateTime
The timestamp of the tag value for which the user has made an annotation.
This value is of data type datetime, with a default of NULL.
DateCreated
The date that the annotation was created. This value is of data type
datetime, with a default of NULL.
Content
The annotation text. This value is of data type ntext, with a default of
"Annotation."
Value
The value of the tag at the time of the annotation. This value is of data type
real, with a default of 0.0.
Permission
Execute permission defaults to the aaUsers, aaPowerUsers, and
aaAdministrators groups.
See Also
aaAnnotationSelect
aaAnnotationUpdate
aaAnnotationDelete
aaAnnotationRetrieve

aaAnnotationRetrieve
Retrieves one or more annotations.
Syntax
aaAnnotationRetrieve TagList, StartTime, EndTime
Arguments
TagList
A list of tags delimited by a comma (,). This value is of data type
nvarchar(4000), with no default.
StartTime
The starting timestamp for the data to query. This value is of data type
nvarchar(50), with no default.
EndTime
The ending timestamp for the data to query. This value is of data type
nvarchar(50), with no default.
Permission
Execute permission defaults to the public group.
See Also
aaAnnotationInsert
aaAnnotationUpdate
aaAnnotationDelete
aaAnnotationSelect

IndustrialSQL Server Historian Database Reference


Stored Procedures 99

aaAnnotationSelect
Selects an annotation.
Syntax
aaAnnotationSelect AnnotationKey
Arguments
AnnotationKey
The unique numerical identifier for the annotation. This value is of data
type int, with a default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaAnnotationInsert
aaAnnotationUpdate
aaAnnotationDelete
aaAnnotationRetrieve

aaAnnotationUpdate
Updates an annotation.
Syntax
aaAnnotationUpdate AnnotationKey, TagName, UserKey,
DateTime, DateCreated, Content, Value
Arguments
AnnotationKey
The unique numerical identifier for the annotation. This value is of data
type int, with no default.
The remaining arguments are similar to those for the aaAnnotationInsert
stored procedure.
Permission
Execute permission defaults to the aaUsers, aaPowerUsers, and
aaAdministrators groups.
See Also
aaAnnotationSelect
aaAnnotationInsert
aaAnnotationDelete
aaAnnotationRetrieve

aaArchestrANSClear
Removes all ArchestrA entries from the public namespace.
Syntax
aaArchestrANSClear

IndustrialSQL Server Historian Database Reference


100 Chapter 4

Remarks
In general, using this stored procedure is not recommended. If you need to
remove the ArchestrA entries because of a namespace corruption, contact
Technical Support for guidance.
Permission
Execute permission defaults to the aaAdministrators group.

aaCleanupAfterCommit
Runs once after re-initialization or system startup is complete.
Syntax
aaCleanupAfterCommit
Remarks
This stored procedure:
1. Sets the DbStatus column of the StorageNode table to 0.
2. Deletes the contents of the ConfigStatusSnapshot table.
Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaCommitChanges

aaCleanupSystemNotRunning
Runs once whether or not re-initialization or system startup is complete. For
internal use only.
Syntax
aaCleanupSystemNotRunning
Remarks
This stored procedure:
1. Sets the DbStatus column of the StorageNode table to 0.
2. Deletes information from the ConfigStatusSnapshot table.
Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaCleanupAfterCommit
aaCommitChangesAtStartup
aaCommitChanges

aaCommitChanges
Used to trigger a re-initialization of the system.

IndustrialSQL Server Historian Database Reference


Stored Procedures 101

Syntax
aaCommitChanges
Remarks
This stored procedure performs the following if a change is made:
1. Copies the contents of the ConfigStatusPending table to the
ConfigStatusSnapshot table.
2. Resets the Status column in the applicable database table (Tag, Topic,
IOServer, IODriver, StorageLocation, SnapshotDetail, or
SystemParameter) to 0.
3. Deletes the contents of the ConfigStatusPending table.
Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaCleanupAfterCommit
aaCommitChangesAtStartup

aaCommitChangesAtStartup
Used to specify a re-initialization of the system at startup.
Syntax
aaCommitChangesAtStartup
Remarks
This stored procedure is used only when a modification to a storage location
has been made. The functionality of this stored procedure is similar to that of
aaCommitChanges.
Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaCommitChanges

aaContextDelete
Deletes a context.
Syntax
aaContextDelete ContextKey
Arguments
ContextKey
The unique numerical identifier for the context. This value is of data type
int, with no default.

IndustrialSQL Server Historian Database Reference


102 Chapter 4

Permission
Execute permission defaults to the aaPowerUsers, and aaAdministrators
groups.
See Also
aaContextSelect
aaContextUpdate
aaContextInsert

aaContextInsert
Inserts a context.
Syntax
aaContextInsert Description
Arguments
Description
The description of the context. This value is of data type nvarchar(50),
with a default of NULL.
Permission
Execute permission defaults to the aaPowerUsers, and aaAdministrators
groups.
See Also
aaContextSelect
aaContextUpdate
aaContextDelete

aaContextSelect
Selects a context.
Syntax
aaContextSelect ContextKey
Arguments
ContextKey
The unique numerical identifier for the context. This value is of data type
int, with a default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaContextInsert
aaContextUpdate
aaContextDelete

IndustrialSQL Server Historian Database Reference


Stored Procedures 103

aaContextUpdate
Updates a context.
Syntax
aaContextUpdate ContextKey, Description
Arguments
ContextKey
The unique numerical identifier for the context. This value is of data type
int, with no default.
The remaining argument is the same as for the aaContextInsert stored
procedure. However, the argument does not have a default.
Permission
Execute permission defaults to the aaPowerUsers, and aaAdministrators
groups.
See Also
aaContextInsert
aaContextSelect
aaContextDelete

aaDBChangesPending
Returns a list of modifications pending, from the ConfigStatusPending table,
in a readable format.
Syntax
aaDBChangesPending
Permission
Execute permission defaults to the public group.
See Also
aaCommitChanges
aaCleanupAfterCommit

aaDBConfig
Returns a summary of the current database configuration, such as number of
tags, number of tags per type, storage configuration, event tags, summary
configuration, and so on.
Syntax
aaDBConfig
Permission
Execute permission defaults to the public group.

IndustrialSQL Server Historian Database Reference


104 Chapter 4

aaDeleteOlderEvents
Deletes old events from event storage.
Syntax
aaDeleteOlderEvents
Remarks
This stored procedure is executed by the aaSpaceManager stored procedure
every ten minutes. The duration for which events are kept is stored in the
SystemParameter table. Events will be deleted from the EventHistory table.
Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaDeleteOlderSummaries
aaSpaceManager

aaDeleteOlderSummaries
Deletes old summaries from summary storage.
Syntax
aaDeleteOlderSummaries
Remarks
This stored procedure is executed by the aaSpaceManager stored procedure
every ten minutes. The duration for which summaries are kept is stored in the
SystemParameter table. Summaries will be deleted from the
SummaryHistory table.
Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaDeleteOlderEvents
aaSpaceManager

aaDeleteTag
Deletes a tag from the database.
Syntax
aaDeleteTag TagName
Arguments
TagName
The unique name of the tag within the IndustrialSQL Server system.This
value is of data type nvarchar(256), with no default.

IndustrialSQL Server Historian Database Reference


Stored Procedures 105

Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaAddTag

aaDetectorStringSelect
Selects the detector string for a specified event tag.
Syntax
aaDetectorStringSelect TagName
Arguments
TagName
The unique name of the tag within the IndustrialSQL Server system.This
value is of data type nvarchar(256), with no default.
Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaActionStringSelect

aaDiscreteTagDelete
Deletes a discrete tag.
Syntax
aaDiscreteTagDelete wwTagKey
Arguments
wwTagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with no default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaDiscreteTagInsert
aaDiscreteTagUpdate
aaDiscreteTagSelect

aaDiscreteTagInsert
Inserts a discrete tag.
Syntax
aaDiscreteTagInsert TagName, Description, AcquisitionType,
StorageType, StorageRate, ItemName, TimeDeadband,

IndustrialSQL Server Historian Database Reference


106 Chapter 4

CreatedBy, DateCreated, CurrentEditor, MessageKey,


InitialValue, TopicKey, IOServerKey, AIRetrievalMode,
SamplesInActiveImage, ServerTimeStamp, DeadbandType
Arguments
TagName
The unique name of the tag within the IndustrialSQL Server system.This
value is of data type nvarchar(256), with no default.
Description
The description of the tag. This value is of data type nvarchar(512), with a
default of an empty string.
AcquisitionType
The method by which the tag's value is acquired. If the tag value is
acquired from an I/O Server, specify the name of the I/O Server, topic, and
item. 0 = Not acquired; 1 = Acquired via an I/O Server; 2 = Acquired via
MDAS or a manual update; 3 = System driver. This value is of data type
tinyint, with a default of 1.
StorageType
The type of storage defined for the tag. 0 = Not stored; 1 = Cyclic; 2 =
Delta; 3 = Forced storage; 17 = The storage type has been changed from
cyclic to "not stored." 18 = The storage type has been changed from delta
to "not stored." 19 = The storage type has been changed from "forced" to
"not stored." This value is of data type smallint, with a default of 2.
StorageRate
The rate at which the tag is stored if the storage type is cyclic. The rate is
in milliseconds. This value is of data type int, with a default of 0.
ItemName
The address string of the tag. This value is of data type nvarchar(256),
with a default of an empty string.
TimeDeadband
The minimum time, in milliseconds, between stored values for a single
tag. Any value changes that occur within the time deadband are not stored.
The time deadband applies to delta storage only. A time deadband of 0
indicates that the system will store the value of the tag each time it
changes. This value is of data type int, with a default of 0.
CreatedBy
The name of the user or application that created the tag. This value is of
data type nvarchar(256), with a default of an empty string.
DateCreated
The date that the tag was created. This value is of data type datetime, with
a default of NULL.

IndustrialSQL Server Historian Database Reference


Stored Procedures 107

CurrentEditor
Used to specify which application or editing environment controls the tag
definition. Tags imported from the InTouch HMI software use InTouch as
the current editor. If modifications are made to an imported tag in the
historian Configuration Editor, then the current editor for the tag is
changed to InSQL. If a re-import is performed, any modifications made
using the Configuration Editor are preserved. You can manually maintain
InTouch as the current editor for re-importing; however, all changes made
to the tag using the Configuration Editor are lost during the re-import.
Tags (attributes) that are initially configured using Industrial Application
Server (IAS) use IAS as the current editor. If you modify an IAS tag using
the historian Configuration Editor, then the current editor for the tag is
changed to InSQL. However, the next time you redeploy the engine, the
changes are not preserved. 0 = IndustrialSQL Server; 1 = InTouch; 2 =
Application other than IndustrialSQL Server or InTouch. This value is of
data type int, with a default of 0.
MessageKey
The unique numerical identifier for a TRUE/FALSE message pair that can
be associated with a discrete tag. This value is of data type int, with a
default of 1.
InitialValue
The initial value as imported from an external source (for example, from
InTouch). This value is of data type tinyint, with a default of 0.
TopicKey
The unique numerical identifier for the topic. This value is of data type int,
with a default of NULL.
IOServerKey
The unique numerical identifier for the I/O Server. This value is of data
type int, with a default of NULL.
AIRetrievalMode
Used to specify the behavior of retrieval for data in active image. You can
either retrieve from all acquired data values that are currently in the active
image, or only the data values that are configured to be stored on disk.
Data on disk may be a subset of that in the active image, depending on the
storage rate for the tag.Valid values are: 0 = All of the values received into
the active image will be included in the returned data (default); 1 = Only
the values that will be moved into storage will be included in the returned
data. This value is of data type tinyint, with a default of 0.
SamplesInActiveImage
The number of samples that the active image holds for the tag. 0 indicates
that the active image is using the default of 65 values. The higher the
number of samples, the higher the load on memory resources.This value is
of data type int, with a default of 0.

IndustrialSQL Server Historian Database Reference


108 Chapter 4

ServerTimeStamp
Used to specify whether local timestamping by the IndustrialSQL Server
is used. 0 = The IDAS timestamp is used; 1 = The IndustrialSQL Server
time is used for the timestamp. If a fast-changing tag is configured to use
server timestamping, the packet of data that is sent to the storage
subsystem may contain multiple data values with the same timestamp,
which may affect data calculations, such as for swinging door storage.
This value is of data type bit, with a default of 0.
DeadbandType
The type of delta storage deadband to be applied for the tag. This setting is
only in effect if delta storage is configured for the tag. 1= Time and/or
value deadband; 2 = Rate (swinging door) deadband. This value is of data
type smallint, with a default of 1.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaDiscreteTagDelete
aaDiscreteTagUpdate
aaDiscreteTagSelect

aaDiscreteTagSelect
Selects a discrete tag.
Syntax
aaDiscreteTagSelect wwTagKey
Arguments
wwTagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with a default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaDiscreteTagInsert
aaDiscreteTagUpdate
aaDiscreteTagDelete

aaDiscreteTagUpdate
Updates a discrete tag.
Syntax
aaDiscreteTagUpdate wwTagKey, TagName, Description,
AcquisitionType, StorageType, StorageRate, ItemName,
TimeDeadband, CreatedBy, DateCreated, CurrentEditor,
MessageKey, InitialValue, TopicKey, IOServerKey,

IndustrialSQL Server Historian Database Reference


Stored Procedures 109

AIRetrievalMode, SamplesInActiveImage, ServerTimeStamp,


DeadbandType
Arguments
wwTagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with no default.
The remaining arguments are the same as for the aaDiscreteTagInsert stored
procedure. However, only the Description, AcquisitionType, ItemName,
CreatedBy, DateCreated, SamplesInActiveImage, ServerTimeStamp, and
DeadbandType arguments have defaults.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaDiscreteTagDelete
aaDiscreteTagInsert
aaDiscreteTagSelect

aaEngineeringUnitDelete
Deletes an engineering unit.
Syntax
aaEngineeringUnitDelete EUKey
Arguments
EUKey
The unique numerical identifier for the engineering unit. This value is of
data type int, with no default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaEngineeringUnitUpdate
aaEngineeringUnitSelect
aaEngineeringUnitInsert

aaEngineeringUnitInsert
Inserts an engineering unit.
Syntax
aaEngineeringUnitInsert Unit, DefaultTagRate,
IntegralDivisor

IndustrialSQL Server Historian Database Reference


110 Chapter 4

Arguments
Unit
The unit of measure. Examples are mph, grams, and pounds. This value is
of dataype nvarchar(32), with no default.
DefaultTagRate
The default rate, in milliseconds, at which tags are cyclically stored, based
on engineering units. Although the system does not make use of this
engineering unit based tag rate, you can reference this value in custom
SQL scripts. The value you enter for this tag rate does not affect the
default storage rate set for the tag. This value is of data type int, with a
default of 10000.
IntegralDivisor
The factor to be applied when integrating a rate with the units
[EngUnits/TimeUnit] to a quantity with units [EngUnits]. This factor is
called the integral divisor. The default value of 1 assumes a time unit of
seconds and ensures that a rate of [Unit/second] is correctly integrated to
[Unit]. For a time unit of minutes, set the integral divisor value to 60; for a
unit of hours, set the integral divisor value to 3600, and so on. The integral
divisor is applied similarly to rates or quantities that are not expressed in
terms of a time unit. For example, to convert watts to watt-hours, the
integral divisor is 1/3600. To convert watts to kilowatt-hours, the integral
divisor is 1/3600000. This value is of data type float(25), with a default of
1.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaEngineeringUnitDelete
aaEngineeringUnitSelect
aaEngineeringUnitUpdate

aaEngineeringUnitSelect
Selects an engineering unit.
Syntax
aaEngineeringUnitSelect EUKey
Arguments
EUKey
The unique numerical identifier for the engineering unit. This value is of
data type int, with a default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaEngineeringUnitUpdate
aaEngineeringUnitDelete
aaEngineeringUnitInsert

IndustrialSQL Server Historian Database Reference


Stored Procedures 111

aaEngineeringUnitUpdate
Updates an engineering unit.
Syntax
aaEngineeringUnitUpdate EUKey, Unit, DefaultTagRate,
IntegralDivisor
Arguments
EUKey
The unique numerical identifier for the engineering unit. This value is of
data type int, with no default.
The remaining arguments are the same as for the aaEngineeringUnitInsert
stored procedure. However, only the IntegralDivisor argument has a default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaEngineeringUnitDelete
aaEngineeringUnitSelect
aaEngineeringUnitInsert

aaEventDetection
Detects the number of events in history in which the data value for the
specified tag matched the criteria defined by the remaining arguments. This
stored procedure is used by the event subsystem and should not be modified.
Syntax
aaEventDetection TagName, Operator, DetectValue, Edge,
Resolution, StartTime, EndTime
Arguments
TagName
The unique name of the tag within the IndustrialSQL Server system.This
value is of data type nvarchar(256), with no default.
Operator
The comparison operator. Valid values are: >, >=, <, <=, =, <>. This value
is of data type char(2), with no default.
DetectValue
The value against which the stored values for the tag are compared to
determine if the event occurred. This value is of data type float(25), with a
default of none.
Edge
The type of edge detection result set that the query will return. Valid
values are NONE, LEADING, TRAILING, and BOTH. This value is of
data type char(8), with no default.

IndustrialSQL Server Historian Database Reference


112 Chapter 4

Resolution
The sampling rate, in milliseconds, for retrieving the data in cyclic mode.
The system returns values stored over the requested time period at the
interval specified by the resolution. For example, if you specify a 5000 ms
resolution, the system queries for all data during the time period and then
only returns those values that occur at each 5000 ms interval, starting with
the start date and ending with the end date. This value is of data type int,
with no default.
StartTime
The starting timestamp for the data to query. This value is of dataype
varchar(30), with no default.
EndTime
The ending timestamp for the data to query. This value is of dataype
varchar(30), with no default.
Remarks
You can apply a resolution only if you set the value of the Edge argument to
NONE.
Permission
Execute permission defaults to the aaAdministrators group.

aaEventHistoryInsert
Inserts a row into the EventHistory table for each occurrence of an event for a
specified event tag. This stored procedure is used by the event subsystem and
should not be modified.
Syntax
aaEventHistoryInsert TagName, DateTime, DetectDateTime,
Edge
Arguments
TagName
The unique name of the tag within the IndustrialSQL Server system.This
value is of data type nvarchar(256), with no default.
DateTime
The timestamp reflecting when the event history data was acquired. This is
the time for when the event actually occurred. This time reflects the time
zone of the IndustrialSQL Server. This value is of data type datetime, with
no default.
DetectDateTime
The timestamp reflecting when the event was detected by the event
system. This value is of data type datetime, with no default.
Edge
The "edge" for the event detection. 0 = Trailing; 1 = Leading; 2 = Both; 3
= None; 4 = Time Detector; 5 = External Detector. This value is of data
type int, with no default.
Permission
Execute permission defaults to the aaAdministrators group.

IndustrialSQL Server Historian Database Reference


Stored Procedures 113

See Also
aaEventHistorySelect

aaEventHistorySelect
Returns information stored in the EventHistory table for each specified event
tag.
Syntax
aaEventHistorySelect TagList, StartTime, EndTime
Arguments
TagList
A list of tags delimited by a comma (,). This value is of data type
nvarchar(4000), with no default.
StartTime
The starting timestamp for the data to query. This value is of data type
nvarchar(50), with no default.
EndTime
The ending timestamp for the data to query. This value is of data type
nvarchar(50), with no default.
Remarks
This stored procedure will return information for all events that occurred
between the starting time and the ending time.
Permission
Execute permission defaults to the public group.
See Also
aaEventHistoryInsert

aaEventSnapshotInsert
Inserts snapshot values into the AnalogSnapshot, DiscreteSnapshot, and
StringSnapshot tables. This stored procedure is used by the event subsystem
and should not be modified.
Syntax
aaEventSnapshotInsert EventLogKey, EventTime, EventTagName
Arguments
EventLogKey
The unique numerical identifier for the event occurrence. This value is of
data type int, with no default.
EventTime
The timestamp reflecting when the event history data was acquired. This is
the time for when the event actually occurred. This value is of data type
datetime, with no default.

IndustrialSQL Server Historian Database Reference


114 Chapter 4

EventTagName
The name of the event tag to which the snapshot tag is related. This value
is of data type nvarchar(256), with no default.
Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaEventSnapshotSelect

aaEventSnapshotSelect
Returns the snapshot tag values for each of the event tags specified by the tag
list.
Syntax
aaEventSnapshot TagList, StartTime, EndTime, OrderBy
Arguments
TagList
A list of tags delimited by a comma (,). This value is of data type
nvarchar(4000), with no default.
StartTime
The starting timestamp for the data to query. This value is of data type
nvarchar(50), with no default.
EndTime
The ending timestamp for the data to query. This value is of data type
nvarchar(50), with no default.
OrderBy
The name of the column in the v_EventSnapshot view used to order the
rows in the result set. The default is 'Event'.
Remarks
This stored procedure will return information for all events that occurred
between the starting time and the ending time.
Permission
Execute permission defaults to the public group.
See Also
aaEventSnapshotInsert

aaEventTagDelete
Deletes an event tag.
Syntax
aaEventTagDelete wwTagKey

IndustrialSQL Server Historian Database Reference


Stored Procedures 115

Arguments
wwTagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with no default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaEventTagUpdate
aaEventTagInsert
aaEventTagSelect

aaEventTagDetail
Returns the details for a specified event tag, including time detector
information, if applicable.
Syntax
aaEventTagDetail TagList
Arguments
TagList
The list of tags delimited by a comma (,). This value is of data type
nvarchar(4000), with a default of '%'.
Permission
Execute permission defaults to the public group

aaEventTagInsert
Inserts an event tag.
Syntax
aaEventTagInsert TagName, Description, CreatedBy,
DateCreated, CurrentEditor, ScanRate, TimeDeadband,
Logged, Status, PostDetectorDelay, UseThreadPool,
DetectorTypeKey, DetectorString, ActionTypeKey,
ActionString, Priority, Edge
Arguments
TagName
The unique name of the tag within the IndustrialSQL Server system.This
value is of data type nvarchar(256), with no default.
Description
The description of the tag. This value is of data type nvarchar(512), with a
default of an empty string.
CreatedBy
The name of the user or application that created the tag. This value is of
data type nvarchar(256), with a default of an empty string.

IndustrialSQL Server Historian Database Reference


116 Chapter 4

DateCreated
The date that the tag was created. This value is of data type datetime, with
a default of NULL.
CurrentEditor
Used to specify which application or editing environment controls the tag
definition. Tags imported from the InTouch HMI software use InTouch as
the current editor. If modifications are made to an imported tag in the
historian Configuration Editor, then the current editor for the tag is
changed to InSQL. If a re-import is performed, any modifications made
using the Configuration Editor are preserved. You can manually maintain
InTouch as the current editor for re-importing; however, all changes made
to the tag using the Configuration Editor are lost during the re-import.
Tags (attributes) that are initially configured using Industrial Application
Server (IAS) use IAS as the current editor. If you modify an IAS tag using
the historian Configuration Editor, then the current editor for the tag is
changed to InSQL. However, the next time you redeploy the engine, the
changes are not preserved. 0 = IndustrialSQL Server; 1 = InTouch; 2 =
Application other than IndustrialSQL Server or InTouch. This value is of
data type int, with a default of 0.
ScanRate
The interval, in milliseconds, at which the system checks to see if the
event conditions specified by the detector occurred. This value must be
greater than or equal to 500 milliseconds, and less than or equal to 1 hour
(3600000 ms). This value is of data type int, with a default of 0.
TimeDeadband
The minimum time, in milliseconds, between stored values for a single
tag. Any value changes that occur within the time deadband are not stored.
The time deadband applies to delta storage only. A time deadband of 0
indicates that the system will store the value of the tag each time it
changes. This value is of data type int, with a default of 0.
Logged
Used to specify whether or not to log events for this tag into the
EventHistory table. Event logging can only be turned off if no associated
actions are configured. 0 = Not logged; 1 = Logged. This value is of data
type bit, with a default of 0.
Status
The flag used by the event system at system startup and during runtime to
determine if the event tag has been modified. 0 = Posted. Any changes
have been detected and effected by the system. 1 = New. An event tag has
been inserted, but is not yet executing. 2 = Modification. An event tag has
been updated, but the older one is already executing. 98 = Disabled. 99 =
Disabling requested. The event tag does not execute, even though the
definition still exists in the schema. Note that there may be a delay of up to
30 seconds before a change in an event tag is seen by the running system.
This value is of data type tinyint, with a default of 0.
PostDetectorDelay
The amount of time, in milliseconds, that must elapse after an event is
detected before the event action can be executed. This value is of data type
int, with a default of 0.

IndustrialSQL Server Historian Database Reference


Stored Procedures 117

UseThreadPool
The specify how system threads are used to process events. 1 = All events
are handled by a single thread and a single logon to the SQL Server; 0 =
Each event uses a separate system thread and logon. This will allow the
event subsystem to manage the scan rates of each detector component
concurrently. (Reserved for future use.) This value is of data type bit, with
a default of 1.
DetectorTypeKey
The unique identifier for a particular type of detector. Event tags and
detectors are linked via this key. The event system relies on the following
values, which are added during installation: 1 = System; 2 = External
event; 3 = Generic SQL; 4 = Analog specific value; 5 = Discrete specific
value; 6 = Time-based (schedule). This value is of data type int, with a
default of 0.
DetectorString
The script that contains the criteria for event detection. Detector scripts are
executed on the local IndustrialSQL Server. This value is of data type
nvarchar(1500), with a default of NULL.
ActionTypeKey
The unique identifier for a particular type of action. Event tags and actions
are linked via this key. The event subsystem relies on the following values,
which are added during installation: 1 = No action; 2 = Generic SQL; 3 =
Snapshot; 4 = E-mail; 5 = Deadband; 6 = Summary. This value is of data
type int, with a default of 0.
ActionString
The script that specifies the event action. Action scripts are executed on
the local IndustrialSQL Server. This value is of data type nvarchar(1500),
with a default of NULL.
Priority
The priority level for the action, either critical or normal. The priority
level determines the sorting queue to which the action will be sent. The
critical queue is used for highly important events. If a system overload
condition occurs, events that are given a critical priority will always be
processed first. Events that are given a normal priority will be processed
after any critical events and may possibly be dropped (that is, not
performed) on an overloaded system.This value is of data type tinyint,
with a default of 0.
Edge
The "edge" for the event detection. 0 = Trailing; 1 = Leading; 2 = Both; 3
= None; 4 = Time Detector; 5 = External Detector. This value is of data
type tinyint, with a default of 1.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaEventTagDelete
aaEventTagUpdate
aaEventTagSelect

IndustrialSQL Server Historian Database Reference


118 Chapter 4

aaEventTagSelect
Selects an event tag.
Syntax
aaEventTagSelect wwTagKey
Arguments
wwTagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with a default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaEventTagUpdate
aaEventTagInsert
aaEventTagDelete

aaEventTagSelectAll
Used by the event system to determine changes for dynamic reinitialization.
Syntax
aaEventTagSelectAll
Permission
Execute permission defaults to the public group.
See Also
aaEventTagSelectDeleted
aaEventTagSelectDisabled
aaEventTagSelectInserted
aaEventTagSelectUpdated

aaEventTagSelectDeleted
Used by the event system to determine changes for dynamic reinitialization.
Syntax
aaEventTagSelectDeleted
Permission
Execute permission defaults to the public group.
See Also
aaEventTagSelectInserted
aaEventTagSelectUpdated
aaEventTagSelectDisabled

IndustrialSQL Server Historian Database Reference


Stored Procedures 119

aaEventTagSelectDisabled
Used by the event system to determine changes for dynamic reinitialization.
Syntax
aaEventTagSelectDisabled
Permission
Execute permission defaults to the public group.
See Also
aaEventTagSelectDeleted
aaEventTagSelectUpdated
aaEventTagSelectInserted
aaEventTagSelectAll

aaEventTagSelectInserted
Used by the event system to determine changes for dynamic reinitialization.
Syntax
aaEventTagSelectInserted
Permission
Execute permission defaults to the public group.
See Also
aaEventTagSelectDeleted
aaEventTagSelectUpdated
aaEventTagSelectDisabled
aaEventTagSelectAll

aaEventTagSelectUpdated
Used by the event system to determine changes for dynamic reinitialization.
Syntax
aaEventTagSelectUpdated
Permission
Execute permission defaults to the public group.
See Also
aaEventTagSelectDeleted
aaEventTagSelectDisabled
aaEventTagSelectInserted
aaEventTagSelectAll

aaEventTagUpdate
Updates an event tag.

IndustrialSQL Server Historian Database Reference


120 Chapter 4

Syntax
aaEventTagUpdate wwTagKey, TagName, Description,
CreatedBy, DateCreated, CurrentEditor, ScanRate,
TimeDeadband, Logged, Status, PostDetectorDelay,
UseThreadPool, DetectorTypeKey, DetectorString,
ActionTypeKey, ActionString, Priority, Edge
Arguments
wwTagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with no default.
The remaining arguments are the same as for the aaEventTagInsert stored
procedure. However, wwTagKey, TagName, Description, DateCreated,
DetectorString, and ActionString do not have defaults.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaEventTagDelete
aaEventTagInsert
aaEventTagSelect

aaGetDbRevision
Used to determine the current revision number of the database.
Syntax
aaGetDbRevision
Permission
Execute permission defaults to the public group.

aaGetLastTagKey
Returns the details for the last inserted tag.
Syntax
aaGetLastTagKey TagType
Arguments
TagType
The type of tag. 1 = Analog; 2 = Discrete; 3 = String; 4 = Complex; 5 =
Event. This value is of data type int, with no default.
Permission
Execute permission defaults to the public group.

IndustrialSQL Server Historian Database Reference


Stored Procedures 121

aaHistorianConfigNSExpand
Expands the tree view under an IndustrialSQL Server historian in the
namespace. This stored procedure is used by the Configuration Editor
component of the System Management Console and should not be modified.
Syntax
aaHistorianConfigNSExpand PKey
Arguments
PKey
A local variable used to identify the IndustrialSQL Server historian in the
namespace. This value is of data type int, with no default.
Remarks
An object can have one or more objects below it in the namespace hierarchy.
Permission
Execute permission defaults to the public group.

aaHistorianNSExpand
Expands the tree view under an IndustrialSQL Server historian in the
namespace.
Syntax
aaHistorianNSExpand PKey
Arguments
PKey
A local variable used to identify the IndustrialSQL Server historian in the
namespace. This value is of data type int, with no default.
Permission
Execute permission defaults to the public group.
See Also
aaPrivateNSExpand
aaPublicNSExpand
aaSystemNSExpand

aaHistorianStatusSelect
Used to select the value of the database status flag, DbStatus.
Syntax
aaHistorianStatusSelect
Remarks
This stored procedure is used by the System Management Console to
determine the state of a database modification.

IndustrialSQL Server Historian Database Reference


122 Chapter 4

Permission
Execute permission defaults to the public group.
See Also
aaHistorianStatusSet

aaHistorianStatusSet
Sets the value of the status flag, DbStatus, to a value greater than 0 when a
database modification needs to be processed by the server (back end). Sets the
value of DbStatus back to 0 when a database modification is complete.
Syntax
aaHistorianStatusSet DbStatus, Acquisition, Storage,
DBServer
Arguments
DbStatus
For releases prior to 8.0, used to store the status of server reinitializations.
2 = Certain columns in the Tag, AnalogTag, DiscreteTag, StringTag,
Topic, and IOServer tables were changed; 3 = Reinitialization needed; 4 =
Commit phase of a database update is in progress; 0 = Reinitialization
complete. A negative value indicates that an error was encountered during
reinitialization. This value is of data type int, with no default.
Acquisition
Used with DbStatus to indicate to the back end whether the acquisition
subsystem needs to be restarted. 0 = Restart not needed; 1 = Restart
needed. Currently not used. This value is of data type int, with a default of
0.
Storage
Used with DbStatus to indicate to the back end whether the storage
subsystem needs to be restarted. 0 = Restart not needed; 1 = Restart
needed. Currently not used. This value is of data type int, with a default of
0.
DBServer
Used with DbStatus to indicate to the back end whether the database
server needs to be restarted. 0 = Restart not needed; 1 = Restart needed.
Currently not used. This value is of data type int, with a default of 0.

Note Only the first argument is required; the others are used to indicate that a
specific sub-system needs to be initialized.

Remarks
When a change is made to the Runtime database configuration using the
System Management Console, the value of the DbStatus attribute in the
StorageNode table is set to a value greater than 0, meaning that modifications
are outstanding and a reininitialization has yet to occur. The System
Management Console, after detecting that a change is outstanding based on the
value of DbStatus, makes the required changes, reinitializes the IndustrialSQL
Server historian, if necessary, and then sets the value of DbStatus back to 0,
meaning that reinitialization has been completed.

IndustrialSQL Server Historian Database Reference


Stored Procedures 123

Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaHistorianStatusSelect

aaHistoryBlockSelect
Returns the list of history blocks for the selected time period. If no arguments
are passed, the complete list is returned.
Syntax
aaHistoryBlockSelect FromDate, ToDate
Arguments
FromDate
The starting timestamp for the history block. This value is of data type
datetime, with a default of NULL.
ToDate
The ending timestamp for the history block. This value is of data type
datetime, with a default of NULL.
Permission
Execute permission defaults to the public group.

aaInTouchNodeTagList
Used by the System Management Console to display a list of imported tags for
an InTouch node.
Syntax
aaInTouchNodeTagList NodeKey, FilterStr
Arguments
NodeKey
The unique numerical identifier for the named InTouch node. This value is
of data type int, with a default of NULL.
FilterStr
Used to order the tagnames in the namespace. This value is of data type
nvarchar(100), with a default of NULL.
Remarks
This stored procedure returns the IndustrialSQL Server historian tagname, the
original InTouch tagname, and the InTouch tag type (for example, memory
integer).
Permission
Execute permission defaults to the public group.

IndustrialSQL Server Historian Database Reference


124 Chapter 4

aaIODriverDelete
Deletes an IDAS.
Syntax
aaIODriverDelete IODriverKey
Arguments
IODriverKey
The unique identifier for an IDAS. This value is of data type int, with no
default.
Permission
Execute permission defaults to the aaAdministrators and aaPowerUsers
groups.
See Also
aaIODriverSelect
aaIODriverInsert
aaIODriverUpdate

aaIODriverInsert
Inserts an IDAS.
Syntax
aaIODriverInsert StorageNodeKey, ComputerName,
StoreForwardMode, StoreForwardPath, MinMBThreshold,
AltComputerName, Enabled, StoreForwardDuration,
AutonomousStartupTimeout, BufferCount, FileChunkSize,
ForwardingDelay, ConnectionTimeout
Arguments
StorageNodeKey
The unique numerical identifier for the storage node. This value is of data
type int, with a default of 1.
ComputerName
The name of the computer on which the IDAS runs. This value is of data
type nvarchar(255), with a default of the name of the local server running
Microsoft® SQL Server.
StoreForwardMode
Used to specify whether or not store-and-forward capability is enabled. If
enabled, and the network connection between the IDAS and the storage
node fails, data will be "buffered" to the location specified by the store-
and-forward path. Valid values are: 0 = Disabled; 1 = Enabled; 2 =
Autonomous. The Autonomous mode (2) is an extension of the normal
store-and-forward mode (1). It allows the IDAS to start up using an IDAS
configuration file and collect data in store-and-forward mode if the
network connection to the IndustrialSQL Server is not available. This
value is of data type tinyint, with a default of 0.

IndustrialSQL Server Historian Database Reference


Stored Procedures 125

StoreForwardPath
Used to specify the path for the IDAS data buffer on the local hard drive of
the IDAS computer. The path should be absolute (for example,
c:\IDASBuffer). Data is written to this path until the minimum threshold
for the buffer is reached. Remote buffer paths are not supported. If a
invalid path or no path is specified, data is stored to the default path, which
is C:\Document and Settings\All Users\Application Data\ArchestrA\SF.
This value is of data type nvarchar(255), with a default of an empty string.
MinMBThreshold
The minimum amount of free disk space, in megabytes, at which IDAS
stops collecting data in the store-and-forward buffer. This value is of data
type int, with a default of 16.
AltComputerName
The name of the computer on which an optional, redundant IDAS runs.
This should be set to an empty string if no redundant IDAS is specified.
Make sure that the IDAS software is installed on the target failover
computer. If the failure of the primary IDAS is detected by the system, the
failover IDAS is automatically started. The failover IDAS is shut down
after the primary IDAS is back online. This value is of data type
nvarchar(255), with a default of an empty string.
Enabled
Used to specify whether the IDAS is enabled or not. 0 = Not enabled; 1 =
enabled. Disabling the IDAS allows for the configuration to be retained in
the database, even though the IDAS is removed from the system. This
value is of data type bit, with a default of 1.
StoreForwardDuration
The minimum duration, in seconds, for the IDAS to function in store-and-
forward mode. The IDAS functions in store-and-forward mode for this
length of time even if the condition that caused IDAS to function in store-
and-forward mode no longer exists. The maximum duration is 3600
seconds, and the minimum is 15 seconds. This value is of data type int,
with a default of 180.
AutonomousStartupTimeout
The amount of time, in seconds, that the autonomous IDAS should wait
for configuration commands when started by the Configuration service
before going to the autonomous mode. This timeout may need to be
increased only if you have a large number of IDASs configured as
autonomous on a slow network. This value is of data type int, with a
default of 60.
BufferCount
The number of 64 KB buffers pre-allocated for buffering data. This
number may need to be increased to accommodate high data rates. This
value is of data type int, with a default of 128.
FileChunkSize
The size, in bytes, of the data "chunks" that are sent to the historian when
store-and-forward data is forwarded. The size of the chunks can be
decreased to accommodate slower networks. Decrease this number only if
the forwarding delay is greater than zero. This value is of data type int,
with a default of 65536.

IndustrialSQL Server Historian Database Reference


126 Chapter 4

ForwardingDelay
The interval, in milliseconds, at which "chunks" of store-and-forward data
are forwarded to the historian. The length of the interval may need to be
increased to accommodate slower networks. This value is of data type int,
with a default of 0.
ConnectionTimeout
The amount of time, in seconds, that the Configuration service attempts to
communicate with an IDAS for configuration/reconfiguration. If this
timeout elapses, the Configuration service assumes that the IDAS
connection has been dropped. This number may need to be increased to
accommodate slower networks. This value is of data type int, with a
default of 30.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaIODriverDelete
aaIODriverSelect
aaIODriverUpdate

aaIODriverSelect
Selects an IDAS.
Syntax
aaIODriverSelect IODriverKey
Arguments
IODriverKey
The unique identifier for an IDAS. This value is of data type int, with a
default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaIODriverDelete
aaIODriverInsert
aaIODriverUpdate

aaIODriverUpdate
Updates an IDAS.
Syntax
aaIODriverUpdate IODriverKey, StorageNodeKey,
ComputerName, StoreForwardMode, StoreForwardPath,
MinMBThreshold, AltComputerName, Enabled,
StoreForwardDuration, AutonomousStartupTimeout,
BufferCount, FileChunkSize, ForwardingDelay,
ConnectionTimeout

IndustrialSQL Server Historian Database Reference


Stored Procedures 127

Arguments
IODriverKey
The unique identifier for an IDAS. This value is of data type int, with no
default.
The remaining arguments are the same as for the aaIODriverInsert stored
procedure. However, only StorageNodeKey, MinMBThreshold, Enabled,
StoreForwardDuration, AutonomousStartupTimeout, BufferCount,
FileChunkSize, ForwardingDelay, and ConnectionTimeout have defaults.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaIODriverDelete
aaIODriverSelect
aaIODriverInsert

aaIOServerDelete
Deletes an I/O Server from the system configuration.
Syntax
aaIOServerDelete IOServerKey
Arguments
IOServerKey
The unique numerical identifier for the I/O Server. This value is of data
type int, with no default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaIOServerInsert
aaIOServerUpdate
aaIOServerSelect

aaIOServerInsert
Inserts an I/O Server into the system configuration.
Syntax
aaIOServerInsert StorageNodeKey, ApplicationName,
Description, Path, ComputerName, AutoStart, ExeType,
InitializationStatus, ProtocolType, AltComputerName,
IODriverKey

IndustrialSQL Server Historian Database Reference


128 Chapter 4

Arguments
StorageNodeKey
The unique numerical identifier for the storage node. This value is of data
type int, with a default of 1.
ApplicationName
The application name of the I/O Server. This name is usually the same as
the executable file name. This value is of dataype nvarchar(32), with no
default.
Description
The description of the I/O Server. This value is of data type nvarchar(50),
with a default of NULL.
Path
The full UNC path (including the filename) to locate the executable file
for the I/O Server. If the I/O Server type key is specified, the filename may
be omitted. This value is nvarchar(255), with a default of NULL.
ComputerName
The name of the computer on which the I/O Server runs.This value is of
data type nvarchar(255), with no default.
AutoStart
Used to control how the I/O Server starts up. 0 = Automatic startup when
the system starts. 1 = Manual startup required. Currently not used. This
value is of data type bit, with a default of 0.
ExeType
The type of executable for the I/O Server. Used by the InSQL Console to
determine how to start the I/O Server. 0 = Service; 1 = Console
application; 2 = Windows application. This value is of data type int, with a
default of 0.
InitializationStatus
The control flag used to ensure that each I/O Server has been asked for the
data type (integer or real) of each tag that it will send. Only needed after a
database modification. This value is of data type tinyint, with no default.
ProtocolType
The protocol used by the IndustrialSQL Server to communicate with the
I/O Server. 1 = DDE; 2 = SuiteLink™; 3 = IndustrialSQL Server named
pipe driver (for compatibility with IndustrialSQL Server 3.0 and previous
versions). If the IndustrialSQL Server is running on the Windows Server
2003 operating system, DDE is not supported. This value is of data type
int, with a default of 1.
AltComputerName
The name of the computer on which an optional, failover I/O Server runs.
The failover I/O Server must be running in order for the switch to be
made. This value is nvarchar(255), with a default of NULL.
IODriverKey
The unique identifier for an IDAS. This value is of data type int, with a
default of 2.

IndustrialSQL Server Historian Database Reference


Stored Procedures 129

Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaIOServerUpdate
aaIOServerSelect
aaIOServerDelete

aaIOServerSelect
Selects an I/O Server from the system configuration.
Syntax
aaIOServerSelect IOServerKey
Arguments
IOServerKey
The unique numerical identifier for the I/O Server. This value is of data
type int, with a default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaIOServerInsert
aaIOServerUpdate
aaIOServerDelete

aaIOServerTypeDelete
Deletes an I/O Server type from the system configuration.
Syntax
aaIOServerTypeDelete ApplicationName
Arguments
ApplicationName
The application name of the I/O Server. This name is usually the same as
the executable file name. This value is of dataype nvarchar(32), with no
default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaIOServerTypeInsert
aaIOServerTypeUpdate
aaIOServerTypeSelect

IndustrialSQL Server Historian Database Reference


130 Chapter 4

aaIOServerTypeInsert
Inserts an I/O Server type into the system configuration.
Syntax
aaIOServerTypeInsert ApplicationName, Description,
ExeName, Revision, Platform
Arguments
ApplicationName
The application name of the I/O Server. This name is usually the same as
the executable file name. This value is of dataype nvarchar(32), with no
default.
Description
The description of the I/O Server type. This value is of data type
nvarchar(50), with a default of NULL.
ExeName
The name of the I/O Server's executable file. This value is nvarchar(255),
with a default of NULL.
Revision
The revision number for the I/O Server. This value is of data type
nchar(20), with a default of NULL.
Platform
The operating system required by the I/O Server. Valid operating systems
are: WINDOWS NT, WINDOWS 95, WINDOWS 98, WINDOWS XP,
WINDOWS 2000, WINDOWS 2003. This value is of data type nchar(20),
with a default of NULL.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaIOServerTypeUpdate
aaIOServerTypeSelect
aaIOServerTypeDelete

aaIOServerTypeSelect
Selects an I/O Server type from the system configuration.
Syntax
aaIOServerTypeSelect ApplicationName
Arguments
ApplicationName
The application name of the I/O Server. This name is usually the same as
the executable file name. This value is of data type nvarchar(32), with a
default of NULL.

IndustrialSQL Server Historian Database Reference


Stored Procedures 131

Permission
Execute permission defaults to the public group.
See Also
aaIOServerTypeInsert
aaIOServerTypeUpdate
aaIOServerTypeDelete

aaIOServerTypeUpdate
Updates an I/O Server type in the system configuration.
Syntax
aaIOServerTypeUpdate ApplicationName, Description,
ExeName, Revision, Platform
Arguments
All arguments are the same as for the aaIOServerTypeInsert stored
procedure. However, none of the arguments have defaults.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaIOServerTypeInsert
aaIOServerTypeSelect
aaIOServerTypeDelete

aaIOServerUpdate
Updates an I/O Server in the system configuration.
Syntax
aaIOServerUpdate IOServerKey, StorageNodeKey, IODriverKey,
ApplicationName, Description, Path, ComputerName,
AutoStart, ExeType, InitializationStatus, ProtocolType,
AltComputerName
Arguments
IOServerKey
The unique numerical identifier for the I/O Server. This value is of data
type int, with no default.
The remaining arguments are the same as for the aaIOServerInsert stored
procedure. However, only the AltComputerName argument has a default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.

IndustrialSQL Server Historian Database Reference


132 Chapter 4

See Also
aaIOServerInsert
aaIOServerSelect
aaIOServerDelete

aaLimitDelete
Deletes a limit.
Syntax
aaLimitDelete TagName, ContextKey, LimitNameKey
Arguments
All arguments are the same as for the aaLimitInsert stored procedure.
However, none of the arguments have defaults.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaLimitInsert
aaLimitUpdate
aaLimitSelect

aaLimitInsert
Inserts a limit.
Syntax
aaLimitInsert TagName, ContextKey, LimitType, Value,
LimitNameKey, Priority, Checked, Description
Arguments
TagName
The unique name of the tag within the IndustrialSQL Server system.This
value is of data type nvarchar(256), with no default.
ContextKey
The unique numerical identifier for the context. This value is of data type
int, with a default of 1.
LimitType
The type of limit; that is, whether it is a rising (up) or falling (down) limit.
0 = Rising; 1 = Falling. This value is of data type int, with a default of 1.
Value
The value that is used as a specific limit for a tag. In theory, a tag can have
an infinite number of limits defined. This value is of data type real, with
no default.
LimitNameKey
The unique numerical identifier associated with the limit name. This value
is of data type int, with no default.

IndustrialSQL Server Historian Database Reference


Stored Procedures 133

Priority
The priority for the limit. Priorities can range from 1 to over 2 billion, with
1 being the highest priority. This value is of data type int, with a default of
1.
Checked
Used to specify whether a tag imported from InTouch is configured for
automatic limit checking. Only checked limits are imported. 0 = Checking
disabled; 1 = Checking enabled. This value is of data type bit, with a
default of 1.
Description
The description of the limit. This value is of data type nvarchar(50), with a
default of NULL.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaLimitUpdate
aaLimitSelect
aaLimitDelete

aaLimitNameDelete
Deletes a limit name.
Syntax
aaLimitNameDelete LimitNameKey
Arguments
LimitNameKey
The unique numerical identifier associated with the limit name. This value
is of data type int, with no default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaLimitNameInsert
aaLimitNameUpdate
aaLimitNameSelect

aaLimitNameInsert
Inserts a limit name.
Syntax
aaLimitNameInsert Name

IndustrialSQL Server Historian Database Reference


134 Chapter 4

Arguments
Name
The name for the limit. This value is of data type nvarchar(20), with a
default of an empty string.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaLimitNameUpdate
aaLimitNameSelect
aaLimitNameDelete

aaLimitNameSelect
Selects a limit name.
Syntax
aaLimitNameSelect LimitNameKey
Arguments
LimitNameKey
The unique numerical identifier associated with the limit name. This value
is of data type int, with a default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaLimitNameInsert
aaLimitNameUpdate
aaLimitNameDelete

aaLimitNameUpdate
Updates a limit name.
Syntax
aaLimitNameUpdate LimitNameKey, Name
Arguments
LimitNameKey
The unique numerical identifier associated with the limit name. This value
is of data type int, with no default.
Name
The name for the limit. This value is of data type nvarchar(20), with no
default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.

IndustrialSQL Server Historian Database Reference


Stored Procedures 135

See Also
aaLimitNameInsert
aaLimitNameSelect
aaLimitNameDelete

aaLimitSelect
Selects a limit.
Syntax
aaLimitSelect TagName
Arguments
TagName
The unique name of the tag within the IndustrialSQL Server system. The
limit will be selected for the specified tag. This value is of data type
nvarchar(256), with a default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaLimitInsert
aaLimitUpdate
aaLimitDelete

aaLimitUpdate
Updates a limit.
Syntax
aaLimitUpdate TagName, ContextKey, LimitType, Value,
LimitNameKey, Priority, Checked, Description
Arguments
All arguments are the same as for the aaLimitInsert stored procedure.
However, only the Description argument has a default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaLimitInsert
aaLimitSelect
aaLimitDelete

aaMessageDelete
Deletes a message for a discrete tag.

IndustrialSQL Server Historian Database Reference


136 Chapter 4

Syntax
aaMessageDelete MessageKey
Arguments
MessageKey
The unique numerical identifier for a TRUE/FALSE message pair that can
be associated with a discrete tag. This value is of data type int, with no
default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaMessageUpdate
aaMessageInsert
aaMessageSelect

aaMessageInsert
Inserts a message for a discrete tag.
Syntax
aaMessageInsert Message0, Message1
Arguments
Message0
The message associated with the FALSE state of the discrete tag. The
maximum number of characters is 64. A discrete tag set to 0 is in the
FALSE state. This value is of data type nvarchar(64), with a default of
NULL.
Message1
The message associated with the TRUE state of the discrete tag. The
maximum number of characters is 64. A discrete tag set to 1 is in the
TRUE state. This value is of data type nvarchar(64), with a default of
NULL.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaMessageSelect
aaMessageUpdate
aaMessageDelete

aaMessageSelect
Selects a message for a discrete tag.
Syntax
aaMessageSelect MessageKey

IndustrialSQL Server Historian Database Reference


Stored Procedures 137

Arguments
MessageKey
The unique numerical identifier for a TRUE/FALSE message pair that can
be associated with a discrete tag. This value is of data type int, with a
default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaMessageUpdate
aaMessageInsert
aaMessageDelete

aaMessageUpdate
Updates a message for a discrete tag.
Syntax
aaMessageUpdate MessageKey, Message0, Message1
Arguments
MessageKey
The unique numerical identifier for a TRUE/FALSE message pair that can
be associated with a discrete tag. This value is of data type int, with no
default.
The remaining arguments are the same as for the aaMessageInsert stored
procedure. However, none of the arguments have defaults.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaMessageSelect
aaMessageInsert
aaMessageDelete

aaModLogStatus
Used to retrieve the status of modification tracking.
Syntax
aaModLogStatus
Remarks
This stored procedure is used by the System Management Console.
Modification tracking is controlled by the value of the ModLogTrackingStatus
system parameter, which is stored in the Value column of the SystemParameter
table. If the value of this column is set to a value from 1 to 7, then modification
tracking is on (0 = off).

IndustrialSQL Server Historian Database Reference


138 Chapter 4

Permission
Execute permission defaults to the public group.

aaPrivateNSAddGroup
Adds a group object in the private namespace under the specified parent object
in the namespace hierarchy.
Syntax
aaPrivateNSAddGroup Name, ParentKey, Type
Arguments
Name
The name of this object in the hierarchy. This value is of data type
nvarchar(255), with no default.
ParentKey
The unique identifier for a named object in this namespace. This value is
of data type int, with no default.
Type
The value that specifies the type of namespace. 1 to 6 = Tag; 1 to 2 million
= System; 2+ million = Groups. This value is of data type int, with a
default of 1000000.
Permission
Execute permission defaults to the public group.
See Also
aaPrivateNSDeleteGroup
aaPrivateNSUpdateGroup

aaPrivateNSAddLeaf
Adds a single object in the private namespace under the currently selected
object in the namespace hierarchy.
Syntax
aaPrivateNSAddLeaf wwTagKey, NameKey, ServerKey
Arguments
wwTagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with no default.
NameKey
The unique identifier for the object in the namespace. This value is of data
type int, with no default.
ServerKey
The unique numerical identifier for the IndustrialSQL Server. This value is
of data type int, with a default of 1.

IndustrialSQL Server Historian Database Reference


Stored Procedures 139

Permission
Execute permission defaults to the public group.
See Also
aaPrivateNSDeleteLeaf

aaPrivateNSDeleteGroup
Deletes a group object, as well as any objects under it, in the private
namespace.
Syntax
aaPrivateNSDeleteGroup NameKey
Arguments
NameKey
The unique identifier for the object in the namespace. This value is of data
type int, with no default.
Permission
Execute permission defaults to the public group.
See Also
aaPrivateNSAddGroup
aaPrivateNSUpdateGroup

aaPrivateNSDeleteLeaf
Deletes a single object in the private namespace.
Syntax
aaPrivateNSDeleteLeaf NameKey, wwTagKey
Arguments
NameKey
The unique identifier for the object in the namespace. This value is of data
type int, with no default.
wwTagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with no default.
Permission
Execute permission defaults to the public group.
See Also
aaPrivateNSAddLeaf

aaPrivateNSExpand
Expands the tree view one level under a single parent object in the private
namespace.

IndustrialSQL Server Historian Database Reference


140 Chapter 4

Syntax
aaPrivateNSExpand PKey, FilterStr
Arguments
PKey
A local variable used to identify the object in the namespace. This value is
of data type int, with no default.
FilterStr
Used to order the tagnames in the namespace. This value is of data type
nvarchar(100), with a default of NULL.
Remarks
A parent object can have one or more objects below it in the namespace
hierarchy.
Permission
Execute permission defaults to the public group.
See Also
aaPrivateNSSelect

aaPrivateNSSelect
Selects all valid group objects (items) for the current user in the private
namespace.
Syntax
aaPrivateNSSelect
Permission
Execute permission defaults to the public group.
See Also
aaPublicNSExpand

aaPrivateNSUpdateGroup
Updates a group object in the private namespace.
Syntax
aaPrivateNSUpdateGroup NameKey, Name, Type
Arguments
NameKey
The unique identifier for the object in the namespace. This value is of data
type int, with no default.
Name
The name of this object in the hierarchy. This value is of data type
nvarchar(255), with no default.

IndustrialSQL Server Historian Database Reference


Stored Procedures 141

Type
The value that specifies the type of namespace. 1 to 6 = Tag; 1 to 2 million
= System; 2+ million = Groups. This value is of data type int, with no
default.
Permission
Execute permission defaults to the public group.
See Also
aaPrivateNSDeleteGroup
aaPrivateNSAddGroup

aaPublicNSAddGroup
Adds a group object in the public namespace under the specified parent object
in the namespace hierarchy.
Syntax
aaPublicNSAddGroup Name, ParentKey, Type
Arguments
Name
The name of this object in the hierarchy. This value is of data type
nvarchar(255), with no default.
ParentKey
The unique identifier for a named object in this namespace. This value is
of data type int, with no default.
Type
The value that specifies the type of namespace. 1 to 6 = Tag; 1 to 2 million
= System; 2+ million = Groups. Within the system range, the following
values designate ArchestrA object types: 1999023 = Galaxy; 1999001 =
WinPlatform object; 1999003 = AppEngine object; 1999013 = Area
object; 1999011 = DDESuiteLinkClient, OPCClient, and InTouchProxy
objects; 1999024 = RedundantDIObject object; 1999033 = Undeployed
object represented by a generic name; 1999901 = ApplicationObject;
1999902 = Traceability object. This value is of data type int, with a default
of 1000000.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaPublicNSDeleteGroup
aaPublicNSUpdateGroup

aaPublicNSAddLeaf
Adds a single object in the public namespace under the currently selected
object in the namespace hierarchy.

IndustrialSQL Server Historian Database Reference


142 Chapter 4

Syntax
aaPublicNSAddLeaf wwTagKey, NameKey, ServerKey
Arguments
wwTagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with no default.
NameKey
The unique identifier for the object in the namespace. This value is of data
type int, with no default.
ServerKey
The unique numerical identifier for the IndustrialSQL Server. This value is
of data type int, with a default of 1.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaPublicNSDeleteLeaf

aaPublicNSDeleteGroup
Deletes a group object, as well as any objects under it, in the public namespace.
Syntax
aaPublicNSDeleteGroup NameKey
Arguments
NameKey
The unique identifier for the object in the namespace. This value is of data
type int, with no default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaPublicNSAddGroup
aaPrivateNSUpdateGroup

aaPublicNSDeleteLeaf
Deletes a single object in the public namespace.
Syntax
aaPublicNSDeleteLeaf NameKey, wwTagKey
Arguments
NameKey
The unique identifier for the object in the namespace. This value is of data
type int, with no default.

IndustrialSQL Server Historian Database Reference


Stored Procedures 143

wwTagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with no default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaPublicNSAddLeaf

aaPublicNSExpand
Expands the tree view one level under a single parent object in the public
namespace.
Syntax
aaPublicNSExpand PKey, FilterStr
Arguments
PKey
A local variable used to identify the object in the namespace. This value is
of data type int, with no default.
FilterStr
Used to order the tagnames in the namespace. This value is of data type
nvarchar(100), with a default of NULL.
Remarks
A parent object can have one or more objects below it in the namespace
hierarchy.
Permission
Execute permission defaults to the public group.
See Also
aaPublicNSSelect

aaPublicNSSelect
Selects all valid group objects (items) in the public namespace.
Syntax
aaPublicNSSelect
Permission
Execute permission defaults to the public group.
See Also
aaPublicNSExpand

aaPublicNSUpdateGroup
Updates a group object in the public namespace.

IndustrialSQL Server Historian Database Reference


144 Chapter 4

Syntax
aaPublicNSUpdateGroup NameKey, Name, Type
Arguments
NameKey
The unique identifier for the object in the namespace. This value is of data
type int, with no default.
Name
The name of this object in the hierarchy. This value is of data type
nvarchar(255), with no default.
Type
The value that specifies the type of namespace. 1 to 6 = Tag; 1 to 2 million
= System; 2+ million = Groups. Within the system range, the following
values designate ArchestrA object types: 1999023 = Galaxy; 1999001 =
WinPlatform object; 1999003 = AppEngine object; 1999013 = Area
object; 1999011 = DDESuiteLinkClient, OPCClient, and InTouchProxy
objects; 1999024 = RedundantDIObject object; 1999033 = Undeployed
object represented by a generic name; 1999901 = ApplicationObject;
1999902 = Traceability object. This value is of data type int, with no
default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaPublicNSDeleteGroup
aaPublicNSAddGroup

aaRedirectToInTouch
Redirects the tag address (item name) to the InTouch node, rather than to the
original I/O Server.
Syntax
aaRedirectToInTouch IOServerKey, InTouchNodeKey
Arguments
IOServerKey
The unique numerical identifier for the I/O Server. This value is of data
type int, with no default.
InTouchNodeKey
The unique numerical identifier for the named InTouch node. This value is
of data type int, with no default.
Remarks
When you redirect to InTouch HMI software, all tag values will come from the
HMI, not directly from the I/O Server. If you redirect an I/O Server, all topics
and tags for that particular I/O Server are affected.

IndustrialSQL Server Historian Database Reference


Stored Procedures 145

Permission
Execute permission defaults to the aaAdministrators group.

aaSetAISamples
Sets the number of samples that the active image can hold for a specified tag.
This stored procedure is used by the IndustrialSQL Server historian and should
not be executed by users.
Syntax
aaSetAISamples TagName, Samples
Arguments
TagName
The unique name of the tag within the IndustrialSQL Server system.This
value is of data type nvarchar(256), with no default.
Samples
The number of samples that the active image holds for the tag. 0 indicates
that the active image is using the default of 65 values. The higher the
number of samples, the higher the load on memory resources. This value
is of data type int, with no default.
Remarks
The system initially sets the number of samples for each tag to 65. The number
of samples for a tag is stored in the SampleInActiveImage column of the Tag
table.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaSetCalculatedAISamples
aaUpdateCalculatedAISamples

aaSetCalculatedAISamples
Updates the value of the SamplesInActiveImage column of the Tag table with
the current value of the CalculatedAISamples column.
Syntax
aaSetCalculatedAISamples
Remarks
This stored procedure executes at system startup. Also, this stored procedure
only executes if the AIAutoResize system parameter is set to 1.
Permission
Execute permission defaults to the aaAdministrators group.

IndustrialSQL Server Historian Database Reference


146 Chapter 4

See Also
aaSetAISamples
aaUpdateCalculatedAISamples

aaSetServerTimeStamp
Specifies whether or not incoming data values will be timestamped using the
time of the local IndustrialSQL Server historian.
Syntax
aaSetServerTimeStamp TopicName, ServerTimeStamp
Arguments
TopicName
The name of the topic. This value is of data type nvarchar(80), with no
default.
ServerTimeStamp
Used to specify whether local timestamping by the IndustrialSQL Server
is used. 0 = The IDAS timestamp is used; 1 = The IndustrialSQL Server
time is used for the timestamp. If a fast-changing tag is configured to use
server timestamping, the packet of data that is sent to the storage
subsystem may contain multiple data values with the same timestamp,
which may affect data calculations, such as for swinging door storage.
This value is of data type bit, with a default of 0.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.

aaSetStorageRule
Sets storage rules at various levels of the tag definition.
Syntax
aaSetStorageRule Type, Key, StorageType, StorageRate,
TimeDB, ValueDB, AcqType, DBType, RateDB,
ServerTimeStamp, LateData, IdleDuration, ProcInterval
Arguments
Type
The level at which the new storage rule will be set for the tag definition. 1
= I/O Server; 2 = Topic. This value is of data type tinyint, with no default.
Key
The database key value for the relevant type, either the I/O Server key or
the topic key. This value is of data type int, with no default.
StorageType
The type of storage defined for the tag. 0 = Not stored; 1 = Cyclic; 2 =
Delta; 3 = Forced storage; 17 = The storage type has been changed from
cyclic to "not stored." 18 = The storage type has been changed from delta
to "not stored." 19 = The storage type has been changed from "forced" to
"not stored." This value is of data type tinyint, with no default.

IndustrialSQL Server Historian Database Reference


Stored Procedures 147

StorageRate
The rate at which the tag is stored if the storage type is cyclic. The rate is
in seconds. This value is of data type int, with a default of 0.
TimeDB
The minimum time, in milliseconds, between stored values for a single
tag. Any value changes that occur within the time deadband are not stored.
The time deadband applies to delta storage only. A time deadband of 0
indicates that the system will store the value of the tag each time it
changes. This value is of data type int, with a default of -1.
ValueDB
The percentage of the difference between the minimum and maximum
engineering units for the tag. Any data values that change less than the
specified deadband are not stored. The value deadband applies to delta
storage only. A value of 0 indicates that a value deadband will not be
applied. This value is of data type float, with a default of -1.
AcqType
Used to turn acquisition on or off. 0 = Acquisition off; 1 = Acquisition on.
This value is of data type smallint, with a default of -1.
DBType
The type of delta storage deadband to be applied for the tag. This setting is
only in effect if delta storage is configured for the tag. 1= Time and/or
value deadband; 2 = Rate (swinging door) deadband. This value is of data
type smallint, with a default of -1.
RateDB
Used to percentage of deviation in the full-scale value range for an analog
tag. The swinging door (rate) deadband applies to delta storage only. Time
and/or value deadbands can be used in addition to the swinging door
deadband. Any value greater than 0 can be used for the deadband. A value
of 0 indicates that a swinging door deadband will not be applied. This
value is of data type float, with a default of -1.
ServerTimeStamp
Used to specify whether local timestamping by the IndustrialSQL Server
is used. 0 = The IDAS timestamp is used; 1 = The IndustrialSQL Server
time is used for the timestamp. If a fast-changing tag is configured to use
server timestamping, the packet of data that is sent to the storage
subsystem may contain multiple data values with the same timestamp,
which may affect data calculations, such as for swinging door storage.
This value is of data type smallint, with a default of -1.
LateData
Used to enable acquisition of "late" data. 0 = Late data disabled; 1 = Late
data enabled. This value is of data type smallint, with a default of -1.
IdleDuration
The amount of time, in seconds, before data is processed from the I/O
Server. For example, if you set this value to 60 seconds, data from this I/O
Server is cached and only processed by the storage engine after no more
data has been received from the I/O Server for at least 60 seconds. This
value is of data type int, with a default of 60.

IndustrialSQL Server Historian Database Reference


148 Chapter 4

ProcInterval
The amount of time, in seconds, after which late data from the I/O Server
is processed, regardless of the idle duration. If the nature of the data is
such that the idle duration is never satisfied, the historian storage engine
processes data from the topic at least one time every processing interval.
The processing interval defaults to twice the idle duration and cannot be
set to a value less than the idle duration. This value is of data type int, with
a default of 120.
Remarks
To ignore an argument, set the value to -1.
Permission
Execute permission defaults to the aaAdministrators and aaPowerUsers
groups.
See Also
aaSetTagStorage

aaSetTagStorage
Sets storage on or off from various level of the tag definition.
Syntax
aaSetTagStorage Type, List, Set
Arguments
Type
The level at which the new storage rule will be set for the tag definition. 1
= I/O Server; 2 = Topic. This value is of data type tinyint, with no default.
List
If the type is an I/O Server, topic or public group, the IDENTITY key(s) of
the relevant type. If the type is a tag, a list of tagnames separated by
commas. This value is of data type nvarchar(4000), with no default.
Set
Used to set storage on or off. Valid values are ON, OFF. This value is of
dataype varchar(3), with no default.
Remarks
This stored procedure applies to analog, discrete, string and complex tag types.
Permissions
Execute permission defaults to the aaAdministrators and aaPowerUsers
groups.
Examples
The following example turns data storage off for all tags associated with I/O
Servers that are identified by the IOServerKeys 2 and 3.
aaSetTagStorage 1, '2,3', 'OFF'
The following example turns data storage on for the listed tags.
aaSetTagStorage 3, 'Tag1, Tag2, Tag3', 'ON'

IndustrialSQL Server Historian Database Reference


Stored Procedures 149

See Also
aaSetStorageRule

aaSnapshotDetailSelect
Returns snapshot information from the columns of the SnapshotDetail table,
based on the storage size.
Syntax
aaSnapshotDetailSelect StorageSize
Arguments
StorageSize
The storage size, in bytes, of the tag value: -1 = Blob; 0 = Variable length
string; 1 = 1 byte; 2 = 2 byte; 4 = 4 byte; 8 = 8 byte. This value is of data
type int, with a default of NULL.
Remarks
If you do not pass an argument for the storage size, information for all storage
sizes in the table will be returned.
Permission
Execute permission defaults to the public group.
See Also
aaSnapshotDetailUpdate

aaSnapshotDetailUpdate
Updates the SnapshotDetail table.
Syntax
aaSnapshotDetailUpdate StorageSize, SnapshotSize,
ImageTime, ThresholdTime
Arguments
StorageSize
The storage size, in bytes, of the tag value: -1 = Blob; 0 = Variable length
string; 1 = 1 byte; 2 = 2 byte; 4 = 4 byte; 8 = 8 byte. This value is of data
type int, with no default.
SnapshotSize
The maximum size of the snapshot, in bytes. If this limit is reached, a new
snapshot is created. This value is of data type int, with no default.
ImageTime
The interval, in seconds, between updates to the snapshot file. The
snapshot file is updated with tag value information from the snapshot
buffer, which resides in memory. This value is of data type int, with no
default.

IndustrialSQL Server Historian Database Reference


150 Chapter 4

ThresholdTime
The maximum amount of time, in seconds, that can elapse before a new
snapshot is automatically created, provided that the value for the snapshot
size has not been reached. This value is of data type int, with no default.
Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaSnapshotDetailSelect

aaSnapToSummary
Used by the event system when configuring summary operations.
Syntax
aaSnapToSummary OpKey, Start, End, DateStamp
Arguments
OpKey
An internal variable that identifies the summary operation to perform. This
value is of data type int, with no default.
Start
The starting timestamp for the calculation. This value is of data type
datetime, with no default.
End
The ending timestamp for the calculation. This value is of data type
datetime, with no default.
DateStamp
The time the summary operation was performed. This value is of data type
smalldatetime, with no default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.

aaSpaceManager
Used by the system to manage the amount of disk space used to store historical
data for summaries and events.
Syntax
aaSpaceManager
Remarks
This stored procedure is automatically run by the system every ten minutes.
This stored procedure executes the aaDeleteOlderEvents and
aaDelectOlderSummaries stored procedures to clear out old historical data.
The duration for which event and summary history is kept is based on system
parameters stored in the SystemParameter table.

IndustrialSQL Server Historian Database Reference


Stored Procedures 151

Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaDeleteOlderEvents
aaDeleteOlderSummaries

aaStorageLocationSelect
Selects a storage location.
Syntax
aaStorageLocationSelect StorageType, StorageNodeKey
Arguments
StorageType
The type of storage used for the specified location. 1 = Circular; 2 =
Alternate; 3 = Buffer; 4 = Permanent. There can only be one storage
location of each type. This value is of data type int, with a default of
NULL.
StorageNodeKey
The unique numerical identifier for the storage node. This value is of data
type int, with a default of 1.
Permission
Execute permission defaults to the public group.
See Also
aaStorageLocationUpdate

aaStorageLocationUpdate
Updates the storage location.
Syntax
aaStorageLocationUpdate StorageType, StorageNodeKey,
SortOrder, Path, MaxMBSize, MinMBThreshold
Arguments
StorageType
The type of storage used for the specified location. 1 = Circular; 2 =
Alternate; 3 = Buffer; 4 = Permanent. There can only be one storage
location of each type. This value is of data type int, with no default.
StorageNodeKey
The unique numerical identifier for the storage node. This value is of data
type int, with no default.
SortOrder
Applies only to the alternate area. If more than one location is defined, the
sort order determines the order in which the alternate areas are used.
Reserved for future use. This value is of data type int, with no default.

IndustrialSQL Server Historian Database Reference


152 Chapter 4

Path
The path to the storage location. The circular storage location must be a
local drive on the server machine, and the path must be specified using
normal drive letter notation (for example, c:\InSQL\Data\Circular). The
alternate, buffer, and permanent storage locations can be anywhere on the
network, provided that the ArchestrA service user has full access to those
network locations. For the Windows 2000 operating system, remote
storage locations can be specified either as mapped drives or by using
UNC notation. For the Windows Server 2003 operating system, the
locations must be specified using UNC notation.This value is of data type
nvarchar(255), with no default.
MaxMBSize
The limit, in megabytes, for the amount of data to be stored to the
specified location. The maximum size applies to circular and alternate
storage only. If the maximum size is set to 0, all available space at the
storage location is used. This value is of data type int, with no default.
MinMBThreshold
The minimum amount of disk space, in megabytes, at which the system
attempts to start freeing up space. The threshold applies to circular and
alternate storage only. Typically, you should multiply the size of the
average history block (before any compression) by 1.5 to determine the
minimum threshold. This value is of data type int, with no default.
MaxAgeThreshold
The age, in days, of data that will be deleted by system to free up disk
space. The threshold applies to circular and alternate storage only. The
minimum age is 2 days. A value of 0 indicates that no age threshold is
applied. This value is of data type int, with a default of 0.
Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaStorageLocationSelect

aaStringTagDelete
Deletes a string tag.
Syntax
aaStringTagDelete wwTagKey
Arguments
wwTagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with a default of NULL.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.

IndustrialSQL Server Historian Database Reference


Stored Procedures 153

See Also
aaStringTagSelect
aaStringTagUpdate
aaStringTagInsert

aaStringTagInsert
Inserts a string tag.
Syntax
aaStringTagInsert TagName, Description, AcquisitionType,
StorageType, StorageRate, ItemName, TimeDeadband,
CreatedBy, DateCreated, MaxLength, InitialValue,
TopicKey, IOServerKey, CurrentEditor, DoubleByte,
SamplesInActiveImage, ServerTimeStamp, DeadbandType
Arguments
TagName
The unique name of the tag within the IndustrialSQL Server system.This
value is of data type nvarchar(256), with no default.
Description
The description of the tag. This value is of data type nvarchar(512), with a
default of an empty string.
AcquisitionType
The method by which the tag's value is acquired. If the tag value is
acquired from an I/O Server, specify the name of the I/O Server, topic, and
item. 0 = Not acquired; 1 = Acquired via an I/O Server; 2 = Acquired via
MDAS or a manual update; 3 = System driver. This value is of data type
tinyint, with a default of 1.
StorageType
The type of storage defined for the tag. 0 = Not stored; 1 = Cyclic; 2 =
Delta; 3 = Forced storage; 17 = The storage type has been changed from
cyclic to "not stored." 18 = The storage type has been changed from delta
to "not stored." 19 = The storage type has been changed from "forced" to
"not stored." This value is of data type smallint, with a default of 2.
StorageRate
The rate at which the tag is stored if the storage type is cyclic. The rate is
in milliseconds. This value is of data type int, with a default of 1000.
ItemName
The address string of the tag. This value is of data type nvarchar(256),
with a default of an empty string.
TimeDeadband
The minimum time, in milliseconds, between stored values for a single
tag. Any value changes that occur within the time deadband are not stored.
The time deadband applies to delta storage only. A time deadband of 0
indicates that the system will store the value of the tag each time it
changes. This value is of data type int, with a default of 0.

IndustrialSQL Server Historian Database Reference


154 Chapter 4

CreatedBy
The name of the user or application that created the tag. This value is of
data type nvarchar(256), with a default of an empty string.
DateCreated
The date that the tag was created. This value is of data type datetime, with
a default of NULL.
MaxLength
The maximum number of characters for the string. This value is of data
type smallint, with a default of 131. Valid values are: 8, 16, 24, 32, 48, 64,
128, 131, 256, 512.
InitialValue
The initial value as imported from an external source (for example, from
InTouch). This value is of data type nvarchar(512), with a default of an
empty string.
TopicKey
The unique numerical identifier for the topic. This value is of data type int,
with a default of NULL.
IOServerKey
The unique numerical identifier for the I/O Server. This value is of data
type int, with a default of NULL.
CurrentEditor
Used to specify which application or editing environment controls the tag
definition. Tags imported from the InTouch HMI software use InTouch as
the current editor. If modifications are made to an imported tag in the
historian Configuration Editor, then the current editor for the tag is
changed to InSQL. If a re-import is performed, any modifications made
using the Configuration Editor are preserved. You can manually maintain
InTouch as the current editor for re-importing; however, all changes made
to the tag using the Configuration Editor are lost during the re-import.
Tags (attributes) that are initially configured using Industrial Application
Server (IAS) use IAS as the current editor. If you modify an IAS tag using
the historian Configuration Editor, then the current editor for the tag is
changed to InSQL. However, the next time you redeploy the engine, the
changes are not preserved. 0 = IndustrialSQL Server; 1 = InTouch; 2 =
Application other than IndustrialSQL Server or InTouch. This value is of
data type int, with a default of 0.
DoubleByte
Used to specify whether or not to store the string as a double-byte string. 0
= Not stored as double-byte; 1 = Stored as double-byte. This value is of
data type tinyint, with a default of 0.
SamplesInActiveImage
The number of samples that the active image holds for the tag. 0 indicates
that the active image is using the default of 65 values. The higher the
number of samples, the higher the load on memory resources. This value
is of data type int, with a default of 0.

IndustrialSQL Server Historian Database Reference


Stored Procedures 155

ServerTimeStamp
Used to specify whether local timestamping by the IndustrialSQL Server
is used. 0 = The IDAS timestamp is used; 1 = The IndustrialSQL Server
time is used for the timestamp. If a fast-changing tag is configured to use
server timestamping, the packet of data that is sent to the storage
subsystem may contain multiple data values with the same timestamp,
which may affect data calculations, such as for swinging door storage.
This value is of data type bit, with a default of 0.
DeadbandType
The type of delta storage deadband to be applied for the tag. This setting is
only in effect if delta storage is configured for the tag. 1= Time and/or
value deadband; 2 = Rate (swinging door) deadband. This value is of data
type smallint, with a default of 1.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaStringTagDelete
aaStringTagSelect
aaStringTagUpdate

aaStringTagSelect
Selects a string tag.
Syntax
aaStringTagSelect wwTagKey
Arguments
wwTagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with a default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaStringTagDelete
aaStringTagUpdate
aaStringTagInsert

aaStringTagUpdate
Updates a string tag.
Syntax
aaStringTagUpdate wwTagKey, TagName, Description,
AcquisitionType, StorageType, StorageRate, ItemName,
TimeDeadband, CreatedBy, DateCreated, MaxLength,
InitialValue, TopicKey, IOServerKey, CurrentEditor,

IndustrialSQL Server Historian Database Reference


156 Chapter 4

DoubleByte, SamplesInActiveImage, ServerTimeStamp,


DeadbandType
Arguments
wwTagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with no default.
The remaining arguments are the same as for the aaStringTagInsert stored
procedure. However, only AcquisitionType, StorageType, CreatedBy,
DateCreated, MaxLength, DoubleByte, SamplesInActiveImage,
ServerTimeStamp, and DeadbandType have defaults.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaStringTagDelete
aaStringTagSelect
aaStringTagInsert

aaSummaryActionInsert
Used by the event subsystem to perform a summary operation for the specified
tag.
Syntax
aaSummaryActionInsert EventTagName, SumDateTime
Arguments
EventTagName
The name of the event tag with which the summary operation is
associated. This value is of data type nvarchar(256), with no default.
SumDateTime
The timestamp to use when storing the result of the calculation. This can
either be the time of when the calculation period starts or the time when it
ends. This value is of data type datetime, with no default.
Permission
Execute permission defaults to the aaAdministrators group.

aaSummaryDetail
Returns summary details for one or more tags that are associated with a
particular summary operation. The type of aggregation for the tag can
optionally be included for each tag that you list.
The starting and ending times are used to specify the time at which the
calculation started/ended for the operation.
Syntax
aaSummaryDetail TagList, StartTime, EndTime, OrderBy

IndustrialSQL Server Historian Database Reference


Stored Procedures 157

Arguments
TagList
A list of tags delimited by a comma (,). This value is of data type
nvarchar(4000), with no default.
StartTime
The starting timestamp for the calculation. This value is of data type
nvarchar(50), with no default.
EndTime
The ending timestamp for the calculation.This value is of data type
nvarchar(50), with no default.
OrderBy
The column by which the results will be ordered. By default, the TagName
column is used. This value is of data type nvarchar(500).
Permission
Execute permission defaults to the public group.
Examples
This example returns the average and miniumum values for 'ReactTemp' and
the maximum value for 'ReactLevel' between 12:12 p.m. and 2:14 p.m. on May
12, 2001. The returned rows are ordered by the date of the summary.
aaSummaryDetail "ReactTemp('AVG','MIN'),
ReactLevel('MAX')", "2001-05-12 12:12:00.000", "2001-
05-12 12:14:00.000", "SummaryDate"
This example returns all aggregate values for 'ReactTemp' and 'ReactLevel'
between 12:12 p.m. and 2:14 p.m. on May 12, 2001.
aaSummaryDetail "ReactTemp, ReactLevel", "2001-05-12
12:12:00.000", "2001-05-12 12:14:00.000"
See Also
aaDetectorStringSelect

aaSummaryOperationDelete
Deletes a summary operation.
Syntax
aaSummaryOperationDelete OperationKey
Arguments
OperationKey
The unique numerical identifier for the summary operation. This value is
of data type int, with no default.
Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaSummaryOperationUpdate
aaSummaryOperationSelect
aaSummaryOperationInsert

IndustrialSQL Server Historian Database Reference


158 Chapter 4

aaSummaryOperationInsert
Inserts a summary operation that will be associated with the specified event
tag.
Syntax
aaSummaryOperationInsert TagName, CalcType, Duration,
Resolution, TimeStamp, Description
Arguments
TagName
The unique name of the tag within the IndustrialSQL Server system.This
value is of data type nvarchar(256), with no default.
CalcType
The type of calculation to be performed: SUM, MAX, MIN, or AVG. This
value is of dataype char(3), with no default.
Duration
The period, in seconds, for which the calculation is performed. This value
is of data type real, with no default.
Resolution
The sampling rate, in milliseconds, for retrieving the data in cyclic mode.
The system returns values stored over the requested time period at the
interval specified by the resolution. For example, if you specify a 5000 ms
resolution, the system queries for all data during the time period and then
only returns those values that occur at each 5000 ms interval, starting with
the start date and ending with the end date. This value is of data type int,
with no default.
TimeStamp
The timestamp to use when storing the result of the calculation. This can
either be the time of when the calculation period starts or the time when it
ends.0 = Beginning of the calculation period; 1 = End of the calculation
period. This value is of data type tinyint, with no default.
Description
The description of the summary operation. This value is of data type
nvarchar(50), with a default of NULL.
Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaSummaryOperationDelete
aaSummaryOperationSelect
aaSummaryOperationUpdate

aaSummaryOperationSelect
Selects a summary operation.
Syntax
aaSummaryOperationSelect EventTagName, CalcType, Duration,
Resolution, TimeStamp

IndustrialSQL Server Historian Database Reference


Stored Procedures 159

Arguments
EventTagName
The name of the event tag with which the summary operation is
associated. This value is of data type nvarchar(256), with a default of
NULL.
The remaining arguments are the same as for the
aaSummaryOperationInsert stored procedure. However, all of the arguments
have a default of NULL.
Remarks
The arguments of this stored procedure is used in three ways: (1) if no
arguments are specified, all summary operations will be returned; (2) if the
EventTagName argument is specified, all summary operations for that event
tag will be returned; (3) if all arguments are specified, only the summary
operation that matches the criteria will be returned.
Permission
Execute permission defaults to the public group.
See Also
aaSummaryOperationUpdate
aaSummaryOperationDelete
aaSummaryOperationInsert

aaSummaryOperationUpdate
Updates the summary operation that is associated with a specified event tag.
Syntax
aaSummaryOperationUpdate OperationKey, TagName, CalcType,
Duration, Resolution, TimeStamp, Description
Arguments
OperationKey
The unique numerical identifier for the summary operation. This value is
of data type int, with no default.
The remaining arguments are the same as for the
aaSummaryOperationInsert stored procedure. However, only the
Description argument has a default.
Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaSummaryOperationDelete
aaSummaryOperationSelect
aaSummaryOperationInsert

aaSummaryTagListDelete
Deletes summary information for a tag.

IndustrialSQL Server Historian Database Reference


160 Chapter 4

Syntax
aaSummaryTagListDelete SumVarKey
Arguments
SumVarKey
The unique numerical identifier for a summarized tag. This value is of data
type int, with no default.
Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaSummaryTagListSelect
aaSummaryTagListUpdate
aaSummaryTagListInsert

aaSummaryTagListInsert
Inserts summary information for a specified tag.
Syntax
aaSummaryTagListInsert TagName, OperationKey, LowerLimit,
UpperLimit, Description
Arguments
TagName
The unique name of the tag within the IndustrialSQL Server system.This
value is of data type nvarchar(256), with no default.
OperationKey
The unique numerical identifier for the summary operation. This value is
of data type int, with no default.
LowerLimit
The lower limit of validity for the tag's value. Values lower than this limit
are not used in the calculation. By default, this value is set to
-1000000000. This value is of data type real, with a default of NULL.
UpperLimit
The upper limit of validity for the tag's value. Values higher than this limit
are not used in the calculation. By default, this value is set to 1000000000.
This value is of data type real, with a default of NULL.
Description
The description of the summarized tag. This normally describes the result
of the operation, although this description can be the same as that of the
tag on which the operation is performed. This value is of data type
nvarchar(50), with a default of NULL.
Permission
Execute permission defaults to the aaAdministrators group.

IndustrialSQL Server Historian Database Reference


Stored Procedures 161

See Also
aaSummaryTagListDelete
aaSummaryTagListSelect
aaSummaryTagListUpdate

aaSummaryTagListSelect
Selects summary information for a tag.
Syntax
aaSummaryTagListSelect OperationKey, TagName
Arguments
OperationKey
The unique numerical identifier for the summary operation. This value is
of data type int, with no default.
TagName
The unique name of the tag within the IndustrialSQL Server system.This
value is of data type nvarchar(256), with a default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaSummaryTagListDelete
aaSummaryTagListUpdate
aaSummaryTagListInsert

aaSummaryTagListUpdate
Updates summary information for a specified tag.
Syntax
aaSummaryTagListUpdate SumVarKey, TagName, OperationKey,
LowerLimit, UpperLimit, Description
Arguments
SumVarKey
The unique numerical identifier for a summarized tag. This value is of data
type int, with no default.
The remaining arguments are the same as for the aaSummaryTagListInsert
stored procedure.
Permission
Execute permission defaults to the aaAdministrators group.
See Also
aaSummaryTagListDelete
aaSummaryTagListSelect
aaSummaryTagListInsert

IndustrialSQL Server Historian Database Reference


162 Chapter 4

aaSystemConfigNSExpand
Expands the tree view under a single object in the system namespace. This
stored procedure is used by the System Management Console.
Syntax
aaSystemNSExpand PKey, FKey1, FKey2, FKey3, TokenType,
FilterStr
Arguments
PKey
A local variable used to identify the object in the namespace.This value is
of data type int, with no default.
FKey1-FKey3
A local variable used to determine the position of the object in the tree
view. This value is of data type int, with no default.
TokenType
The type of system namespace group. 1000010 = Data Acquisition;
1000017 = System Driver; 1000018 = IDASs; 1000019 = I/O Servers.
This value is of data type int, with no default.
FilterStr
Used to order the tagnames in the namespace. This value is of data type
nvarchar(100), with a default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaPrivateNSExpand
aaPublicNSExpand

aaSystemNSExpand
Expands the tree view under a single object in the system namespace.
Syntax
aaSystemNSExpand PKey, FKey1, FKey2, FKey3, TokenType,
FilterStr
Arguments
PKey
A local variable used to identify the object in the namespace.This value is
of data type int, with no default.
FKey1-FKey3
A local variable used to determine the position of the object in the tree
view. This value is of data type int, with no default.
TokenType
The type of system namespace group. 1000010 = Data Acquisition;
1000017 = System Driver; 1000018 = IDASs; 1000019 = I/O Servers.
This value is of data type int, with no default.

IndustrialSQL Server Historian Database Reference


Stored Procedures 163

FilterStr
Used to order the tagnames in the namespace. This value is of data type
nvarchar(100), with a default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaPrivateNSExpand
aaPublicNSExpand

aaSystemNSExpand2
Expands the tree view under a single object in the system namespace.

Note This stored procedure is a simpler version of the aaSystemNSExpand


stored procedure.

Syntax
aaSystemNSExpand2 PKey, FilterStr
Arguments
PKey
A local variable used to identify the object in the namespace. This value is
of data type int, with no default.
FilterStr
Used to order the tagnames in the namespace. This value is of data type
nvarchar(100), with a default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaPrivateNSExpand
aaPublicNSExpand

aaSystemParameterSelect
Returns details for a specified system parameter, such as a description of the
parameter, the current value, and so on. If you do not specify a name, the stored
procedure returns details for all defined system parameters.
Syntax
aaSystemParameterSelect name
Arguments
Name
The unique name for the system parameter. This value is of data type
nvarchar(50), with a default of NULL.
Permission
Execute permission defaults to the public group.

IndustrialSQL Server Historian Database Reference


164 Chapter 4

See Also
aaSystemParameterUpdate

aaSystemParameterUpdate
Updates the value and description for a specified system parameter. If you do
not provide a description, the previous description is used.
Syntax
aaSystemParameterUpdate Name, Value, Description
Arguments
Name
The unique name for the system parameter. This value is of data type
nvarchar(50), with no default.
Value
The value of the system parameter. This value is of data type sql_variant,
with no default.
Description
The description of the system parameter. This value is nvarchar(255), with
a default of NULL.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaSystemParameterSelect

aaTagConfig
Used by the internal Configuration Manager when the IndustrialSQL Server
historian starts.
Syntax
aaTagConfig
Remarks
This stored procedure takes a snapshot of the system configuration at the tag
level.
Permission
Execute permission defaults to the public group.
See Also
aaTagConfigModified
aaTagConfigSelect

aaTagConfigModified
Used by the internal configuration object.

IndustrialSQL Server Historian Database Reference


Stored Procedures 165

Syntax
aaTagConfigModified
Remarks
This stored procedure has the same functionality as the aaTagConfig stored
procedure, but only retrieves the database modifications pending when a
commit of changes is performed.
Permission
Execute permission defaults to the public group.
See Also
aaTagConfig
aaTagConfigSelect

aaTagConfigSelect
Used by the System Management Console to return a list of tags associated
with a particular engineering unit (for analog tags) or message (for discrete
tags).
Syntax
aaTagConfigSelect, TagType, Key, FilterStr
Arguments
TagType
The type of tag to retrieve. 1 = Analog; 2 = Discrete. This value is of data
type int, with no default.
Key
The database key value for the relevant type, either the message key or the
engineering unit key. This value is of data type int, with no default.
FilterStr
Used to order the tagnames in the namespace. This value is of data type
nvarchar(100), with a default of N%.
Permission
Execute permission defaults to public group.
See Also
aaTagConfigModified
aaTagConfig

aaTagInfo
Returns definition information for each specified tag.
Syntax
aaTagInfo TagList

IndustrialSQL Server Historian Database Reference


166 Chapter 4

Arguments
TagList
A list of tags delimited by a comma (,). This value is of data type
nvarchar(4000), with no default.
Permission
Execute permission defaults to the public group.

aaTagType
Returns the tag type for each specified tag.
Syntax
aaTagType TagList
Arguments
TagList
A list of tags delimited by a comma (,). This value is of data type
nvarchar(4000), with no default.
Permission
Execute permission defaults to the public group.

aaTimeDetectorDetailInsert
Inserts time detector details that are associated with a specified event tag.
Syntax
aaTimeDetectorDetailInsert FrequencyID, TagName,
Periodicity, StartDateTime, RunTimeDay, RunTimeHour,
RunTimeMin
Arguments
FrequencyID
The unique numerical identifier for the frequency. Used to link a
frequency with a time-based detector. 1= Hourly; 2 = Daily; 3 = Weekly; 4
= Monthly; 5 = Periodic; 6 = Other (Reserved for future use). This value is
of data type int, with no default.
TagName
The unique name of the tag within the IndustrialSQL Server system.This
value is of data type nvarchar(256), with no default.
Periodicity
The interval period in minutes between detector events. Only used for a
periodic detection. This value is of data type int, with no default.
StartDateTime
The timestamp from which the time detector starts. Only used for a
periodic detection. This value is of data type datetime, with no default.

IndustrialSQL Server Historian Database Reference


Stored Procedures 167

RunTimeDay
In the context of a weekly detector, RunTimeDay maps the week day
number (0 = Sunday – 6 = Saturday). In the context of a monthly detector,
RunTimeDay maps to the day of the month. Not used for periodic
detections. This value is of data type tinyint, with no default.
RunTimeHour
The hour of the day at which the time detector triggers. Not used for
periodic detections. This value is of data type tinyint, with no default.
RunTimeMin
The minute of the hour at which the time detector triggers. Not used for
periodic detections. This value is of data type tinyint, with no default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaTimeDetectorDetailSelect
aaTimeDetectorDetailUpdate

aaTimeDetectorDetailSelect
Selects the time detector from the TimeDetectorDetail table that is associated
with the specified event tag.
Syntax
aaTimeDetectorDetailSelect TagName
Arguments
TagName
The unique name of the tag within the IndustrialSQL Server system.This
value is of data type nvarchar(256), with a default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaTimeDetectorDetailInsert
aaTimeDetectorDetailUpdate

aaTimeDetectorDetailUpdate
Updates the time detector in the TimeDetectorDetail table that is associated
with the specified event tag.
Syntax
aaTimeDetectorDetailUpdate FrequencyID, TagName,
Periodicity, StartDateTime, RunTimeDay, RunTimeHour,
RunTimeMin

IndustrialSQL Server Historian Database Reference


168 Chapter 4

Arguments
The arguments are the same as for the aaTimeDetectorDetailUpdate stored
procedure. However, none of the arguments have defaults.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaTimeDetectorDetailSelect
aaTimeDetectorDetailInsert

aaTopicDelete
Deletes an I/O topic.
Syntax
aaTopicDelete TopicKey
Arguments
TopicKey
The unique numerical identifier for the topic. This value is of data type int,
with no default.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaTopicUpdate
aaTopicSelect
aaTopicInsert

aaTopicInsert
Inserts an I/O topic.
Syntax
aaTopicInsert StorageNodeKey, IOServerKey, Name, TimeOut,
LateData, IdleDuration, ProcessingInterval
Arguments
StorageNodeKey
The unique numerical identifier for the storage node. This value is of data
type int, with no default.
IOServerKey
The unique numerical identifier for the I/O Server. This value is of data
type int, with no default.
Name
The name of the topic. This value is of data type nvarchar(80), with no
default.

IndustrialSQL Server Historian Database Reference


Stored Procedures 169

TimeOut
The time span, in milliseconds, in which a data point must be received on
the topic. If no data point is received in this time span, the topic is
considered "dead." The historian disconnects and then attempts to
reconnect to the topic. This value is of data type int, with a default of
60000.
LateData
Used to enable acquisition of "late" data. 0 = Late data disabled; 1 = Late
data enabled. This value is of data type bit, with a default of 0.
IdleDuration
The amount of time, in seconds, before data is processed from the I/O
Server. For example, if you set this value to 60 seconds, data from this I/O
Server is cached and only processed by the storage engine after no more
data has been received from the I/O Server for at least 60 seconds. This
value is of data type int, with a default of 60.
ProcessingInterval
The amount of time, in seconds, after which late data from the I/O Server
is processed, regardless of the idle duration. If the nature of the data is
such that the idle duration is never satisfied, the historian storage engine
processes data from the topic at least one time every processing interval.
The processing interval defaults to twice the idle duration and cannot be
set to a value less than the idle duration. This value is of data type int, with
a default of 120.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaTopicDelete
aaTopicSelect
aaTopicUpdate

aaTopicSelect
Selects an I/O topic.
Syntax
aaTopicSelect TopicKey
Arguments
TopicKey
The unique numerical identifier for the topic. This value is of data type int,
with a default of NULL.
Permission
Execute permission defaults to the public group.
See Also
aaTopicUpdate
aaTopicDelete
aaTopicInsert

IndustrialSQL Server Historian Database Reference


170 Chapter 4

aaTopicUpdate
Updates an I/O topic.
Syntax
aaTopicUpdate TopicKey, StorageNodeKey, IOServerKey, Name,
TimeOut, LateData, IdleDuration, ProcessingInterval
Arguments
TopicKey
The unique numerical identifier for the topic. This value is of data type int,
with no default.
The remaining arguments are the same as for the aaTopicInsert stored
procedure. However, only the TimeOut, LateData, IdleDuration, and
ProcessingInterval arguments have defaults.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.
See Also
aaTopicDelete
aaTopicSelect
aaTopicInsert

aaUpdateCalculatedAISamples
Used by the system to write the optimum number of samples in the active
image to the CalculatedAISamples column in the Tag table. This stored
procedure is used by the IndustrialSQL Server historian and should not be
executed by users.
Syntax
aaSetCalculatedAISamples TagKey, Samples
TagKey
The unique numerical identifier for the tag within a single IndustrialSQL
Server. This value is of data type int, with no default.
Samples
The number of samples that the active image holds for the tag. 0 indicates
that the active image is using the default of 65 values. The higher the
number of samples, the higher the load on memory resources. This value
is of data type int, with no default.
Remarks
If the AIAutoResize system parameter is set to 1, the system continuously
recalculates the optimum number of samples for each tag based on the data
rates received. If the calculated value exceeds the current value in the database,
then the system updates the CalculatedAISamples column in the Tag table.
Permission
Execute permission defaults to the aaPowerUsers and aaAdministrators
groups.

IndustrialSQL Server Historian Database Reference


Stored Procedures 171

See Also
aaSetAISamples
aaSetCalculatedAISamples

aaUserAccessLevelSelect
Returns the access level associated with the currently logged on user. Access
levels are: 1 = Undefined IndustrialSQL user (for example, public); 2 = User
(hUser permissions); 3 = PowerUser (hPowerUser permission); 3 = Admin
(hAdmin permissions); 9999 = dbo.
Syntax
aaUserAccessLevelSelect
Remarks
The access level values correspond to values in the UserDetail table, which is
populated during installation.
Permission
Execute permission defaults to the public group.

aaUserDetailUpdate
Allows the UserDetail table to be populated from information contained in the
sysusers table.
Syntax
aaUserDetailUpdate
Permission
Execute permission defaults to the aaAdministrators group.

Extended Stored Procedures


An extended stored procedure can trigger an action outside of SQL Server, the
results of which can be stored back into the SQL Server. All of the extended
stored procedures for the IndustrialSQL Server historian are contained in one
single dynamic-link library, called aahSQLXP.dll, and communicate with a
historian as MDAS clients. For example, to query data from the AnalogHistory
table, the xp_AnalogHistory extended stored procedure will make a call to the
aahSQLXP.dll. This .dll will perform the actual data query on the
AnalogHistory table (which is only supported by the historian) and return the
results to the Microsoft SQL Server.
Extended stored procedures must be executed from the master database, or
must be qualified with a master prefix if executed from the Runtime database.
For example, EXEC master..xp_ProcList. Also, these extended stored
procedures are case-sensitive, if the SQL Server was installed in case-sensitive
mode. Execute permission for most of these extended stored procedures
defaults to the public group. Extended stored procedures that change system
settings or perform administrative actions may only be executed by members
of the aaAdministrators group.

IndustrialSQL Server Historian Database Reference


172 Chapter 4

Some of the historian extended stored procedures allow high-level retrieval


access to archived history data through Microsoft SQL Server queries. Other
stored procedures also provide a set of utility functions to work with historian
history blocks and deadbands.

History Extended Stored Procedures


The history extended stored procedures allow you to query historical data from
within stored procedures created on the Microsoft SQL Server. Any normal
SQL Server function that can call a stored procedure can call any of these
extended stored procedures.
The data values returned will be the most current values that exist in the
database. The ability to select the version of history (latest or original) is not
supported. Use the INSQL OLE DB provider to access versioned data values.
For descriptions of the parameters used by the extended stored procedures, see
"Extended Stored Procedure Arguments" on page 176.

xp_AnalogHistory
Returns data from the AnalogHistory table.
Syntax
xp_AnalogHistory StartTime, EndTime, Resolution, Tag1
[,Tag2,...]

xp_AnalogHistoryDelta
Returns a row from the AnalogHistory table for each instance where a stored
analog value changed (delta retrieval).
Syntax
xp_AnalogHistoryDelta StartTime, EndTime, MaxRowCount,
Tag1 [,Tag2,...]

xp_AnalogWideHistory
Returns data from the AnalogWideHistory table. Each row returned contains a
value in each column for each tag's value at a specified time.
Syntax
xp_AnalogWideHistory StartTime, EndTime, Resolution, Tag1
[,Tag2,...]

xp_AnalogWideHistoryDelta
Returns data from the AnalogWideHistory table for each instance where a
stored analog value changed (delta retrieval). Each row returned contains a
value in each column for each tag's value at a specified time.
Syntax
xp_AnalogWideHistoryDelta StartTime, EndTime, MaxRowCount,
Tag1 [,Tag2,...]

IndustrialSQL Server Historian Database Reference


Stored Procedures 173

xp_DiscreteHistory
Returns data from the DiscreteHistory table.
Syntax
xp_DiscreteHistory StartTime, EndTime, Resolution, Tag1
[,Tag2,...]

xp_DiscreteHistoryDelta
Returns a row from the DiscreteHistory table for each instance where a stored
discrete value changed (delta retrieval).
Syntax
xp_DiscreteHistoryDelta StartTime, EndTime, MaxRowCount,
Tag1 [,Tag2,...]

xp_DiscreteWideHistory
Returns data from the DiscreteWideHistory table. Each row returned contains a
value in each column for each tag's value at a specified time.
Syntax
xp_DiscreteWideHistory StartTime, EndTime, Resolution,
Tag1 [,Tag2,...]

xp_DiscreteWideHistoryDelta
Returns data from the DiscreteWideHistory table for each instance where a
stored discrete value changed (delta retrieval). Each row returned contains a
value in each column for each tag's value at a specified time.
Syntax
xp_DiscreteWideHistoryDelta StartTime, EndTime,
MaxRowCount, Tag1 [,Tag2,...]

Utility Extended Stored Procedures


Utility extended stored procedures provided with the IndustrialSQL Server
historian are:
• xp_DiskCopy
• xp_NewHistoryBlock
• xp_ProcList
• xp_RescanHistoryBlocks
• xp_SetStorageTimeDeadband
• xp_SetStorageValueDeadband
• xp_SetStoreForwardEvent

IndustrialSQL Server Historian Database Reference


174 Chapter 4

xp_DiskCopy
Copies history blocks or a subset of history blocks to the "archive" historical
path (permanent path).
Syntax
xp_DiskCopy StartTime, EndTime, Description
Parameters
For more information on the parameters, see "Extended Stored Procedure
Arguments" on page 176.
Remarks
The xp_DiskCopy extended stored procedure will not allow a history block to
be copied if the time range specified is already archived in permanent storage.
You must first delete the archived block(s) that falls within the specified time
range before performing the block copy. This prevents overwriting the
archived block with a newer block that has had old data inserted with the same
timestamps as the already archived data.
Example
For example:
xp_DiskCopy "20010220 13:10:00:000", "20010220
14:00:00:000", "Plant trip 02/20/2001"

xp_NewHistoryBlock
Stops data from being written to the current history block and starts a new one.
This process will take approximately 10 minutes, but no data is lost. The
system acts the same as if it were a scheduled block changeover.
Syntax
xp_NewHistoryBlock
Remarks
When this extended stored procedure is executed, a message will be logged to
the message log file as for a regular block changeover. However, if executed
manually in SQL Server Query Analyzer, a message will also appear in the
Results section if the execution was successful. To verify that the block
changeover actually occurred, you must still check in the System Management
Console message log. For more information, see "Monitoring System
Messages" in Chapter 9, "Monitoring the System," in your IndustrialSQL
Server™ Historian Administration Guide.

xp_ProcList
Returns syntax details for all of the extended stored procedures for the
IndustrialSQL Server historian that exist on the Microsoft SQL Server.
Syntax
xp_ProcList

IndustrialSQL Server Historian Database Reference


Stored Procedures 175

xp_RescanHistoryBlocks
Refreshes the system with any history block changes since the last scan.
Syntax
xp_RescanHistoryBlocks

xp_SetStorageTimeDeadband
Sets the storage time deadband for one or more tags while the IndustrialSQL
Server historian is running.
Syntax
xp_SetStorageTimeDeadband <TimeDeadband>, <Tag1> [,
<Tag2>,...]
Arguments
For more information on the parameters, see "Extended Stored Procedure
Arguments" on page 176.
Remarks
The xp_SetStorageTimeDeadband extended stored procedure is a server
function that will modify the delta storage rule for the specified tag. It does not
update the database and is valid until the server is restarted.
Example
This example sets the storage time deadband to 2000 milliseconds for the
analog tag "BoilerTag:"
xp_SetStorageTimeDeadband 2000, 'BoilerTag'

xp_SetStorageValueDeadband
Sets the storage value deadband for one or more tags while the IndustrialSQL
Server historian is running.
Syntax
xp_SetStorageValueDeadband <ValueDeadband>, <Tag1> [,
<Tag2>,...]
Arguments
For more information on the parameters, see "Extended Stored Procedure
Arguments" on page 176.
Remarks
The xp_SetStorageValueDeadband extended stored procedure is a server
function that will modify the delta storage rule for the specified tag. It does not
update the database and is valid until the server is restarted.
Example
This example sets the storage value deadband to 5 percent of the engineering
unit range for the analog tag "BoilerTag:"
xp_SetStorageValueDeadband 5, 'BoilerTag'

IndustrialSQL Server Historian Database Reference


176 Chapter 4

xp_SetStoreForwardEvent
Starts store-and-forward data processing on the IndustrialSQL Server
historian.
Syntax
xp_SetStoreForwardEvent
Remarks
This extended stored procedure is useful if you have manually copied store-
and-forward blocks from the IDAS computer to the historian computer.

Extended Stored Procedure Arguments


Most of the extended stored procedures for the IndustrialSQL Server historian
use one or more of the following arguments:
StartTime, EndTime
The StartTime string value represents the starting timestamp for the data to
query. The EndTime string value represents the ending timestamp for the
data to query. The date/time value can be any valid SQL Server date/time
string.
The notion of specifying a time zone is not supported. All date/time
strings passed as parameters to an extended stored procedure are
considered as local server time.
For start and end times, the GetDate() and DateAdd(...) functions are
supported, as well as literal dates. For more information, see "Literal Date
Expressions" on page 177, "GetDate() Expressions" on page 177, and
"DateAdd(...) Expressions" on page 177.
Resolution
The sampling rate, in milliseconds, for retrieving the data in cyclic mode.
The system returns values stored over the requested time period at the
interval specified by the resolution. For example, if you specify a 5000 ms
resolution, the system queries for all data during the time period and then
only returns those values that occur at each 5000 ms interval, starting with
the start date and ending with the end date.
MaxRowCount
The maximum number of rows to be returned for a specified time period.
ValueDeadBand
The percentage of the difference between the minimum and maximum
engineering units for the tag. Any data values that change less than the
specified deadband are not stored. The value deadband applies to delta
storage only. A value of 0 indicates that a value deadband will not be
applied.
TimeDeadband
The minimum time, in milliseconds, between stored values for a single
tag. Any value changes that occur within the time deadband are not stored.
The time deadband applies to delta storage only. A time deadband of 0
indicates that the system will store the value of the tag each time it
changes.

IndustrialSQL Server Historian Database Reference


Stored Procedures 177

Description
The description of the history data that will be copied.
TagN
Tag1, Tag2… TagN are tagname values. Each tagname must be comma
delimited and can optionally be surrounded with quotes. For example:

exec xp_AnalogHistory "DateAdd(HOUR, -1, GetDate())",


"GetDate()", 1000, SysTimeSec, SysTimeMin

exec xp_DiscreteHistory "DateAdd(HOUR, -1, GetDate())",


"GetDate()", 1000, "SysPulse"
If a tagname is not of the same type as expected for the named stored
procedure then it is ignored. For example, if you pass an analog tagname
as a parameter to xp_DiscreteHistory, it will be ignored.
For information regarding valid tagnames, see "Naming Conventions for
Tags" in Chapter 2, "System-Level Functionality," in your IndustrialSQL
Server™ Historian Concepts Guide.

Literal Date Expressions


Date expressions can be any valid SQL Server date expression. Here are some
examples
"4/2/2001 13:00:00:00"
"4/2/2001 12:00 PM"
"2001-4-2 1:00 AM"
Years expressed as two digits are interpreted as years in the 1900s. The SQL
Server configuration option that supports a two-digit year cutoff is not used.

GetDate() Expressions
Date/time values can have a string value expression containing the string
"GetDate". This is not the same as the SQL Server GetDate() function,
although the effect is the same. Example expressions are:
GetDate
"GetDate"
"GetDate()"
For example:
exec xp_AnalogHistory GetDate, "GetDate()", 1000,
'SysTimeSec'

DateAdd(...) Expressions
Date/time values can have a string value expression containing the string
"DateAdd(…)". This is not the same as the SQL Server DateAdd() function,
although the effect is very similar.
Syntax
"DATEADD (datepart, number, date)"

IndustrialSQL Server Historian Database Reference


178 Chapter 4

Parameters
DatePart
Specifies on which part of the date to return a new value. The following
table lists the date parts and abbreviations recognized by the extended
stored procedures for the IndustrialSQL Server historian.
MILLISECOND MS
SECOND SS
MINUTE MI
HOUR HH
DAY DD
WEEKDAY DW
WEEK WK
DAYOFYEAR DY
MONTH MM
QUARTER QQ
YEAR YY

Number
The value used to increment datepart. If you specify a value that is not an
integer, the fractional part of the value is discarded. For example, if you
specify day for datepart and 1.75 for number, date is incremented by 1.
Date
Either a literal date value without quotes (see "Literal Date Expressions"
on page 177) or a GetDate() expression also without quotes (see
"GetDate() Expressions" on page 177).
Example Expressions
"DateAdd(HOUR, -1, GetDate())"
"DateAdd(MINUTE, -30, 4/2/2001 13:00:00:00)"
Extended Stored Procedure Date Expression Examples
xp_DiscreteHistory "DateAdd(HOUR, -1, GetDate())",
"GetDate()", 1000, 'SysPulse'
xp_DiscreteHistoryDelta "DateAdd(DAY, -1, 4/2/2001)",
"GetDate()", 100, 'SysPulse'

System Extended Stored Procedures


Extended stored procedures used internally by the IndustrialSQL Server
historian are:
• xp_AllowCommit
• xp_TZgetdate
• xp_SetAutoStart

IndustrialSQL Server Historian Database Reference


Stored Procedures 179

xp_AllowCommit
Determines whether a dynamic reconfiguration can be committed. Used by the
aaCommitChanges stored procedure when a dynamic reconfiguration is
requested.
Syntax
xp_AllowCommit AllowCommit
Arguments
AllowCommit
A single output parameter provided by the system.
Return Values

Value Description
0 OK to commit.
1 The system is not running or has not been started. The
commit request will be ignored and clean up the
ConfigStatusPending table cleaned up.
2 Cannot commit; history block in progress.
4 Cannot commit; dynamic reconfiguration in progress.
128 Cannot commit; reason unknown.

xp_TZgetdate
Returns the correct date/time for the time zone specified. Used by the
faaTZgetdate function.
Syntax
xp_TZgetdate wwTimeZone
Argument
wwTimeZone
Time zone for which to return the date/time.
Return Value
DateTime
The correct date/time for the requested time zone.

xp_SetAutoStart
Sets the InSQLConfiguration service startup type parameter to "Automatic."
Syntax
xp_SetAutoStart

IndustrialSQL Server Historian Database Reference


180 Chapter 4

Remarks
This extended stored procedure configures the InSQLConfiguration service. In
order for the InSQLConfiguration service to start up the rest of the
IndustrialSQL Server historian, the AutoStart system parameter must be set to
1. For more information, see "System Parameters" in Chapter 2, "System-
Level Functionality," in your IndustrialSQL Server™ Historian Concepts
Guide.

Stored Procedures for Internal Use


Stored procedures that are used internally by the system are prefixed with
"aaInternal." For example, aaInternalAnalogTagExport. Do not use these
stored procedures or change them in any way. Internal stored procedures may
change from release to release, and no legacy support will be provided.
• aaInternalAnalogTagExport
• aaInternalAnalogTagImport
• aaInternalAreaDataClear
• aaInternalAreaDataInsert
• aaInternalAreaVersion
• aaInternalAreaVersionInsert
• aaInternalAreaXMLInsert
• aaInternalAttributeDataInsert
• aaInternalAttrObjectDataClear
• aaInternalDiscreteTagExport
• aaInternalDiscreteTagImport
• aaInternalEngineeringUnitExport
• aaInternalEngineeringUnitImport
• aaInternalEventTagExport
• aaInternalEventTagImport
• aaInternalHistoryModTrack
• aaInternalIODriverExport
• aaInternalIODriverImport
• aaInternalIOServerExport
• aaInternalIOServerImport
• aaInternalLicensedObjectCount
• aaInternalLicenseParametersUpdate
• aaInternalLocalizedTextExport
• aaInternalMDASAnalogTagInsert
• aaInternalMDASAnalogTagUpdate

IndustrialSQL Server Historian Database Reference


Stored Procedures 181

• aaInternalMDASDiscreteTagInsert
• aaInternalMDASDiscreteTagUpdate
• aaInternalMDASStringTagInsert
• aaInternalMDASStringTagUpdate
• aaInternalMessageExport
• aaInternalMessageImport
• aaInternalNSAreaUpdate
• aaInternalNSObjectPopulate
• aaInternalNSObjectUpdate
• aaInternalObjectDataInsert
• aaInternalSetServerName
• aaInternalSnapshotTagExport
• aaInternalSnapshotTagImport
• aaInternalStringTagExport
• aaInternalStringTagImport
• aaInternalSummaryOperationExport
• aaInternalSummaryOperationImport
• aaInternalSummaryTagExport
• aaInternalSummaryTagImport
• aaInternalTagDetails
• aaInternalTopicExport
• aaInternalTopicImport

Creating Stored Procedures


You can create your own stored procedures for use with the IndustrialSQL
Server historian. All procedure names will be stored in the Runtime database.
The stored procedure text will be stored in the Microsoft SQL Server and
retrieved at startup (from procedures created in an older session) as well as at
creation time (from procedures created in the current session). Temporary
procedures will not be supported. No arguments are allowed.
As with Microsoft SQL Server support, support for dynamic stored procedures
for the historian will be such that when defining a stored procedure, you can
create a stored procedure only in the current database, and the CREATE
PROCEDURE statement cannot be combined with other SQL statements in a
single batch.
Creating your own stored procedures is useful when you want to execute
certain types of queries through a typical ODBC connection. The historian
requires a specific ODBC configuration unless you create a stored procedure to
execute the query.

IndustrialSQL Server Historian Database Reference


182 Chapter 4

For example, the following query creates a stored procedure that returns the
timestamp and value for the tag 'ReactLevel" for the last 15 minutes.
CREATE PROCedure MyProc
AS
SELECT DateTime, TagName, Value
FROM History
WHERE TagName = 'ReactLevel'
AND DateTime >= DATEADD(mi, -15, GETDATE())
AND DateTime <= GETDATE()

IndustrialSQL Server Historian Database Reference


User-Defined Functions 183

C H A P T E R 5

User-Defined Functions

A SQL Server function is a subroutine containing one or more Transact-SQL


statements. Functions can be used to encapsulate code so that it can be reused.
The IndustrialSQL Server historian includes a number of functions that are
used within the system to facilitate license validation.

Contents
• faaCheckLicenseViolation
• faaContainedName
• faaGetLocalizedText
• faaLicensedTagDetails
• faaLicensedTagTotal
• faaObjectTagName
• faaTagsInLicenseViolation
• faaTZgetdate
• faaUser_ID

faaCheckLicenseViolation
Checks to see if the total number of tags in the IndustrialSQL Server historian
is less than or equal to the number allowed by the current license.
Syntax
SELECT dbo.faaCheckLicenseViolation()
Return Type
Integer.
Remarks
If the total number of tags in the system is below the amount allowed, the result
of this function will be 0. If not, the number of tags that exceed the allocated
amount will be returned. For example, if a system has 100 tags, but the license
only allows for 60, a value of 40 will be returned.

IndustrialSQL Server Historian Database Reference


184 Chapter 5

See Also
faaLicensedTagDetails
faaLicensedTagTotal
faaTagsInLicenseViolation

faaContainedName
Given a string in the form of "TagName [ ContainedName ]," returns the
ContainedName.
Syntax
SELECT dbo.faaContainedName(DisplayName)
Arguments
DisplayName
The name as it appears in the model view hierarchy. The display name
format is: TagName [ ContainedName ].
Return Type
Nvarchar(255).
Remarks
The maximum number of characters for both the display name and the returned
contained name is 255.
See Also
faaObjectTagName

faaGetLocalizedText
Returns the strings from the LocalizedText table for the requested language. If
the specified translation is not found, English strings are returned.
Syntax
SELECT * FROM dbo.faaGetLocalizedText(LangID)
Arguments
LangID
The locale ID for the language used. This ID is also used in the SQL
Server syslanguages table.
Table Returned
The results are returned as a table that has the same columns as the
LocalizedText table. However, the returned table will only include those rows
containing strings in the specified language.

faaLicensedTagDetails
Returns the total number of tags and the number of licensed tags in the system,
as well as for each tag type.

IndustrialSQL Server Historian Database Reference


User-Defined Functions 185

Syntax
SELECT * FROM dbo.faaLicensedTagDetails()
Table Returned
The result is returned in a table format. For example:

Tag Type Tag Count Licensed Tags


Analog 213 121
Discrete 68 60
String 27 26
Event 3 0
Total 311 207

Remarks
System tags and event tags are not included in the total tag count for licensing
purposes.
See Also
faaCheckLicenseViolation
faaLicensedTagTotal
faaTagsInLicenseViolation

faaLicensedTagTotal
Returns the total number of tags in the system for the specified tag type or for
all tags.
Syntax
SELECT dbo.faaLicensedTagTotal(TagType)
Arguments
TagType
The type of tag. 1 = Analog; 2 = Discrete; 3 = String; 4 = Complex; 0 = All
tags.
Return Type
Integer.
Remarks
System tags and event tags are not included in the total tag count for licensing
purposes.
See Also
faaCheckLicenseViolation
faaLicensedTagDetails
faaTagsInLicenseViolation

IndustrialSQL Server Historian Database Reference


186 Chapter 5

faaObjectTagName
Given a string in the form of "TagName [ ContainedName ]," returns the
Tagname.
Syntax
SELECT dbo.faaObjectTagName(DisplayName)
Arguments
DisplayName
The name as it appears in the model view hierarchy. The display name
format is: TagName [ ContainedName ].
Return Type
Nvarchar(255).
Remarks
The maximum number of characters for both the display name and the returned
tagname is 255.
See Also
faaContainedName

faaTagsInLicenseViolation
Returns information about tags that have been disabled due to violation of the
licensed tag count. The information is returned in a table format.
Syntax
SELECT * FROM dbo.faaTagsInLicenseViolation()

IndustrialSQL Server Historian Database Reference


User-Defined Functions 187

Table Returned

Column Data type Description


TagName nvarchar(256) The unique name of the tag within the
IndustrialSQL Server system.
wwTagKey int The unique numerical identifier for the tag
within a single IndustrialSQL Server.
Description nvarchar(512) The description of the tag.
Address nvarchar(512) The address information for the tag, which
consists of the computer name, application
name, topic, and item name. For example,
\\kc1\VIEW!Tagname:ReactLevel.

Remarks
If the licensed tag count has been exceeded, the historian will disable enough
tags to run with the allowed licensed tag count. To determine the tags that are
in violation of the license, the system first generates the total number of
analog, discrete, complex, and string tags. (System and event tags are not
included in the total tag count for licensing.) If the total number of tags exceeds
the number allowed by the license, the most recent tag additions to the system
are disabled. The most recent additions are indicated by the wwTagKey
column of the Tag table; the higher the number, the more recent the addition.
See Also
faaCheckLicenseViolation
faaLicensedTagDetails
faaLicensedTagTotal

faaTZgetdate
Returns the date/time, in the appropriate time zone.
Syntax
SELECT dbo.faaTZgetdate(TimeZone)
Arguments
TimeZone
The name of the time zone.
Return Type
DateTime.
Remarks
Use this function instead of the SQL GetDate() function to specify a time zone
other than the server time zone in a query. To retrieve data in the time zone of
the server, just use the SQL GetDate() function.
Example
DECLARE @starttime datetime

IndustrialSQL Server Historian Database Reference


188 Chapter 5

SET @starttime = dbo.faaTZgetdate('eastern daylight time')


SELECT DateTime, TagName, Value FROM History
WHERE TagName IN ('SysTimeHour', 'SysTimeMin',
'SysTimeSec')
AND DateTime > DateAdd(mi, -30, @starttime)
AND DateTime < DateAdd(mi, -5, @starttime)
AND wwTimeZone = 'eastern daylight time'
For more information on using date/time functions in a query, see "Using
DateTime Functions" on page 169 in your IndustrialSQL Server™ Historian
Concepts Guide.

faaUser_ID
Returns the database user ID (in the Runtime database) for the current user, if
the user has an individual login. Returns the database ID of the appropriate
Windows security group, if the current user is a group member and does have
an individual login (that is, the current user logs in by virtue of being a member
of the Windows group).
Syntax
SELECT dbo.faaUserID()
Return Type
Integer.
Remarks
This function is used for processing annotations and for support of private
namespaces.
• If a user has his or her own database login, he or she has a completely
private namespace and private annotations.
• If the user is part of a Windows security group, and logs in only by virtue
of being part of the group, the private namespace and annotations are
shared with all members of that group.
This stored procedure assumes that Windows users that are logged in are only
members of a single Windows group (configured in SQL Server). If a user is
found in more than one group, the ID of the last group found is used. This
could be a problem if you are expecting a given user to have access to a
particular private group.
Also, it is possible that annotations and namespace entries are created under
names that you might not expect. For example, a user is a local administrator
on a computer, and his/her login has also been added to the aaUsers local
group. When logging in to SQL Server, the user will be mapped to the
sysadmin fixed server role, by virtue of his/her membership in the
BUILTIN\Administrators group. (This assumes that the
BUILTIN\Administrators login has not been modified or disabled for security
reasons). If this user creates annotations or private namespace entries, these
appear as if they had been created by "dbo," rather than by a member of the
local aaUsers group.

IndustrialSQL Server Historian Database Reference


Backward Compatibility Entities 189

C H A P T E R 6

Backward Compatibility
Entities

Some entities are included in the database for backward compatibility support
only. It is recommended that you begin to discontinue the use of these entities.

Contents
• Backward Compatibility Views
• Backward Compatibility Tables
• Backward Compatibility Stored Procedures
• Backward Compatibility Functions

Backward Compatibility Views


Backward compatibility views include:
• History Table Views
• Summary Views
• NamedSystemParameter
• SystemNameSpace
• InSQLSysObjects
• v_ErrorLog

History Table Views


All of the following views reflect the same table structure as the extension
tables after which they are named.

These views: Reference this extension table:


AnalogHistory, INSQL.Runtime.dbo.AnalogHistory
v_AnalogHistory
AnalogLive, INSQL.Runtime.dbo.AnalogLive
v_AnalogLive

IndustrialSQL Server Historian Database Reference


190 Chapter 6

These views: Reference this extension table:


DiscreteHistory, INSQLD.Runtime.dbo.DiscreteHistory
v_DiscreteHistory
DiscreteLive INSQLD.Runtime.dbo.DiscreteLive
v_DiscreteLive
v_History INSQL.Runtime.dbo.History
v_HistoryBlock INSQL.Runtime.dbo.HistoryBlock
v_Live INSQL.Runtime.dbo.Live
StringHistory, INSQL.Runtime.dbo.StringHistory
v_StringHistory
StringLive, INSQL.Runtime.dbo.StringLive
v_StringLive
To allow joins between the analog, string, and discrete tables, the analog and
string views reference the OLE DB linked server "INSQL," while the discrete
views reference the OLE DB linked server "INSQLD."

Note The history tables that are listed in the SQL Server Enterprise Manager
under the Tables tree item for the Runtime database (for example,
History_OLEDB) are simply definitions for the OLE DB provider to use; no
data is stored in them. The extension tables that actually provide data to clients
are listed for the INSQL or INSQLD linked servers under the Security tree
item.

Summary Views
The summary views allow you to query for data that was summarized by the
event subsystem. Each of the views contains data for a specific source,
frequency, and operation.

View Contains One Row For Each


DynDailyAvg Daily average value for a tag.
DynDailySum Daily summary value for a tag.
DynHourlyAvg Hourly average value for a tag.
DynHourlyMax Hourly maximum value for a tag.
DynHourlyMin Hourly minimum value for a tag.
DynHourlySum Hourly summary value for a tag.

IndustrialSQL Server Historian Database Reference


Backward Compatibility Entities 191

Each table view contains the following columns:

Column Data type Description


TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system.
SummaryDate datetime NOT NULL The date applicable to the results of the
calculation. It is either the time of the
beginning or end of the calculation period,
as specified by the summary operation
definition.
Value float(8) NULL The value of the summary.
Quality tinyint NOT NULL The basic data quality indicator associated
with the data value.

NamedSystemParameter
Contains one row for each system parameter. This view provides backward
compatibility support for the NamedSystemParameter table, which has been
replaced by the SystemParameter table.

Column Data type Description


Name nvarchar(50) NOT NULL The unique name for the system parameter.
Type varchar(7) NULL Used to specify the datatype for the system
parameter value. Valid values are:
NUMERIC, STRING.
StringValue varchar(255) NULL The value of the system parameter. This
column only contains values of type
STRING..
NumericValue real NULL The value of the system parameter. This
column only contains values of type
NUMERIC.
Editable bit NULL Used to determine if the value of the
named system parameter can be changed
using the InSQL Console. 1 = Editable; 0 =
Not editable.
Description nvarchar(255) NULL The description of the system parameter.

IndustrialSQL Server Historian Database Reference


192 Chapter 6

SystemNameSpace
Contains one row for each item in a single system namespace. Items in the
system namespace include servers, topics, users, and so on, and are organized
in a hierarchy. This view provides backward compatibility support for the
SystemNameSpace table, which has been deleted.

Column Data type Description


NameKey int NULL The unique identifier for the object in the
namespace.
Type int NOT NULL The value that specifies the type of
namespace. 1 to 6 = Tag; 1 to 2 million =
System; 2+ million = Groups. Within the
system range, the following values
designate ArchestrA object types: 1999023
= Galaxy; 1999001 = WinPlatform object;
1999003 = AppEngine object; 1999013 =
Area object; 1999011 =
DDESuiteLinkClient, OPCClient, and
InTouchProxy objects; 1999024 =
RedundantDIObject object; 1999033 =
Undeployed object represented by a
generic name; 1999901 =
ApplicationObject; 1999902 = Traceability
object.
ParentKey int NULL The unique identifier for a named object in
this namespace.
Name nvarchar(290) NULL The name of this object in the hierarchy.
PKey int NULL The primary key reference for other tables.

InSQLSysObjects
Contains one row for each object in the database for which changes can be
tracked.This view provides backward compatibility support for the
InSQLSysObjects table, which has been renamed to HistorianSysObjects

Column Data Type Description


id int NOT NULL The unique identifier for the object.
Type char(2) NULL The type of object. C = CHECK constraint;
D = Default or DEFAULT constraint; F =
FOREIGN KEY constraint; K =
PRIMARY KEY or UNIQUE constraint; L
= Log; P = Stored procedure; R = Rule; RF
= Stored procedure for replication; S =
System table; TR = Trigger; U = User
table; V = View; X = Extended stored
procedure. Currently, only changes for the
user tables (object type U) are tracked.
Name varchar(50) NULL The name of the modified object.

IndustrialSQL Server Historian Database Reference


Backward Compatibility Entities 193

v_ErrorLog
Contains one row for each system message (error message), if this
functionality was enabled. By default, this table is not used. For more
information, see Chapter 9, "Monitoring the System," in your IndustrialSQL
Server™ Historian Administration Guide.

Column Data type Description


DateTime datetime NOT NULL The date that the message was written to the
system log, in the local time of the
IndustrialSQL Server historian.
Type nvarchar(10) NULL The type of system message.
LocalizedText nvarchar(256) NULL The content of the message.
Parameter nvarchar(256) NULL Optional details pertaining to the message
text. For example, for the message "Disk
space remaining on circular path" the
parameter would contain the number of MB.
TotalCount int NULL Used to prevent "flooding" conditions in the
log file. If a particular message is generated
numerous times during a relatively short
period of time, the message is written to the
log file only once, and the total number of
times that it occurred appears in this column.
ModuleID int NULL A unique number assigned to the
IndustrialSQL Server subsystem that
generated the message.
Host nvarchar(32) NULL The computer on which the IndustrialSQL
Server subsystem runs.
FileName nvarchar(64) NULL Used to indicate the program file that
contains the line of code that an error
message comes from. Used for debugging.
Line int NULL Used to indicate the line of code that an error
message comes from. Used for debugging.

Backward Compatibility Tables


The backward compatibility tables include:
• AnalogHistory (INSQL.Runtime.dbo.AnalogHistory)
• AnalogLive (INSQL.Runtime.dbo.AnalogLive)
• AnalogWideHistory
• ComplexHistory
• ComplexTag
• DiscreteHistory (INSQL.Runtime.dbo.DiscreteHistory)
• DiscreteLive (INSQL.Runtime.dbo.DiscreteLive)

IndustrialSQL Server Historian Database Reference


194 Chapter 6

• DiscreteWideHistory
• GroupTagList
• ManualAnalogHistory
• ManualDiscreteHistory
• ManualStringHistory
• NameSpaceIcons
• StringHistory (INSQL.Runtime.dbo.StringHistory)
• StringLive (INSQL.Runtime.dbo.StringLive)
• StringWideHistory
• TagGroup
• WideTableDictionary

AnalogHistory
(INSQL.Runtime.dbo.AnalogHistory)
This table has been superceded by the History table. For descriptions of
columns in this table, see "History (INSQL.Runtime.dbo.History)" on page 38.

Column Data type


DateTime datetime NOT NULL
TagName nvarchar(256) NOT NULL
Value float(8) NULL
Quality tinyint NOT NULL
QualityDetail int NULL
OPCQuality int NULL
wwTagKey int NOT NULL
wwRowCount int NULL
wwResolution int NULL
wwEdgeDetection nvarchar(20) NULL
wwRetrievalMode nvarchar(20) NULL
wwTimeDeadband int NULL
wwValueDeadband real NULL
wwTimeZone nvarchar(50) NULL
wwVersion nvarchar(30) NULL
wwCycleCount int NULL
wwTimeStampRule nvarchar(20) NULL
wwInterpolationType nvarchar(20) NULL
wwQualityRule nvarchar(20) NULL
wwParameters nvarchar(128) NULL

IndustrialSQL Server Historian Database Reference


Backward Compatibility Entities 195

AnalogLive (INSQL.Runtime.dbo.AnalogLive)
This table has been superceded by the Live table. For descriptions of columns
in this table, see "Live (INSQL.Runtime.dbo.Live)" on page 50.

Column Data type


DateTime datetime NOT NULL
TagName nvarchar(256) NOT NULL
Value float(8) NULL
Quality tinyint NOT NULL
QualityDetail int NULL
OPCQuality int NULL
wwTagKey int NOT NULL
wwRetrievalMode nvarchar(20) NULL
wwTimeDeadband int NULL
wwValueDeadband real NULL
wwTimeZone nvarchar(50) NULL
wwParameters nvarchar(128) NULL

AnalogWideHistory
This table has been superceded by the WideHistory table. In a query, this table
must be referenced using an OPENQUERY statement. For descriptions of
columns in this table, see "WideHistory (INSQL.Runtime.dbo.WideHistory)"
on page 77.

Column Data type


DateTime datetime NOT NULL
TagA1 float(8) NULL
TagA2 float(8) NULL
ManyOtherTags float(8) NULL
wwRowCount int NULL
wwResolution int NULL
wwEdgeDetection nvarchar(20) NULL
wwRetrievalMode nvarchar(20) NULL
wwTimeDeadband int NULL
wwValueDeadband real NULL
wwTimeZone nvarchar(50) NULL
wwVersion nvarchar(30) NULL
wwCycleCount int NULL
wwTimeStampRule nvarchar(20) NULL
wwInterpolationType nvarchar(20) NULL

IndustrialSQL Server Historian Database Reference


196 Chapter 6

Column Data type


wwQualityRule nvarchar(20) NULL
wwParameters nvarchar(128) NULL

ComplexHistory
Contains one row for each stored complex tag over time. Complex tags include
BLOBs such as arrays, .AVI files, bitmaps, and so on. The ComplexHistory
table is not automatically populated by the system, but rather by a client
application. The ComplexHistory table is a normal SQL Server table.

Note Complex tags are currently not supported. BLOBs are stored as strings.

Column Data type Description


(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system.
DateTime datetime NOT NULL The timestamp reflecting when the
complex history data was acquired.
Content image NULL The content to be stored as a complex
value. Content can be arrays, .AVI files,
bitmaps, and so on.
Quality tinyint NOT NULL The basic data quality indicator associated
with the data value.
QualityDetail int NULL An internal representation of data quality.

ComplexTag
Contains one row for each defined complex tag. Configuration information
particular to complex tags is stored in this table, while general information for
all tag types is stored in the Tag table. A complex tag is any type of tag data
other than analogs, discretes, or strings. Examples are arrays and video.

Note Complex tags are currently not supported. BLOBs are stored as strings.

Column Data type Description


(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system.
InitialValue image NULL The initial value as imported from an
external source (for example, from
InTouch).

IndustrialSQL Server Historian Database Reference


Backward Compatibility Entities 197

Column Data type Description


Provider nvarchar(128) NULL The name of the function that performs a
specific operation on the data (content)
before the data is stored in the database.
For example, a compression algorithm.
Provider functions are stored in an
IndustrialSQL Server .DLL.
Retriever nvarchar(128) NULL The name of the function that performs a
specific operation on the data (content)
before the data can be retrieved from the
database. For example, an algorithm to
uncompress data. Retriever functions are
stored in an IndustrialSQL Server .DLL.
Type int NOT NULL The type of complex tag. 0 = COM Object;
1 = Data operated upon by functions; 2 =
Data treated as a file for use by an
executable.

DiscreteHistory
(INSQL.Runtime.dbo.DiscreteHistory)
This table has been superceded by the History table. For descriptions of
columns in this table, see "History (INSQL.Runtime.dbo.History)" on page 38.

Column Data type


DateTime datetime NOT NULL
TagName nvarchar(256) NOT NULL
Value float(8) NULL
Quality tinyint NOT NULL
QualityDetail int NULL
OPCQuality int NULL
wwTagKey int NOT NULL
wwRowCount int NULL
wwResolution int NULL
wwEdgeDetection nvarchar(20) NULL
wwRetrievalMode nvarchar(20) NULL
wwTimeDeadband int NULL
wwTimeZone nvarchar(50) NULL
wwVersion nvarchar(30) NULL
wwCycleCount int NULL
wwTimeStampRule nvarchar(20) NULL
wwParameters nvarchar(128) NULL

IndustrialSQL Server Historian Database Reference


198 Chapter 6

DiscreteLive (INSQL.Runtime.dbo.DiscreteLive)
This table has been superceded by the Live table. For descriptions of columns
in this table, see "Live (INSQL.Runtime.dbo.Live)" on page 50.

Column Data type


DateTime datetime NOT NULL
TagName nvarchar(256) NOT NULL
Value float(8) NULL
Quality tinyint NOT NULL
QualityDetail int NULL
OPCQuality int NULL
wwTagKey int NOT NULL
wwRetrievalMode nvarchar(20) NULL
wwTimeDeadband int NULL
wwTimeZone nvarchar(50) NULL
wwParameters nvarchar(128) NULL

DiscreteWideHistory
This table has been superceded by the WideHistory_OLEDB table. In a query,
this table must be referenced using an OPENQUERY statement. For
descriptions of columns in this table, see "WideHistory
(INSQL.Runtime.dbo.WideHistory)" on page 77.

Column Data type


DateTime datetime NOT NULL
TagD1 tinyint NULL
TagD2 tinyint NULL
ManyOtherTags tinyint NULL
wwRowCount int NULL
wwResolution int NULL
wwEdgeDetection nvarchar(20) NULL
wwRetrievalMode nvarchar(20) NULL
wwTimeDeadband int NULL
wwTimeZone nvarchar(50) NULL
wwVersion nvarchar(30) NULL
wwCycleCount int NULL
wwTimeStampRule nvarchar(20) NULL
wwParameters nvarchar(128) NULL

IndustrialSQL Server Historian Database Reference


Backward Compatibility Entities 199

GroupTagList
Contains one row for each defined group of tags.

Column Data type Description


(FK) GroupID int NOT NULL The identifier for a group of tags.
(FK) wwDomainTagKey int NOT NULL The unique numerical identifier for a tag in
a specific domain.
Triggerval float(8) NULL A value that can be read by an application
as a trigger value.

ManualAnalogHistory
This table can be used by custom client applications to store values for analog
tags. By default, this table is empty. If written to by a client application, this
table will contain one row for each defined analog tag per sample period.
ManualAnalogHistory is a normal SQL Server table and does not support any
of the Industrial SQL Server extensions for handling data.

Column Data type Description


DateTime datetime NOT NULL The timestamp reflecting when the data
was acquired or stored.
(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system.
Value float(8) NULL The value of the tag at the timestamp.
Measured in engineering units.
Quality tinyint NOT NULL The basic data quality indicator associated
with the data value.
QualityDetail int NULL An internal representation of data quality.
wwTagKey int NOT NULL The unique numerical identifier for the tag
within a single IndustrialSQL Server.

ManualDiscreteHistory
This table can be used by custom client applications to store values for discrete
tags. By default, this table is empty. If written to by a client application, this
table will contain one row for each defined discrete tag per sample period.
ManualDiscreteHistory is a normal SQL Server table and does not support any
of the Industrial SQL Server extensions for handling data.

Column Data type Description


DateTime datetime NOT NULL The timestamp reflecting when the data
was acquired or stored.
(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system.
Value tinyint NULL The value of the discrete tag at timestamp.
0 = FALSE; 1 = TRUE; NULL = No data.

IndustrialSQL Server Historian Database Reference


200 Chapter 6

Column Data type Description


Quality tinyint NOT NULL The basic data quality indicator associated
with the data value.
QualityDetail int NULL An internal representation of data quality.
wwTagKey int NOT NULL The unique numerical identifier for the tag
within a single IndustrialSQL Server.

ManualStringHistory
This table can be used by custom client applications to store values for string
tags. By default, this table is empty. If written to by a client application, this
table will contain one row for each defined string tag per sample period.
ManualStringHistory is a normal SQL Server table and does not support any of
the Industrial SQL Server extensions for handling data.

Note Data that was stored in the StringHistory table prior to the
IndustrialSQL Server 8.0 historian will be automatically migrated into this
table during IndustrialSQL Server 8.0 (or later) historian installation.

Column Data type Description


DateTime datetime NOT NULL The timestamp reflecting when the data
was acquired or stored.
(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system.
Value nvarchar(512) NULL The value of the string tag at the
timestamp.
Quality tinyint NOT NULL The basic data quality indicator associated
with the data value.
QualityDetail int NULL An internal representation of data quality.
wwTagKey int NOT NULL The unique numerical identifier for the tag
within a single IndustrialSQL Server.

IndustrialSQL Server Historian Database Reference


Backward Compatibility Entities 201

NameSpaceIcons
Contains one row for each defined namespace icon. Namespace icons can be
shown in an application browser for each level of the namespace (system,
public, and private).

Column Data type Description


Type int NOT NULL The value that specifies the type of
namespace. 1 to 6 = Tag; 1 to 2 million =
System; 2+ million = Groups. Within the
system range, the following values
designate ArchestrA object types: 1999023
= Galaxy; 1999001 = WinPlatform object;
1999003 = AppEngine object; 1999013 =
Area object; 1999011 =
DDESuiteLinkClient, OPCClient, and
InTouchProxy objects; 1999024 =
RedundantDIObject object; 1999033 =
Undeployed object represented by a
generic name; 1999901 =
ApplicationObject; 1999902 = Traceability
object.
Icon image NULL The icon for the namespace.
Name nvarchar(30) NOT NULL The name of the icon.
Description nvarchar(50) NULL The description of the icon.

StringHistory (INSQL.Runtime.dbo.StringHistory)
This table has been superceded by the History table. For descriptions of
columns in this table, see "HistorianSysObjects" on page 38.

Column Data type


DateTime datetime NOT NULL
TagName nvarchar(256) NOT NULL
Value nvarchar(512) NULL
Quality tinyint NOT NULL
QualityDetail int NULL
OPCQuality int NULL
wwTagKey int NOT NULL
wwRowCount int NULL
wwResolution int NULL
wwEdgeDetection nvarchar(20) NULL
wwRetrievalMode nvarchar(20) NULL
wwTimeDeadband int NULL
wwTimeZone nvarchar(50) NULL
wwVersion nvarchar(30) NULL

IndustrialSQL Server Historian Database Reference


202 Chapter 6

Column Data type


wwCycleCount int NULL
wwTimeStampRule nvarchar(20) NULL
wwParameters nvarchar(128) NULL

StringLive (INSQL.Runtime.dbo.StringLive)
This table has been superceded by the Live table. For descriptions of columns
in this table, see "Live (INSQL.Runtime.dbo.Live)" on page 50.

Column Data type


DateTime datetime NOT NULL
TagName nvarchar(256) NOT NULL
Value nvarchar(512) NULL
Quality tinyint NOT NULL
QualityDetail int NULL
OPCQuality int NULL
wwTagKey int NOT NULL
wwRetrievalMode nvarchar(20) NULL
wwTimeDeadband int NULL
wwTimeZone nvarchar(50) NULL
wwParameters nvarchar(128) NULL

StringWideHistory
This table was implemented for completeness. However, you should use the
WideHistory table instead of this table. In a query, this table must be
referenced using an OPENQUERY statement. For descriptions of columns in
this table, see "WideHistory (INSQL.Runtime.dbo.WideHistory)" on page 77.

Column Data type


DateTime datetime NOT NULL
TagS1 nvarchar(512) NULL
TagS2 nvarchar(512) NULL
ManyOtherTags nvarchar(512) NULL
wwRowCount int NULL
wwResolution int NULL
wwEdgeDetection nvarchar(20) NULL
wwRetrievalMode nvarchar(20) NULL
wwTimeDeadband int NULL
wwTimeZone nvarchar(50) NULL
wwVersion nvarchar(30) NULL

IndustrialSQL Server Historian Database Reference


Backward Compatibility Entities 203

Column Data type


wwCycleCount int NULL
wwTimeStampRule nvarchar(20) NULL
wwParameters nvarchar(128) NULL

TagGroup
Contains one row for each defined tag group. A tag group is a simple, non-
hierarchical grouping of tags that can be used by the system.

Column Data type Description


GroupID int NOT NULL The identifier for a group of tags.
Description nvarchar(50) NULL The description for the group of tags.
CreatedDate datetime NULL The creation date for the tag grouping.
CreatedBy nchar(18) NULL The name of the user or application that
created the group of tags.
Type int NULL The type of tag group. 1 to 100 = System
use. 100 = Users and third-party client
applications.

WideTableDictionary
Contains one row of values for up to 249 tags. These 249 tags appear as
columns that will be visible in the data dictionary for each user. Mainly used by
ad-hoc query tools. Does not affect the ability to access the values stored for a
tag. .

Column Data type Description


(FK) UserKey int NOT NULL The unique numerical identifier for a
database user as defined in the UserDetail
table. UserKey is a foreign key from the
UserDetail table.
(FK) TagName nvarchar(256) NOT NULL The unique name of the tag within the
IndustrialSQL Server system. TagName is
a foreign key from the Tag table.

Renamed Tables
The following table has been renamed. A view named InSQLSysObjects has
been created for backward compatibility.

Old Name New Name


InSQLSysObjects HistorianSysObjects

IndustrialSQL Server Historian Database Reference


204 Chapter 6

Backward Compatibility Stored Procedures


Stored procedures that have been retained for backward compatibility are:
• aaAnalogDetail
• aaDiscreteDetail
• aaStringDetail
• ww_CheckClientVersion
• ww_CheckWhichDb
• ww_dbCheck
• ww_LoadInSQLProcedureBody
• ww_MDASAnalogTagInsert
• ww_MDASAnalogTagUpdate
• ww_MDASDiscreteTagInsert
• ww_MDASDiscreteTagUpdate
• ww_MDASStringTagInsert
• ww_MDASStringTagUpdate

aaAnalogDetail
Returns information about one or more specified analog tags, including the
name of the tag, a description, the acquisition rate, the engineering unit, and
the minimum and maximum values in engineering units.
Syntax
aaAnalogDetail TagList
Arguments
TagList
A list of tags delimited by a comma (,). This value is of data type
nvarchar(4000), with no default.
Permission
Execute permission defaults to the public group.
See Also
aaDiscreteDetail
aaStringDetail

aaDiscreteDetail
Returns information about one or more specified discrete tags, including the
name of the tag, a description, the message for the TRUE (1) state of the tag,
and the message for the FALSE (0) state of the tag.
Syntax
aaDescreteDetail TagList

IndustrialSQL Server Historian Database Reference


Backward Compatibility Entities 205

Arguments
TagList
A list of tags delimited by a comma (,). This value is of data type
nvarchar(4000), with no default.
Permission
Execute permission defaults to the public group.
See Also
aaAnalogDetail
aaStringDetail

aaStringDetail
Returns a description for one or more specified tags.
Syntax
aaStringDetail TagList
Arguments
TagList
A list of tags delimited by a comma (,). This value is of data type
nvarchar(4000), with no default.
Permission
Execute permission defaults to the public group.
See Also
aaAnalogDetail
aaDiscreteDetail

ww_CheckClientVersion
Checks which version of the client application is running.
Syntax
ww_CheckClientVersion AppName, AppVersion
Arguments
AppName
The name of the application. This value is of data type nvarchar(255), with
a default of an empty string.
AppVersion
The version number of the application. This value is of data type
nvarchar(255), with a default of an empty string.
Remarks
This stored procedure is used by the IndustrialSQL Server historian to ensure
that a version of a Wonderware client application will run against the database.
A client application will not be allowed to run against a database version that
doesn't support that client.

IndustrialSQL Server Historian Database Reference


206 Chapter 6

Important! This stored procedure is for Wonderware use only. Do not


attempt to use this stored procedure for any third-party client application.

Permission
Execute permission defaults to the public group.
See Also
ww_CheckWhichDb

ww_CheckWhichDb
Used to determine if querying the correct database.
Syntax
ww_CheckWhichDb dbType
Arguments
dbType
The identifier for the database. 1 = Runtime; 2 = Holding; 3 =
Development. This value is of data type int, with no default.
Permission
Execute permission defaults to the public group.
See Also
ww_CheckClientVersion

ww_dbCheck
Used to invalidate FactorySuite 1000 clients.
Syntax
ww_dbCheck dbType
Arguments
dbType
The identifier for the database. 1 = Runtime; 2 = Holding; 3 =
Development. This value is of data type int, with no default.
Remarks
This stored procedure is only used by client applications released prior to
FactorySuite 2000.
Permission
Execute permission defaults to the public group.

ww_DBConfig
Returns a summary of the current database configuration, such as number of
tags, number of tags per type, storage configuration, event tags, summary
configuration, and so on.

IndustrialSQL Server Historian Database Reference


Backward Compatibility Entities 207

Syntax
ww_DBConfig
Permission
Execute permission defaults to the public group.

ww_LoadInSQLProcedureBody
Used internally to track which stored procedures reference the extension
tables.
Syntax
ww_LoadSQLProcedureBody ObjName
Arguments
ObjName
The name of the stored procedure to load. This value is of data type
varchar(92), with no default.
Permission
Execute permission defaults to the public group.

ww_MDASAnalogTagInsert
Used by the Manual Data Acquisition Service to add an analog tag.
This stored procedure calls the aaInternalMDASAnalogTagInsert stored
procedure, which is for internal use only.
See Also
ww_MDASAnalogTagUpdate
ww_MDASDiscreteTagInsert
ww_MDASDiscreteTagUpdate
ww_MDASStringTagInsert
ww_MDASStringTagUpdate

ww_MDASAnalogTagUpdate
Used by the Manual Data Acquisition Service to update an analog tag.
This stored procedure calls the aaInternalMDASAnalogTagUpdate stored
procedure, which is for internal use only.

IndustrialSQL Server Historian Database Reference


208 Chapter 6

See Also
Stored Procedures for Internal Use
ww_MDASAnalogTagInsert
ww_MDASDiscreteTagInsert
ww_MDASDiscreteTagUpdate
ww_MDASStringTagInsert
ww_MDASStringTagUpdate

ww_MDASDiscreteTagInsert
Used by the Manual Data Acquisition Service to add a discrete tag.
This stored procedure calls the aaInternalMDASDiscreteTagInsert stored
procedure, which is for internal use only.
See Also
Stored Procedures for Internal Use
ww_MDASAnalogTagInsert
ww_MDASAnalogTagUpdate
ww_MDASDiscreteTagUpdate
ww_MDASStringTagInsert
ww_MDASStringTagUpdate

ww_MDASDiscreteTagUpdate
Used by the Manual Data Acquisition Service to update a discrete tag.
This stored procedure calls the aaInternalMDASDiscreteTagUpdate stored
procedure, which is for internal use only.
See Also
Stored Procedures for Internal Use
ww_MDASAnalogTagInsert
ww_MDASAnalogTagUpdate
ww_MDASDiscreteTagInsert
ww_MDASStringTagInsert
ww_MDASStringTagUpdate

ww_MDASStringTagInsert
Used by the Manual Data Acquisition Service to add a string tag.
This stored procedure calls the aaInternalMDASStringTagInsert stored
procedure, which is for internal use only.

IndustrialSQL Server Historian Database Reference


Backward Compatibility Entities 209

See Also
Stored Procedures for Internal Use
ww_MDASAnalogTagInsert
ww_MDASAnalogTagUpdate
ww_MDASDiscreteTagInsert
ww_MDASDiscreteTagUpdate
ww_MDASStringTagUpdate

ww_MDASStringTagUpdate
Used by the Manual Data Acquisition Service to update a string tag.
This stored procedure calls the aaInternalMDASStringTagUpdate stored
procedure, which is for internal use only.
See Also
Stored Procedures for Internal Use
ww_MDASAnalogTagInsert
ww_MDASAnalogTagUpdate
ww_MDASDiscreteTagInsert
ww_MDASDiscreteTagUpdate
ww_MDASStringTagInsert

Renamed Stored Procedures


The following stored procedures have been renamed. The old stored
procedures have been retained in the system for backward compatibility.

Old Name New Name


ww_ActionStringSelect aaActionStringSelect
ww_AddTag aaAddTag
ww_AnalogDetail aaAnalogDetail
ww_AnalogTagDelete aaAnalogTagDelete
ww_AnalogTagInsert aaAnalogTagInsert
ww_AnalogTagSelect aaAnalogTagSelect
ww_AnalogTagUpdate aaAnalogTagUpdate
ww_Annotation aaAnnotationRetrieve
ww_AnnotationDelete aaAnnotationDelete
ww_AnnotationInsert aaAnnotationInsert
ww_AnnotationSelect aaAnnotationSelect
ww_AnnotationUpdate aaAnnotationUpdate
ww_CheckClientVersion --
ww_CheckWhichDb --
ww_CleanupAfterCommit aaCleanupAfterCommit
ww_CommitChanges aaCommitChanges

IndustrialSQL Server Historian Database Reference


210 Chapter 6

Old Name New Name


ww_CommitChangesAtStartup aaCommitChangesAtStartup
ww_ContextDelete aaContextDelete
ww_ContextInsert aaContextInsert
ww_ContextSelect aaContextSelect
ww_ContextUpdate aaContextUpdate
ww_DBChangesPending aaDBChangesPending
ww_dbCheck --
ww_DBConfig aaDBConfig
ww_DeleteOlderEvents aaDeleteOlderEvents
ww_DeleteOlderSummaries aaDeleteOlderSummaries
ww_DeleteTag aaDeleteTag
ww_DetectorStringSelect aaDetectorStringSelect
ww_DiscreteDetail aaDiscreteDetail
ww_DiscreteTagDelete aaDiscreteTagDelete
ww_DiscreteTagInsert aaDiscreteTagInsert
ww_DiscreteTagSelect aaDiscreteTagSelect
ww_DiscreteTagUpdate aaDiscreteTagUpdate
ww_EngineeringUnitDelete aaEngineeringUnitDelete
ww_EngineeringUnitInsert aaEngineeringUnitInsert
ww_EngineeringUnitSelect aaEngineeringUnitSelect
ww_EngineeringUnitUpdate aaEngineeringUnitUpdate
ww_EventDetection aaEventDetection
ww_EventHistory aaEventHistorySelect
ww_EventHistoryInsert aaEventHistoryInsert
ww_EventSnapshot aaEventSnapshotSelect
ww_EventSnapshotInsert aaEventSnapshotInsert
ww_EventTagDelete aaEventTagDelete
ww_EventTagDetail aaEventTagDetail
ww_EventTagInsert aaEventTagInsert
ww_EventTagSelect aaEventTagSelect
ww_EventTagSelectAll aaEventTagSelectAll
ww_EventTagSelectDeleted aaEventTagSelectDeleted
ww_EventTagSelectDisabled aaEventTagSelectDisabled
ww_EventTagSelectInserted aaEventTagSelectInserted
ww_EventTagSelectUpdated aaEventTagSelectUpdated
ww_EventTagUpdate aaEventTagUpdate
ww_GetDbRevision aaGetDbRevision
ww_GetLastTagKey aaGetLastTagKey
ww_HistoryBlockSelect aaHistoryBlockSelect

IndustrialSQL Server Historian Database Reference


Backward Compatibility Entities 211

Old Name New Name


ww_InSQLConfigNSExpand aaHistorianConfigNSExpand
ww_InSQLNSExpand aaHistorianNSExpand
ww_InSQLStatusSelect aaHistorianStatusSelect
ww_InSQLStatusSet aaHistorianStatusSet
ww_InTouchNodeTagList aaInTouchNodeTagList
ww_IODriverDelete aaIODriverDelete
ww_IODriverInsert aaIODriverInsert
ww_IODriverSelect aaIODriverSelect
ww_IODriverUpdate aaIODriverUpdate
ww_IOServerDelete aaIOServerDelete
ww_IOServerInsert aaIOServerInsert
ww_IOServerSelect aaIOServerSelect
ww_IOServerTypeDelete aaIOServerTypeDelete
ww_IOServerTypeInsert aaIOServerTypeInsert
ww_IOServerTypeSelect aaIOServerTypeSelect
ww_IOServerTypeUpdate aaIOServerTypeUpdate
ww_IOServerUpdate aaIOServerUpdate
ww_LimitDelete aaLimitDelete
ww_LimitInsert aaLimitInsert
ww_LimitNameDelete aaLimitNameDelete
ww_LimitNameInsert aaLimitNameInsert
ww_LimitNameSelect aaLimitNameSelect
ww_LimitNameUpdate aaLimitNameUpdate
ww_LimitSelect aaLimitSelect
ww_LimitUpdate aaLimitUpdate
ww_LoadInSQLProcedureBody --
ww_MessageDelete aaMessageDelete
ww_MessageInsert aaMessageInsert
ww_MessageSelect aaMessageSelect
ww_MessageUpdate aaMessageUpdate
ww_ModLogStatus aaModLogStatus
ww_PrivateNSAddGroup aaPrivateNSAddGroup
ww_PrivateNSAddLeaf aaPrivateNSAddLeaf
ww_PrivateNSDeleteGroup aaPrivateNSDeleteGroup
ww_PrivateNSDeleteLeaf aaPrivateNSDeleteLeaf
ww_PrivateNSExpand aaPrivateNSExpand
ww_PrivateNSSelect aaPrivateNSSelect
ww_PrivateNSUpdateGroup aaPrivateNSUpdateGroup
ww_PublicNSAddGroup aaPublicNSAddGroup

IndustrialSQL Server Historian Database Reference


212 Chapter 6

Old Name New Name


ww_PublicNSAddLeaf aaPublicNSAddLeaf
ww_PublicNSDeleteGroup aaPublicNSDeleteGroup
ww_PublicNSDeleteLeaf aaPublicNSDeleteLeaf
ww_PublicNSExpand aaPublicNSExpand
ww_PublicNSSelect aaPublicNSSelect
ww_PublicNSUpdateGroup aaPublicNSUpdateGroup
ww_RedirectToInTouch aaRedirectToInTouch
ww_SetAISamples aaSetAISamples
ww_SetCalculatedAISamples aaSetCalculatedAISamples
ww_SetStorageRule aaSetStorageRule
ww_SetTagStorage aaSetTagStorage
ww_SnapshotDetailSelect aaSnapshotDetailSelect
ww_SnapshotDetailUpdate aaSnapshotDetailUpdate
ww_SnapToSummary aaSnapToSummary
ww_SpaceManager aaSpaceManager
ww_StorageLocationSelect aaStorageLocationSelect
ww_StorageLocationUpdate aaStorageLocationUpdate
ww_StringDetail aaStringDetail
ww_StringTagDelete aaStringTagDelete
ww_StringTagInsert aaStringTagInsert
ww_StringTagSelect aaStringTagSelect
ww_StringTagUpdate aaStringTagUpdate
ww_SummaryActionInsert aaSummaryActionInsert
ww_SummaryDetail aaSummaryDetail
ww_SummaryOperationDelete aaSummaryOperationDelete
ww_SummaryOperationInsert aaSummaryOperationInsert
ww_SummaryOperationSelect aaSummaryOperationSelect
ww_SummaryOperationUpdate aaSummaryOperationUpdate
ww_SummaryTagListDelete aaSummaryTagListDelete
ww_SummaryTagListInsert aaSummaryTagListInsert
ww_SummaryTagListSelect aaSummaryTagListSelect
ww_SummaryTagListUpdate aaSummaryTagListUpdate
ww_SystemConfigNSExpand aaSystemConfigNSExpand
ww_SystemNSExpand aaSystemNSExpand
ww_SystemNSExpand2 aaSystemNSExpand2
ww_SystemParameterSelect aaSystemParameterSelect
ww_SystemParameterUpdate aaSystemParameterUpdate
ww_TagConfig aaTagConfig
ww_TagConfigModified aaTagConfigModified

IndustrialSQL Server Historian Database Reference


Backward Compatibility Entities 213

Old Name New Name


ww_TagConfigSelect aaTagConfigSelect
ww_TagInfo aaTagInfo
ww_TagType aaTagType
ww_TimeDetectorDetailInsert aaTimeDetectorDetailInsert
ww_TimeDetectorDetailSelect aaTimeDetectorDetailSelect
ww_TimeDetectorDetailUpdate aaTimeDetectorDetailUpdate
ww_TopicDelete aaTopicDelete
ww_TopicInsert aaTopicInsert
ww_TopicSelect aaTopicSelect
ww_TopicUpdate aaTopicUpdate
ww_UpdateCalculatedAISamples aaUpdateCalculatedAISamples
ww_UserAccessLevelSelect aaUserAccessLevelSelect
ww_UserDetailUpdate aaUserDetailUpdate

Backward Compatibility Functions


The following functions have been renamed. The old functions have been
retained in the system for backward compatibility.

Old Name New Name


fww_CheckLicenseViolation faaCheckLicenseViolation
fww_GetLocalizedText faaGetLocalizedText
fww_InSQLgetdate faaTZgetdate
fww_LicensedTagDetails faaLicensedTagDetails
fww_LicensedTagTotal faaLicensedTagTotal
fww_TagsInLicenseViolation faaTagsInLicenseViolation

IndustrialSQL Server Historian Database Reference


214 Chapter 6

IndustrialSQL Server Historian Database Reference


Index 215

Index
A aaHistorianStatusSelect stored procedure 121
aaHistorianStatusSet stored procedure 122
aaActionStringSelect stored procedure 89 aaHistoryBlockSelect stored procedure 123
aaAddTag stored procedure 90 aaInTouchNodeTagList stored procedure 123
aaAnalogDetail stored procedure 204 aaIODriverDelete stored procedure 124
aaAnalogTagDelete stored procedure 92 aaIODriverInsert stored procedure 124
aaAnalogTagInsert stored procedure 92 aaIODriverSelect stored procedure 126
aaAnalogTagSelect stored procedure 96 aaIODriverUpdate stored procedure 126
aaAnalogTagUpdate stored procedure 96 aaIOServerDelete stored procedure 127
aaAnnotationDelete stored procedure 97 aaIOServerInsert stored procedure 127
aaAnnotationInsert stored procedure 97 aaIOServerSelect stored procedure 129
aaAnnotationRetrieve stored procedure 98 aaIOServerTypeDelete stored procedure 129
aaAnnotationSelect stored procedure 99 aaIOServerTypeInsert stored procedure 130
aaAnnotationUpdate stored procedure 99 aaIOServerTypeSelect stored procedure 130
aaArchestrANSClear stored procedure 99 aaIOServerTypeUpdate stored procedure 131
aaAreaData table 19, 21 aaIOServerUpdate stored procedure 131
aaAreaXML table 19, 22 aaLimitDelete stored procedure 132
aaAttributeData table 19, 22 aaLimitInsert stored procedure 132
aaAttributeDataPending table 19, 23 aaLimitNameDelete stored procedure 133
aaCleanUpAfterCommit stored procedure 100 aaLimitNameInsert stored procedure 133
aaCleanupSystemNotRunning stored procedure 100 aaLimitNameSelect stored procedure 134
aaCommitChanges stored procedure 100 aaLimitNameUpdate stored procedure 134
aaCommitChangesAtStartup stored procedure 101 aaLimitSelect stored procedure 135
aaContextDelete stored procedure 101 aaLimitUpdate stored procedure 135
aaContextInsert stored procedure 102 aaMessageDelete stored procedure 135
aaContextSelect stored procedure 102 aaMessageInsert stored procedure 136
aaContextUpdate stored procedure 103 aaMessageSelect stored procedure 136
aaDBChangesPending stored procedure 103 aaMessageUpdate stored procedure 137
aaDBConfig stored procedure 103 aaModLogStatus stored procedure 137
aaDeleteOlderEvents stored procedure 104 aaObjectData column 23
aaDeleteOlderSummaries stored procedure 104 aaObjectData table 19
aaDeleteTag stored procedure 104 aaObjectDataPending table 19, 24
aaDetectorStringSelect stored procedure 105 aaPrivateNSAddGroup stored procedure 138
aaDiscreteDetail stored procedure 204 aaPrivateNSAddLeaf stored procedure 138
aaDiscreteTagDelete stored procedure 105 aaPrivateNSDeleteGroup stored procedure 139
aaDiscreteTagInsert stored procedure 105 aaPrivateNSDeleteLeaf stored procedure 139
aaDiscreteTagSelect stored procedure 108 aaPrivateNSExpand stored procedure 139
aaDiscreteTagUpdate stored procedure 108 aaPrivateNSSelect stored procedure 140
aaEngineeringUnitDelete stored procedure 109 aaPrivateNSUpdateGroup stored procedure 140
aaEngineeringUnitInsert stored procedure 109 aaPublicNSAddGroup stored procedure 141
aaEngineeringUnitSelect stored procedure 110 aaPublicNSAddLeaf stored procedure 141
aaEngineeringUnitUpdate stored procedure 111 aaPublicNSDeleteGroup stored procedure 142
aaEventDetection stored procedure 111 aaPublicNSDeleteLeaf stored procedure 142
aaEventHistoryInsert stored procedure 112 aaPublicNSExpand stored procedure 143
aaEventHistorySelect table 113 aaPublicNSSelect stored procedure 143
aaEventSnapshot stored procedure 114 aaPublicNSUpdateGroup stored procedure 143
aaEventSnapshotInsert stored procedure 113 aaRedirectToInTouch stored procedure 144
aaEventTagDelete stored procedure 114 aaSetAISamples stored procedure 145
aaEventTagDetail stored procedure 115 aaSetCalculatedAISamples stored procedure 145
aaEventTagInsert stored procedure 115 aaSetServerTimeStamp stored procedure 146
aaEventTagSelect stored procedure 118 aaSetStorageRule stored procedure 146
aaEventTagSelectAll stored procedure 118 aaSetTagStorage stored procedure 148
aaEventTagSelectDeleted stored procedure 118 aaSnapshotDetailSelect stored procedure 149
aaEventTagSelectDisabled stored procedure 119 aaSnapshotDetailUpdate stored procedure 149
aaEventTagSelectInserted stored procedure 119 aaSnapToSummary stored procedure 150
aaEventTagSelectUpdated stored procedure 119 aaSpaceManager stored procedure 150
aaEventTagUpdate stored procedure 119 aaStorageLocationSelect stored procedure 151
aaGetDbRevision stored procedure 120 aaStorageLocationUpdate stored procedure 151
aaGetLastTagKey stored procedure 120 aaStringDetail stored procedure 205
aaHistorianConfigNSExpand stored procedure 121 aaStringTagDelete stored procedure 152
aaHistorianNSExpand stored procedure 121 aaStringTagInsert stored procedure 153

IndustrialSQL Server Historian Database Reference


216 Index

aaStringTagSelect stored procedure 155 deleting 92


aaStringTagUpdate stored procedure 155 inserting 92, 207
aaSummaryActionInsert stored procedure 156 selecting 96
aaSummaryDetail stored procedure 156 updating 96, 207
aaSummaryOperationDelete stored procedure 157 AnalogHistory table 172, 194
aaSummaryOperationInsert stored procedure 158 AnalogHistory view 189
aaSummaryOperationSelect stored procedure 158 AnalogLive table 195
aaSummaryOperationUpdate stored procedure 159 AnalogLive view 189
aaSummaryTagListDelete stored procedure 159 AnalogSnapshot table 17, 25
aaSummaryTagListInsert stored procedure 160 AnalogTag table 18, 25
aaSummaryTagListSelect stored procedure 161 AnalogWideHistory table 172, 195
aaSummaryTagListUpdate stored procedure 161 Annotation table 18, 27
aaSystemConfigNSExpand stored procedure 162 AnnotationKey argument 97, 99
aaSystemNSExpand stored procedure 162 AnnotationKey column 27
aaSystemNSExpand2 stored procedure 163 annotations 27
aaSystemParameterSelect stored procedure 163 deleting 97
aaSystemParameterUpdate stored procedure 164 inserting 97
aaTagConfig stored procedure 164 retrieving 98
aaTagConfigModified stored procedure 164 selecting 99
aaTagConfigSelect stored procedure 165 updating 99
aaTagInfo stored procedure 165 application name
aaTagName column 23, 24 I/O Server 47, 48, 128, 129, 130
aaTagType stored procedure 166 ApplicationName argument 128, 129, 130
aaTimeDetectorDetailInsert stored procedure 166 ApplicationName column 43, 47, 48, 76
aaTimeDetectorDetailSelect stored procedure 167 AppName argument 205
aaTimeDetectorDetailUpdate stored procedure 167 AppVersion argument 205
aaTopicDelete stored procedure 168 ArchestrA
aaTopicInsert stored procedure 168 browsing tables 19
aaTopicSelect stored procedure 169 ArchiveDate column 42
aaTopicUpdate stored procedure 170 ArchiveLocation column 42
aaUpdateCalculatedAISamples stored procedure 170 area 22
aaUserAccessLevelSelect stored procedure 171 AreaKey column 22
aaUserDetailUpdate stored procedure 171 AreaName column 22
access level 171 AreaXML column 22
AccessLevel column 77 attribute
AcqType argument 147 data 23
acquisition 70, 90, 92, 106, 153 AttributeName column 22, 23
Acquisition argument 122 autonomous startup 46, 125
AcquisitionRate column 70 AutonomousStartupTimeout argument 125
AcquisitionType argument 92, 106, 153 AutonomousStartupTimeout column 46
AcquisitionType column 70 AutoStart argument 128
action priority 37, 117 AutoStart column 48
action scripts 36, 117
action string 89 B
ActionClassName column 24
actions backward compatibility
See also event actions database entities 189
ActionString argument 117 stored procedures 204
ActionString column 36 tables 193
ActionType table 17, 24 blocks
ActionTypeKey argument 117 See history blocks
ActionTypeKey column 24, 35 BufferCount argument 125
active image 71, 72, 95, 107, 145, 154, 170 BufferCount column 46
setting samples for 145 buffers
address string 70, 91, 93, 106, 153 IDAS 46, 125
AIRetrievalMode argument 95, 107
AIRetrievalMode column 71 C
alarm 31
AllowCommit argument 179 CalcType argument 158
AltComputerName argument 125, 128 CalcType column 28, 67, 87
AltComputerName column 45, 48 CalcType table 17, 28
AlwaysAdvise column 76 CalculatedAISamples column 72
AlwaysModifyName column 43 calculation 28, 67, 87, 158
analog tags Category column 22

IndustrialSQL Server Historian Database Reference


Index 217

CEVersion column 72 database user 53, 77, 86, 188


characters date expression
limit for string tags 65, 154 extended stored procedures 177
Checked argument 133 DateCreated argument 93, 98, 106, 116, 154
Checked column 49, 57 DateCreated column 27, 70
Column column 85 DateStamp argument 150
ColumnName column 52 DateTime argument 98, 112
Comment column 44 DateTime column 27, 34, 35, 38, 50, 53, 59, 78, 85,
complex tags 196 193, 194, 195, 196, 197, 198, 199, 200, 201, 202
ComplexHistory table 196 daylight savings time 40, 43, 51, 61, 74, 79
ComplexTag table 196 DbError column 64
Compression column 42 DbModAcquisition column 64
ComputerName argument 124, 128 DbModAll column 64
ComputerName column 45, 48, 57, 63 DbModServer column 64
ConfigStatusPending table 19, 28 DbModStorage column 64
ConfigStatusSnapshot table 19, 29 DbRevision column 64
ConfigStor column 55, 56 DBServer argument 122
configuration DbStatus argument 122
See also dynamic configuration DbStatus column 64
configuration tables DBType argument 147
about 19 dbType argument 206
ConnectionTimeout argument 126 DDE access name 76
ConnectionTimeout column 47 DdeSourceKey column 76
ContainedName column 22, 23, 24 deadband 26, 39, 40, 60, 70, 76, 79, 91, 93, 94, 106,
Content argument 98 116, 147, 153, 176
Content column 27, 196 for events 36
Context table 18, 29 storage 72, 95, 108, 147, 155, 175
ContextKey argument 101, 102, 103, 132 swinging door 26, 95, 147
ContextKey column 29, 30, 49, 57 time 70, 91, 93, 106, 116, 147, 153, 176
contexts 29, 102 value 26, 94, 147, 176
deleting 101 Deadband column 31
inserting 102 DeadbandType argument 95, 108, 155
selecting 102 DeadbandType column 72, 76
updating 103 DefaultStorageRate column 76
counter 27, 95 DefaultStorageType column 76
CreatedBy argument 93, 106, 115, 154 DefaultTagRate argument 110
CreatedBy column 70, 203 DefaultTagRate column 33
CreatedDate column 203 Description argument 92, 102, 106, 115, 128, 130,
current values 50 133, 153, 158, 160, 164, 177
CurrentEditor argument 93, 107, 116, 154 Description column 24, 28, 29, 30, 42, 43, 48, 49, 54,
CurrentEditor column 71 57, 59, 63, 67, 69, 70, 74, 191, 201, 203
cycle count 40, 61, 80 DetectDateTime argument 112
DetectDateTime column 35
D detection time 35, 84, 85, 86, 112
DetectionTime column 84, 85, 86
data acquisition detector scripts 36, 117
See acquisition detector string
data blocks selecting 105
See history blocks DetectorClassName column 30
data dictionary 43, 44 detectors
data files See event detectors
See history blocks DetectorString argument 117
data quality 25, 32, 38, 50, 65, 66, 84, 85, 87, 191, DetectorString column 36
196, 199, 200 DetectorType table 17, 30
See also quality DetectorTypeKey argument 117
data retrieval DetectorTypeKey column 30, 35
See retrieval DetectValue argument 111
data storage deviation 29, 30, 31
Deviation table 18, 30
See storage
discrete tags 31, 32
database
deleting 105
revision number 120
inserting 105, 208
database configuration
selecting 108
returning summary 103, 206
updating 108, 208
database modifications 28

IndustrialSQL Server Historian Database Reference


218 Index

DiscreteHistory table 173, 197 about 17


DiscreteHistory view 190 event tags 35, 37
DiscreteLive table 198 deleting 114
DiscreteLive view 190 inserting 115
DiscreteSnapshot table 17, 31 returning details for 115
DiscreteTag table 18, 32 selecting 118
DiscreteWideHistory table 173, 198 updating 119
disk space EventArchived column 42
event history 150 EventHistory table 17, 34
document conventions 12 EventLogKey argument 113
documentation set 11 EventLogKey column 25, 31, 34, 65
double-byte 65, 154 events 34
DoubleByte argument 154 See also event actions, event detectors,
DoubleByte column 65 summaries
DuplicateChar column 43 EventTag column 87
Duration argument 158 EventTag table 17, 18, 35
Duration column 68, 87 EventTagName argument 114, 156, 159
dynamic configuration EventTagName column 59
committing changes 100, 101, 179 EventTagPendingDelete table 17, 37
DynDailyAvg view 190 EventTime argument 113
DynDailySum view 190 EventTime column 84, 86
DynHourlyAvg view 190 ExecutionMode column 30
DynHourlyMax view 190 ExeName argument 130
DynHourlyMin view 190 ExeName column 49
DynHourlySum view 190 ExeType argument 128
ExeType column 48
E extended stored procedures
about 171
Edge argument 111, 112, 117 history 172
Edge column 35, 37, 84, 85, 86 retrieving list 174
edge detection 35, 37, 39, 78, 84, 85, 86, 111, 112, system 178
117 utility 173
Editable column 69, 191 extension tables 13
EditorClassName column 24, 30 views for 83
Enabled argument 125
Enabled column 46 F
End argument 150
EndTime argument 98, 112, 113, 114, 157, 176 faaCheckLicenseViolation function 183
engineering units 25, 32, 40, 60, 79, 93 faaContainedName function 184
deleting 109 faaGetLocalizedText function 184
inserting 109 faaLicensedTagDetails function 184
selecting 110 faaLicensedTagTotal function 185
updating 111 faaObjectTagName function 186
EngineeringUnit table 18, 32 faaTagsInLicenseViolation function 186
EnumeratedTag table 33 faaTZgetdate function 187
EnumerationType table 33 faaUser_ID function 188
error messages 34, 51, 193 FALSE 52, 136
See also system messages FileChunkSize argument 125
ErrorCode column 34 FileChunkSize column 47
ErrorLog table 19, 34 FileName column 34, 193
EUKey argument 93, 109, 110, 111 FilterStr argument 140, 143, 162, 163
EUKey column 25, 32 FixedStorageRate column 44
event FKey argument 162
SQL scripts 59 ForwardingDelay argument 126
event actions 24 ForwardingDelay column 47
snapshot 58 frequency 37, 68, 73, 166
Event column 84, 86 Frequency column 37, 68
event detection 111 Frequency table 17, 37
event detectors 30 FrequencyID argument 166
event history 112, 113 FrequencyID column 37, 73
deleting events 104 FromDate argument 123
deleting summaries 104 FromDate column 42
managing 150 function 183
event tables fww_CheckLicenseViolation function 213

IndustrialSQL Server Historian Database Reference


Index 219

fww_GetLocalizedText function 213 Import column 76


fww_InSQLgetdate function 213 ImportAllTags column 44
fww_LicensedTagDetails function 213 importing
fww_LicensedTagTotal function 213 data dictionary 43
fww_TagsInLicenseViolation function 213 InTouch node 44, 76
ImportMemoryTags column 44
G ImportPlantTags column 44
ImportRoute column 44
gid column 77 ImportSystemTags column 44
GroupID column 199, 203 IndustrialSQL Server
grouping tables documentation set 11
about 18 InInSQL column 44
GroupTagList table 199 InitializationStatus argument 128
InitializationStatus column 48
H InitialValue argument 94, 107, 154
InitialValue column 26, 32, 65, 196
HistorianSysObjects table 18 InSQLSysObjects table 43, 203
history 59, 77 IntegerSize argument 94
history blocks 13, 42 IntegerSize column 26
archiving 174 integral divisor 33, 110
creating 174 IntegralDivisor argument 110
rescanning 175 IntegralDivisor column 33
selecting 123 interpolation 27, 41, 80, 95
history data InterpolationType argument 95
extended stored procedures 172 InterpolationType column 27
History table 14, 38 InTouch integration tables
format 14 about 17
history tables 13 InTouch nodes 43, 44
History view 83 redirecting data acquisition to 144
HistoryArchived column 42 tag list 123
HistoryBlock table 14, 42 InTouchNode table 17, 43
HistoryBlock view 83 InTouchNodeKey argument 144
Host column 34, 193 InTouchSpecific table 17, 44
IODriver table 19, 45
I IODriverKey argument 124, 126, 127, 128
IODriverKey column 45, 47, 77
I/O Server types 48 IOServer table 19, 47
deleting 129 IOServerKey argument 94, 107, 127, 129, 131, 144,
inserting 130 154, 168
selecting 130 IOServerKey column 47, 69, 75
I/O Servers 47 IOServerType table 19, 48
data processing 75, 147, 169 ItemName argument 93, 106, 153
data processing interval 75, 148, 169 ItemName column 70
deleting 127
failover 48, 128 K
inserting 127
selecting 129 Key argument 146, 165
updating 131
Icon column 201 L
ID column 28
id column 38, 53, 192 LanguageID column 51
IDASs 45 late data 75, 147, 148, 169
autonomous startup timeout 46, 125 LateData argument 147, 169
buffers 46, 125 LateData column 75
connection timeout 47, 126 licensing 183, 184, 185, 186
deleting 124 limit 29, 49
failover 45, 125 for summaries 68, 160
inserting 124 limit names 50, 134
primary 45, 125 deleting 133
selecting 126 inserting 133
updating 126 selecting 134
IdleDuration argument 147, 169 updating 134
IdleDuration column 75 Limit table 18, 49
ImageTime argument 149 limit type 49, 132
ImageTime column 58

IndustrialSQL Server Historian Database Reference


220 Index

LimitName table 18, 50 MessageKey column 32, 52


LimitNameKey argument 132, 133, 134 messages
LimitNameKey column 49, 50 error 34, 51, 193
limits 49, 133 status 51
deleting 132 system 193
for a storage location 63, 152 MinEU argument 93
for summaries 69, 160 MinEU column 25
priority 49, 133 MinMBThreshold argument 125, 152
selecting 135 MinMBThreshold column 46, 63
updating 135 minor deviation 31
LimitType argument 132 MinorChecked column 31
LimitType column 49 MinorDeviation column 31
Line column 34, 193 MinorPriority column 31
linear scaling 26, 94 MinRaw argument 94
linked server 190 MinRaw column 25
List argument 148 modification tracking 28, 38, 52, 53, 85, 192
Live table 14, 50 returning list 103
format 16 status for 137
Live view 83 tables 18
locale ID 51, 184 Modified column 66
localization 51, 184 ModLogColumn table 18, 52
LocalizedText column 51, 193 ModLogTable table 18, 53
LocalizedText table 19, 51, 184 ModTableKey column 52, 53
Logged argument 116 ModType column 53, 85
Logged column 36 ModuleID column 34, 193
LogKey column 66
LowerLimit argument 160 N
LowerLimit column 68
Name argument 134, 138, 140, 141, 144, 163, 164,
M 168
Name column 24, 30, 38, 50, 55, 56, 69, 75, 191,
MachineName column 43 192, 201
major deviation 31 NamedSystemParameter view 191
MajorChecked column 31 NameKey argument 138, 139, 140, 142, 144
MajorDeviation column 31 NameKey column 54, 55, 56, 192
MajorPriority column 31 namespace 54, 55, 56, 201
ManualAnalogHistory table 199 ArchestrA 23
ManualDiscreteHistory table 199 tables 18
ManualStringHistory table 200 NameSpaceIcons table 201
ManyOtherTags column 60, 78, 195, 198, 202 NewValue column 52, 85
MaxAgeThreshold argument 152 NodeKey argument 123
MaxAgeThreshold column 63 NodeKey column 43, 44, 76
MaxEU argument 93 NumericValue column 191
MaxEU column 25
MaxLength argument 154 O
MaxLength column 65
MaxMBSize argument 152 object 22
MaxMBSize column 63 ArchestrA 24
MaxRaw argument 94 ObjectKey column 22, 23, 24, 29
MaxRaw column 25 ObjName argument 207
MaxRowCount argument 176 Offset column 74
MDAS OldValue column 52, 86
stored procedures 207, 208, 209 OnLine column 42
message pairs 52 OPC 38, 50, 54
deleting 135 OPC quality 41, 54, 61, 81
inserting 136 OPCQuality column 38, 50, 54, 194, 195, 197, 198,
selecting 136 201, 202
updating 137 OPCQualityMap table 19, 54
Message table 18, 52 operating system
Message0 argument 136 for I/O Servers 49, 130
Message0 column 52 OperationEnd column 67
Message1 argument 136 OperationKey argument 157, 159, 160, 161
Message1 column 52 OperationKey column 66, 67, 68
MessageKey argument 107, 136, 137 operations

IndustrialSQL Server Historian Database Reference


Index 221

See summary operations quality detail 56


OperationStart column 67 quality rule 41, 61, 81
Operator argument 111 QualityDetail column 25, 32, 38, 50, 56, 65, 84, 85,
OpKey argument 150 87, 194, 195, 196, 197, 198, 199, 200, 201, 202
OrderBy argument 114, 157 QualityMap table 19, 56
OriginalName column 44 QualityString column 56

P R
parameter 69 rate of change 29, 57
Parameter column 34, 193 RateDB argument 147
ParentKey argument 138, 141 RateDeadband argument 95
ParentKey column 22, 23, 24, 55, 56, 192 RateDeadband column 26, 77
Path argument 128, 152 RateOfChange table 18, 57
Path column 43, 47, 62 raw value 25, 94
PercentGood column 41 RawType argument 94
Periodicity argument 166 RawType column 26
Periodicity column 73 reconfiguration
PKey argument 121, 162, 163 See dynamic configuration
Pkey argument 140, 143 referential integrity 21
PKey column 192 RegistryName column 74
Platform argument 130 remote table 13
Platform column 49 See also extension tables
PostDetectorDelay argument 116 RequestInitialData column 76
PostDetectorDelay column 36 resolution 39, 60, 68, 78, 87, 112, 158, 176
PrefixOrSuffix column 43 Resolution argument 112, 158, 176
Priority argument 117, 133 Resolution column 68, 87
Priority column 37, 49, 57 retrieval cycles 40, 61, 80
private namespaces 18, 54 Retriever column 197
adding a group 138 Revision argument 130
adding a leaf 138 Revision column 49
deleting a group 139 rollover value 27, 95
deleting a leaf 139 RolloverValue argument 95
expanding 139 RolloverValue column 27
selecting object in 140 row count 39, 60, 78
updating a group 140 RowKey column 53, 85
PrivateGroupTag table 18, 54 RunTimeDay argument 167
PrivateNameSpace table 18, 54 RunTimeDay column 74
processing interval 75, 148, 169 RunTimeHour argument 167
ProcessingInterval argument 169 RunTimeHour column 74
ProcessingInterval column 75 RunTimeMin argument 167
ProcInterval argument 148 RunTimeMin column 74
protocols 48, 76, 128
ProtocolType argument 128 S
ProtocolType column 48, 76
Provider column 197 samples
public namespaces 18, 55, 56 active image 145
adding a group 141 Samples argument 145, 170
adding a leaf 141 SamplesInActiveImage argument 95, 107, 154
deleting a group 142 SamplesInActiveImage column 71
deleting a leaf 142 scaling 26, 94
expanding 143 Scaling argument 94
selecting object in 143 Scaling column 26
updating group 143 scan rate
PublicGroupTag table 18, 55 for event tags 35, 116
PublicNameSpace table 18, 56 ScanRate argument 116
ScanRate column 35
Q Script column 59
script template 59
quality 25, 32, 38, 50, 54, 65, 66, 84, 85, 87, 191, security
196, 199, 200 levels 77
percentage 41 Sequence column 42
Quality column 25, 32, 38, 50, 65, 66, 84, 85, 87, server list 57
191, 194, 195, 196, 197, 198, 199, 200, 201, 202 ServerKey argument 138, 142

IndustrialSQL Server Historian Database Reference


222 Index

ServerKey column 57, 73 stored procedures


ServerList table 18, 57 about 89
ServerTimeStamp argument 95, 108, 146, 147, 155 backward compatibility 204
ServerTimeStamp column 72 creating 181
Set argument 148 StoreForwardDuration argument 125
SignedInteger argument 94 StoreForwardDuration column 46
SignedInteger column 26 StoreForwardMode argument 124
snapshot 25, 31, 58, 65, 84, 86 StoreForwardMode column 45
snapshot actions 58, 84 StoreForwardPath argument 125
snapshot files 58, 149 StoreForwardPath column 46
SnapshotDetail table 19, 58 string tags 65
snapshots 113, 114 deleting 152
SnapshotSize argument 149 inserting 153, 208
SnapshotSize column 58 selecting 155
SnapshotTag table 17, 58 updating 155, 209
SnapshotTagKey column 25, 31, 58, 65 StringHistory table 201
SortOrder argument 151 StringHistory view 190
SortOrder column 62 StringLive table 202
SourceName column 76 StringLive view 190
SourceType column 68 StringSnapshot table 17, 65
sp_help stored procedure 21 StringTag table 18, 65
SQL script 59 StringValue column 191
SQLTemplate table 17, 59 StringWideHistory table 202
Start argument 150 SumDateCalcType column 67
StartDateTime argument 166 SumDateDuration column 67
StartDateTime column 74 SumDateResolution column 67
StartTime argument 98, 112, 113, 114, 157, 176 SumDateTime argument 156
states for values 41, 62 SumDateTimeStamp column 66
StateTime column 41 summaries
StateWideHistory table 59 backward compatibility views 190
Status argument 116 deleting from history 104
Status column 23, 29, 36, 46, 48, 58, 63, 67, 69, 71, summary actions
75 inserting 156
storage summary calculation 28
deadband 72, 95, 108, 147, 155 summary data 66, 87
setting deadband 175 summary date 66, 87, 191
tags 148 summary history
See also history blocks, storage locations managing 150
Storage argument 122 summary information
storage locations 62 deleting 159
path 62, 152 inserting 160
selecting 151 selecting 161
updating 151 updating 161
storage node 63 summary operations 37, 66, 67, 68
storage rate 70, 91, 93, 106, 147, 153 deleting 157
storage rules inserting 158
tags 146 retrieving details 156
storage type 70, 91, 93, 106, 146, 153 returning details 156
StorageAreaType column 42 selecting 158
StorageLocation table 19, 62 updating 159
StorageNode table 19, 63 summary tag 68
StorageNodeKey argument 94, 124, 128, 151, 168 SummaryArchived column 42
StorageNodeKey column 42, 45, 47, 62, 63, 69, 75 SummaryData table 17, 66
StorageRate argument 93, 106, 147, 153 SummaryDate column 66, 87, 191
StorageRate column 70 SummaryHistory table 17, 66
StorageSize argument 149 SummaryOperation table 17, 67
StorageSize column 58 SummaryTagList table 17, 68
StorageType argument 93, 106, 146, 151, 153 SumVarKey argument 160, 161
StorageType column 62, 70 SumVarKey column 66, 68
store-and-forward 45, 46, 124, 125 swinging door deadband 26, 95, 147
data chunk size 47, 125 system configuration tables
duration 46, 125 about 19
interval 47, 126 system messages 34, 51, 193
starting data processing 176 system namespace 18, 192

IndustrialSQL Server Historian Database Reference


Index 223

expanding 162, 163 inserting 166


system parameters 69, 163, 164, 191 selecting 167
selecting 163 updating 167
updating 164 time interval
system startup 100 for event tags 35, 116
SystemNameSpace view 192 time zone 40, 43, 51, 61, 74, 79, 179, 187
SystemParameter table 19, 69 TimeBase column 57
TimeDB argument 147
T TimeDeadband argument 93, 106, 116, 153, 176
TimeDeadband column 36, 70, 76
Table column 85 TimeDetectorDetail table 17, 73
tables TimeDetectorDetailKey column 73
about 21 TimeDetectorDetailPendingDelete table 17, 74
accessing information 21 time-in-state 41
categories 13 timeout 75, 169
referential integrity 21 IDAS autonomous startup 46, 125
tag count 183, 185, 186 IDAS connection 47, 126
tag definitions TimeOut argument 169
tables 18 TimeOut column 75
tag groups 203 TimeStamp argument 158
Tag table 17, 18, 19, 69 TimeStamp column 68, 87
Tag1 column 60, 78 timestamp rule 40, 61, 80
Tag2 column 60, 78 timestamping 72, 95, 108, 146, 147, 155
TagA1 column 195 TimeZone column 74
TagA2 column 195 TimeZone table 19, 74
TagD1 column 198 TimeZoneID column 74
TagD2 column 198 TimeZoneOffset column 43
TagGroup table 203 ToDate argument 123
TagKey argument 170 ToDate column 42
TagList argument 98, 113, 114, 115, 157, 166, 204, TokenType argument 162
205 topic definition 76
TagN argument 177 Topic table 18, 19, 75
TagName argument 90, 92, 97, 104, 105, 106, 111, TopicImportInfo table 17, 76
112, 115, 132, 135, 145, 153, 158, 160, 161, 166, TopicKey argument 94, 107, 154, 168, 169, 170
167 TopicKey column 70, 75
TagName column 25, 27, 30, 32, 34, 35, 38, 44, 49, TopicName argument 146
50, 57, 58, 65, 67, 68, 69, 73, 84, 85, 86, 87, 191, TopicName column 76
194, 195, 196, 197, 198, 199, 200, 201, 202, 203 topics 75, 76, 146, 168
tagname database deleting 168
See data dictionary inserting 168
Tagname.X file 43, 44 selecting 169
TagRef table 18, 73 updating 170
tags 69, 73 TotalCount column 34, 193
deleting 104 tracking
retrieving definition 165 See modification tracking
retrieving types 166 Triggerval column 199
setting storage rules 146 TRUE 52, 136
storage for 148 Type argument 138, 141, 144, 146, 148
TagS1 column 202 Type column 23, 24, 28, 34, 38, 55, 56, 59, 191, 192,
TagS2 column 202 193, 197, 201, 203
TagType argument 120, 165 TypeInfo column 44
TagType column 59, 70, 73
Target column 31 U
TemplateKey column 59
TextKey column 51 uid column 77
threads 36, 117 Unit argument 110
threshold Unit column 32
for storage 63, 152 unit of measure 32, 110
IDAS 46, 125 UpperLimit argument 160
ThresholdTime argument 150 UpperLimit column 69
ThresholdTime column 58 user 171
time deadband 70, 91, 93, 106, 116, 147, 153, 176 User column 86
for storage 175 user ID 77, 188
time detectors 73, 74 UserDetail table 18, 19, 77

IndustrialSQL Server Historian Database Reference


224 Index

UserKey argument 97 ww_ActionStringSelect stored procedure 209


UserKey column 27, 53, 54, 77, 203 ww_AddTag stored procedure 209
UserName column 53, 77 ww_AnalogDetail stored procedure 209
users 53, 77, 86 ww_AnalogTagDelete stored procedure 209
UseThreadPool argument 117 ww_AnalogTagInsert stored procedure 209
UseThreadPool column 36 ww_AnalogTagSelect stored procedure 209
UTC 40, 43, 51, 61, 79 ww_AnalogTagUpdate stored procedure 209
ww_Annotation stored procedure 209
V ww_AnnotationDelete stored procedure 209
ww_AnnotationInsert stored procedure 209
v_AnalogHistory view 189 ww_AnnotationSelect stored procedure 209
v_AnalogLive view 189 ww_AnnotationUpdate stored procedure 209
v_DiscreteHistory view 190 ww_CheckClientVersion stored procedure 205, 209
v_DiscreteLive view 190 ww_CheckWhichDb stored procedure 206, 209
v_ErrorLog view 193 ww_CleanupAfterCommit stored procedure 209
v_EventSnapshot view 84 ww_CommitChanges stored procedure 209
v_EventStringSnapshot view 84 ww_CommitChangesAtStartup stored procedure 210
v_History view 190 ww_ContextDelete stored procedure 210
v_HistoryBlock view 190 ww_ContextInsert stored procedure 210
v_Live view 190 ww_ContextSelect stored procedure 210
v_ModTracking view 85 ww_ContextUpdate stored procedure 210
v_SnapshotData view 86 ww_DBChangesPending stored procedure 210
v_StringHistory view 190 ww_dbCheck stored procedure 206, 210
v_StringLive view 190 ww_DBConfig stored procedure 206, 210
v_SummaryData view 87 ww_DeleteOlderEvents stored procedure 210
Value argument 98, 132, 164 ww_DeleteOlderSummaries stored procedure 210
Value column 25, 27, 31, 38, 49, 50, 57, 65, 66, 69, ww_DeleteTag stored procedure 210
84, 85, 86, 87, 191, 194, 195, 197, 198, 199, 200, ww_DetectorStringSelect stored procedure 210
201, 202 ww_DiscreteDetail stored procedure 210
value deadband 26, 94, 147, 176 ww_DiscreteTagDelete stored procedure 210
storage 175 ww_DiscreteTagInsert stored procedure 210
ValueDB argument 147 ww_DiscreteTagSelect stored procedure 210
ValueDeadBand argument 176 ww_DiscreteTagUpdate stored procedure 210
ValueDeadband argument 94 ww_EngineeringUnitDelete stored procedure 210
ValueDeadband column 26, 76 ww_EngineeringUnitInsert stored procedure 210
version ww_EngineeringUnitSelect stored procedure 210
for data 40, 61, 80 ww_EngineeringUnitUpdate stored procedure 210
Tag table 72 ww_EventDetection stored procedure 210
Version column 22, 42 ww_EventHistory stored procedure 210
views ww_EventHistoryInsert stored procedure 210
about 83 ww_EventSnapshot stored procedure 210
backward compatibility 189 ww_EventSnapshotInsert stored procedure 210
vValue column 38, 50, 59 ww_EventTagDelete stored procedure 210
ww_EventTagDetail stored procedure 210
W ww_EventTagInsert stored procedure 210
ww_EventTagSelect stored procedure 210
wAcquisitionRate argument 91 ww_EventTagSelectAll stored procedure 210
wAcquisitionType argument 90 ww_EventTagSelectDeleted stored procedure 210
wCurrentEditor argument 91 ww_EventTagSelectDisabled stored procedure 210
wDescription argument 90 ww_EventTagSelectInserted stored procedure 210
WideHistory table 14, 77 ww_EventTagSelectUpdated stored procedure 210
format 15 ww_EventTagUpdate stored procedure 210
WideTableDictionary table 203 ww_GetDbRevision stored procedure 210
Windows login ww_GetLastTagKey stored procedure 210
See logins ww_HistoryBlockSelect stored procedure 210
wIOServerKey argument 90 ww_InSQLConfigNSExpand stored procedure 211
wItemName argument 91 ww_InSQLNSExpand stored procedure 211
wStorageNodeKey argument 90 ww_InSQLStatusSelect stored procedure 211
wStorageRate argument 91 ww_InSQLStatusSet stored procedure 211
wStorageType argument 91 ww_InTouchNodeTagList stored procedure 211
wTagName argument 90 ww_IODriverDelete stored procedure 211
wTagType argument 91 ww_IODriverInsert stored procedure 211
wTimeDeadband argument 91 ww_IODriverSelect stored procedure 211
wTopicKey argument 90 ww_IODriverUpdate stored procedure 211

IndustrialSQL Server Historian Database Reference


Index 225

ww_IOServerDelete stored procedure 211 ww_SummaryOperationUpdate stored


ww_IOServerInsert stored procedure 211 procedure 212
ww_IOServerSelect stored procedure 211 ww_SummaryTagListDelete stored procedure 212
ww_IOServerTypeDelete stored procedure 211 ww_SummaryTagListInsert stored procedure 212
ww_IOServerTypeInsert stored procedure 211 ww_SummaryTagListSelect stored procedure 212
ww_IOServerTypeSelect stored procedure 211 ww_SummaryTagListUpdate stored procedure 212
ww_IOServerTypeUpdate stored procedure 211 ww_SystemConfigNSExpand stored procedure 212
ww_IOServerUpdate stored procedure 211 ww_SystemNSExpand stored procedure 212
ww_LimitDelete stored procedure 211 ww_SystemNSExpand2 stored procedure 212
ww_LimitInsert stored procedure 211 ww_SystemParameterSelect stored procedure 212
ww_LimitNameDelete stored procedure 211 ww_SystemParameterUpdate stored procedure 212
ww_LimitNameInsert stored procedure 211 ww_TagConfig stored procedure 212
ww_LimitNameSelect stored procedure 211 ww_TagConfigModified stored procedure 212
ww_LimitNameUpdate stored procedure 211 ww_TagConfigSelect stored procedure 213
ww_LimitSelect stored procedure 211 ww_TagInfo stored procedure 213
ww_LimitUpdate stored procedure 211 ww_TagType stored procedure 213
ww_LoadInSQLProcedureBody stored ww_TimeDetectorDetailInsert stored procedure 213
procedure 207, 211 ww_TimeDetectorDetailSelect stored procedure 213
ww_MDASAnalogTagInsert stored procedure 207 ww_TimeDetectorDetailUpdate stored
ww_MDASAnalogTagUpdate stored procedure 207 procedure 213
ww_MDASDiscreteTagInsert stored procedure 208 ww_TopicDelete stored procedure 213
ww_MDASDiscreteTagUpdate stored procedure 208 ww_TopicInsert stored procedure 213
ww_MDASStringTagInsert stored procedure 208 ww_TopicSelect stored procedure 213
ww_MDASStringTagUpdate stored procedure 209 ww_TopicUpdate stored procedure 213
ww_MessageDelete stored procedure 211 ww_UpdateCalculatedAISamples stored
ww_MessageInsert stored procedure 211 procedure 213
ww_MessageSelect stored procedure 211 ww_UserAccessLevelSelect stored procedure 213
ww_MessageUpdate stored procedure 211 ww_UserDetailUpdate stored procedure 213
ww_ModLogStatus stored procedure 211 wwCycleCount column 40, 61, 80, 194, 195, 197,
ww_PrivateNSAddGroup stored procedure 211 198, 202, 203
ww_PrivateNSAddLeaf stored procedure 211 wwDomainTagKey column 22, 54, 55, 73, 199
ww_PrivateNSDeleteGroup stored procedure 211 wwEdgeDetection column 39, 78, 194, 195, 197,
ww_PrivateNSDeleteLeaf stored procedure 211 198, 201, 202
ww_PrivateNSExpand stored procedure 211 wwInterpolationType column 41, 80, 194, 195
ww_PrivateNSSelect stored procedure 211 wwParameters column 41, 51, 62, 81, 194, 195, 196,
ww_PrivateNSUpdateGroup stored procedure 211 197, 198, 202, 203
ww_PublicNSAddGroup stored procedure 211 wwQualityRule column 61, 81, 194, 196
ww_PublicNSAddLeaf stored procedure 212 wwResolution column 39, 60, 78, 194, 195, 197,
ww_PublicNSDeleteGroup stored procedure 212 198, 201, 202
ww_PublicNSDeleteLeaf stored procedure 212 wwRetrievalMode column 39, 50, 60, 79, 194, 195,
ww_PublicNSExpand stored procedure 212 197, 198, 201, 202
ww_PublicNSSelect stored procedure 212 wwRowCount column 39, 60, 78, 194, 195, 197,
ww_PublicNSUpdateGroup stored procedure 212 198, 201, 202
ww_RedirectToInTouch stored procedure 212 wwStateCalc column 41, 62
ww_SetAISamples stored procedure 212 wwTagKey argument 92, 96, 105, 108, 109, 115,
ww_SetCalculatedAISamples stored procedure 212 118, 120, 138, 139, 142, 143, 152, 155, 156
ww_SetStorageRule stored procedure 212 wwTagKey column 38, 50, 69, 73, 194, 195, 197,
ww_SetTagStorage stored procedure 212 198, 199, 200, 201, 202
ww_SnapshotDetailSelect stored procedure 212 wwTimeDeadband column 39, 50, 60, 79, 194, 195,
ww_SnapshotDetailUpdate stored procedure 212 197, 198, 201, 202
ww_SnapToSummary stored procedure 212 wwTimeStampRule column 40, 61, 80, 194, 195,
ww_SpaceManager stored procedure 212 197, 198, 202, 203
ww_StorageLocationSelect stored procedure 212 wwTimeZone argument 179
ww_StorageLocationUpdate stored procedure 212 wwTimeZone column 40, 43, 51, 61, 79, 194, 195,
ww_StringDetail stored procedure 212 197, 198, 201, 202
ww_StringTagDelete stored procedure 212 wwValueDeadband column 40, 50, 60, 79, 194, 195
ww_StringTagInsert stored procedure 212 wwVersion column 40, 61, 80, 194, 195, 197, 198,
ww_StringTagSelect stored procedure 212 201, 202
ww_StringTagUpdate stored procedure 212
ww_SummaryActionInsert stored procedure 212 X
ww_SummaryDetail stored procedure 212
ww_SummaryOperationDelete stored procedure 212 xp_AllowCommit extended stored procedure 179
ww_SummaryOperationInsert stored procedure 212 xp_AnalogHistory extended stored procedure 172
ww_SummaryOperationSelect stored procedure 212

IndustrialSQL Server Historian Database Reference


226 Index

xp_AnalogHistoryDelta extended stored


procedure 172
xp_AnalogWideHistory extended stored
procedure 172
xp_AnalogWideHistoryDelta extended stored
procedure 172
xp_DiscreteHistory extended stored procedure 173
xp_DiscreteHistoryDelta extended stored
procedure 173
xp_DiscreteWideHistory extended stored
procedure 173
xp_DiscreteWideHistoryDelta extended stored
procedure 173
xp_DiskCopy extended stored procedure 174
xp_NewHistoryBlock extended stored procedure 174
xp_ProcList extended stored procedure 174
xp_RescanHistoryBlocks extended stored
procedures 175
xp_SetAutoStart extended stored procedure 179
xp_SetStorageTimeDeadband extended stored
procedure 175
xp_SetStorageValueDeadband extended stored
procedure 175
xp_SetStoreForwardEvent stored procedure 176
xp_TZGetDate extended stored procedure 179

IndustrialSQL Server Historian Database Reference

You might also like