How-to
Collect SQL Server rows into PI tags with the RDBMS interface
Short answer
The PI Interface for Relational Database (RDBMS via ODBC) is the supported way to turn SQL Server rows into PI tag history; a missing download entry is a license-entitlement or account-access matter for the vendor or distributor, not a data-path fault. Commission in order: licensed package, ODBC connection proven under the service identity, one single-tag query, then PI point write authorization, reading errors by layer.

On this page
- Get the licensed package before touching the data path
- Prove the ODBC connection from the interface host
- Map rows to tags: single-tag query before distribution
- Authorize the PI write and read errors by layer
- Verifying the first single-tag collection at a 60 s scan
- Match collection behavior to the meaning of the SQL records
- The decision for each case
- Questions asked
If the PI Interface for Relational Database (RDBMS via ODBC) is missing from your download list, the data path is not the problem. The interface is a separately licensed product, and a missing entry means the signed-in account cannot see the package: either the entitlement is absent, or the account is associated with the wrong organization or lacks access to that product. The interface itself is the supported way to move SQL Server rows into PI tag history. Commission it in a fixed order: licensed package, ODBC connection proven under the service identity, one single-tag query, then PI point write authorization.
Get the licensed package before touching the data path #
The download screen shows which installation packages an account can access; it diagnoses nothing about SQL Server, ODBC or the PI Data Archive. Work the access problem first:
- Identify the PI Data Archive that will receive the data and the organization that owns its software entitlement.
- Ask the vendor or an authorized distributor to confirm entitlement for PI Interface for Relational Database (RDBMS via ODBC), naming that package exactly.
- Have the site's authorized software administrator verify that the download account belongs to the correct organization and has access to that product. A missing listing alone does not distinguish an absent entitlement from a wrong account association.
- Follow the documented licensing sequence: create a Machine Signature File, generate the license file, and have the location of
pilicense.datready for the Data Archive. - Obtain the installer and the matching configuration manual through the official distribution channel only.
Do not confuse this interface with the relational database provider that exposes PI data to SQL applications; that serves the opposite direction, covered when reading default historian data in SQL Server the supported way. A working PI-to-SQL read path proves nothing about acquisition into PI.
Prove the ODBC connection from the interface host #
The interface host must reach both the source databases and the destination PI Server. A connection that works from an engineer's desktop does not prove access from the interface host, because the driver, the network path and the identity are all different there.
| Setting | Where it lives | What it decides |
|---|---|---|
| ODBC connection to the source database | Interface host | Which database the query runs against |
| ODBC driver | Driver installation | Whether the interface process can load the driver |
| Authentication and permissions | Connection configuration and SQL Server | Whether the interface identity can connect and read |
| PI Server destination | Interface configuration | Which archive receives the acquired values |
| Service execution identity | Interface service configuration | Which credentials apply during unattended operation |
- Select an interface host that meets the package's documented operating-system and driver requirements.
- Install a compatible ODBC driver and configure a connection to one source database.
- Grant the acquisition identity access to the required tables or views, read-only where the query only reads.
- Test the connection under the identity that will run the interface, not only under an interactive administrator account.
- Execute a simple read against the intended source object. If it fails, resolve the driver, network, authentication or permission error before configuring any PI tags.
With instances on several machines, repeat this per source before combining them into one collection configuration; success against one server proves nothing about the next.
Map rows to tags: single-tag query before distribution #
A successful query proves database access, not a usable PI event. The interface needs an unambiguous destination tag, a compatible value type and a defined timestamp treatment. The vendor documents two approaches: a single-tag query, the simplest, where one query retrieves a single value, timestamp and status — its example begins SELECT timestamp, value, status FROM followed by the source table — and tag distribution, where a distributor tag executes a query whose result set carries target tag names and their values. Configure the result layout exactly as the manual specifies; arbitrary SQL output is not an accepted layout.
- Start with a single-tag query on a known source value to isolate value conversion and timestamp handling.
- Run the proposed query through the configured connection and check the returned column order, value types, null handling, timestamp meaning and row count.
- Apply the documented single-tag mapping and confirm it selects the intended result row.
- Record the source result used for testing; it is the reference for comparing the first archived PI event.
- Move to tag distribution only when a shared result set naturally carries data for several destination tags, which avoids repeating similar database work per point.
Authorize the PI write and read errors by layer #
The ODBC connection and the PI connection are separate authorization boundaries. An interface can read SQL Server correctly and still fail to update a PI point because it targets the wrong server, lacks write access or associates the query with the wrong point.
- Configure the destination PI Server using the interface's documented connection settings.
- Create or select a commissioning point with a point type suitable for the SQL value's type.
- Configure the point's query association as the interface manual specifies.
- Authorize the interface identity to access and update the point through the site's PI security configuration.
- Start the interface and read its connection and acquisition messages by layer: a SQL connection error belongs to the driver or database path; a successful query followed by a conversion or mapping error belongs to the result-to-point configuration; a PI connection or write rejection belongs to the destination path.
A connection rejected before any query runs is diagnosed by the same layer-first method described for PI ODBC SQLSTATE 08004 connection failures. Confirm the commissioning point receives an event before adding further points.
Verifying the first single-tag collection at a 60 s scan #
This worked example is illustrative: the scan period, window and value are example inputs, not documented defaults; the three-column layout comes from the vendor's single-tag SQL example.
Inputs
- Scan period: 60 s between reads (example; set it from how often the source table changes and how much repeated history you accept).
- Observation window: 600 s, the first ten minutes after the interface starts (example).
- Query result per read: 1 row with 3 columns — timestamp, value, status — from the documented single-tag layout.
- Source value at every read in the window: 72.4, with a stable source timestamp (example).
Rule. Each read that returns one row should produce one PI event on the commissioning point, carrying the source value and timestamp.
Arithmetic
- 600 s ÷ 60 s = 10 reads expected.
- 10 reads × 1 row = 10 result rows.
- 10 rows → 10 PI events expected on the commissioning point, each holding 72.4 and the source timestamp.
Result. Read the point back through your usual PI client and count the events in the window.
Decision. Ten events with the right value and timestamps: the path is proven; add the remaining tags, then the remaining SQL Server sources. Zero events: the fault is in the SQL layer. Events with a wrong value or timestamp: the fault is the mapping. Query runs in the messages but nothing archives: the fault is the PI write authorization. Fix at the layer the evidence names before adding any tag.
Match collection behavior to the meaning of the SQL records #
Collection can look healthy while timestamps are wrong, intermediate records are omitted or repeated reads write unwanted duplicates. Configure around what the rows mean:
- For current-state tables, accept that each read observes the state at scan time; a change that happens entirely between two reads may never reach PI. Shorten the scan period if that loss matters.
- For historical tables, define deliberately how new records are selected and whether the source timestamp or the read time becomes the PI event time.
- Define restart behavior from the interface documentation: decide whether rows written while the interface was stopped are backfilled or skipped, and test it once on purpose.
The decision for each case #
- Interface missing from downloads: a license-entitlement or account-access matter; resolve it with the vendor or distributor and build nothing else instead.
- ODBC read fails under the service identity: driver, network, authentication or permission; fix it at that layer on the interface host.
- Query succeeds, no PI event: mapping or point configuration.
- PI connection or write rejected: destination path — server name, write access or point association.
- Path proven on one point: extend tag by tag, source by source, in that same order.
Questions asked
Is there a newer or better way than the RDBMS interface to move SQL Server rows into PI?
The RDBMS via ODBC interface is the vendor's documented acquisition path from relational databases into the PI Data Archive, and it is the one to use. A custom service writing through an API is possible, but then you own timestamping, buffering, restart recovery and health monitoring yourself. Use the interface and spend the effort on its configuration.
Can one interface instance collect from several SQL Server machines?
Yes, but prove each database connection independently from the interface host before adding all of them to one configuration. A working connection to one source proves nothing about another machine's driver version, network path or database permissions. Bring the sources online one at a time so a failure is unambiguous.
Does reading PI data through ODBC from SQL Server prove I can collect into PI?
No. That product serves the opposite direction, exposing PI data to SQL applications, and it is separately licensed and configured. A working read path into SQL Server says nothing about your entitlement to the RDBMS interface or about the acquisition configuration, so do not use it as evidence when commissioning collection.
What point type should the commissioning tag use?
Match the point type to the SQL column type: a floating-point or decimal column to a real point type, an integer column to an integer point type. If the interface reports a conversion error after a successful query, the mismatch is between the result column and the point type you configured, not in the database connection.
When should I switch from single-tag queries to a tag distribution query?
Switch when one shared result set naturally carries the names and values of several destination tags, so a distributor tag can route each row without repeating near-identical queries per point. For one or two unrelated values, single-tag queries are simpler to commission and easier to fault-find, because each query maps to exactly one point.


