Skip to main content

Constants

This feature of the Asset Manager is only available if the logged-in user has the Administrator role.

Constants within the Asset Manager are global placeholders for values that may vary between Asset Manager instances, such as server, database, or table names. They are used within SQL scripts that have been created as queries.

If you create a query without using a constant with ...

SELECT * FROM Computers

... and the name of the Computers table changes to MyComputers within another instance of the Asset Manager where the query is to be reused, the query can no longer be executed.

However, if you create a constant and modify the query to ...

SELECT * FROM {@Computers}

... the constant {@Computers} is replaced with the value MyComputers when the SQL script runs, and the query is valid. This requires that the value of the constant be set accordingly at least once before the script is executed.

Constants must be unique within the Asset Manager and follow this syntax: {@MyConstantName}

Any number of constants can exist within a script. If the database name also changes in the example above, a constant {@Database} could be created and used in the following script:

SELECT * FROM {@Database}.dbo.{@Computers}

The following video demonstrates how constants can be created, used, and deleted.