---
title: "Datamodell"
description: "The SQL driver for Invantive Script exposes the execution profile of the script being run: the runs performed, the statements executed, the scripting\u2026"
language: nb
source_language: en
translation_state: pending
canonical: https://documentation.invantive.eu/nb/docs/invantive-universalsql/service-drivers/invantive-script-data-model/data-model
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/service-drivers/invantive-script-data-model/data-model
updated: 2026-12-05T20:15:27Z
license: https://documentation.invantive.eu/nb/
---

The SQL driver for Invantive Script exposes the execution profile of the script being run: the runs performed, the statements executed, the scripting variables defined and the operating-system commands started on behalf of the script. It allows a script to report on itself, so that the duration and the outcome of each statement can be queried with SQL instead of being read back from a log file afterwards.

Tilgjengelig fra versjon 26.0. The driver covers 4 tables and 69 columns.

## Spesifikasjoner
The SQL driver for Invantive Script does not support partitioning. En introduksjon til konseptene i Invantive UniversalSQL, som databaser, datacontainere og partisjonering, finnes i [[Grammar|Invantive UniversalSQL grammar]].

The driver is a service driver, so the connection is always present in a database and occurs at most once. No data container is defined for it in [[Settings]] and no log on takes place.

Driveren har følgende egenskaper:
- Anbefalt alias: `script`
- Katalog: `Script`
- Teknisk støtte (URL): https://forums.invantive.com

## Scope of the Profile
The profile covers the process in which the statements run. It is held in memory and starts empty each time the product is started, so a query returns the runs and statements of the current process only and never those of an earlier one. A query on the profile is itself a statement and therefore appears in its own results, with the columns describing its outcome still empty because it has not ended yet.

A statement executed on its own, such as the statement under the cursor in Invantive Query Tool, forms a run of one statement with `SOURCE_KIND` set to `INTERACTIVE`, so `Runs@script` holds one row per such execution. Statements executed together as a script share one run.

The profile is filled by the product running the script. It is available in the products which carry Invantive Script, such as Invantive Data Hub and Invantive Query Tool; a product which executes statements without Invantive Script leaves the profile empty. See [[Invantive Script/Invantive Script|Invantive Script]] for the language itself.

Statements which handle a secret are registered without their text. The text of a statement such as a log on which carries a password is replaced by `(anonymized)` and the column `IS_ANONYMIZED` reads `true`; the hash in `STATEMENT_HASH` is still filled, so identical statements remain comparable without the secret being retained.

## Objekter
Det finnes en liste per objektkategori:
- [[Invantive UniversalSQL/Service Drivers/Invantive Script Data Model/Tables/Tables|Tables]]

## Eksempler
The following example lists the statements of the current run from slowest to fastest:
```sql
select sen.statement_type
,      sen.sql_operation
,      sen.duration_ms
,      sen.rows_affected
,      substr(sen.statement_text, 1, 60) statement_text
from   StatementExecutions@script sen
where  sen.ended_utc is not null
order
by     sen.duration_ms desc
```

The following example reports the statements which failed, together with the reason:
```sql
select sen.id
,      sen.statement_type
,      sen.error_message_code
,      sen.error_message
from   StatementExecutions@script sen
where  sen.successful = false
order
by     sen.id
```

The following example totals the time spent per kind of statement:
```sql
select sen.statement_type
,      count(*) statements
,      sum(sen.duration_ms) duration_ms
from   StatementExecutions@script sen
group
by     sen.statement_type
order
by     duration_ms desc
```
