Variables and environments: Built-in variables
Always available, cannot be declared, and resolved per target:
Always available, cannot be declared, and resolved per target:
| Name | Value |
|---|---|
{{target.name}} |
The connection's name |
{{target.server}} |
Its host |
{{target.database}} |
The database this script is running on |
{{target.provider}} |
The provider id |
{{run.id}} |
This run's id |
{{run.startedUtc}} |
When the run started, ISO-8601 |
{{run.user}} |
The Windows user who started it |
The target., run. and error. prefixes are reserved; you cannot declare a variable under them.
These are substituted raw, because target.server is a host name rather than an identifier. A script
that wants one quoted says so: {{target.database|literal}}.