Minion’s Inline Tokens allow you use defined patterns to use and create dynamic names and paths. These tokens are stored in the dbo.InlineTokens table and are fully documented there.
Create and use a custom Inline Token
To create a custom token, insert a new row to the Minion.DBMaintInlineToken table. Guidelines:
- DynamicName: Use a unique DynamicName.
- ParseMethod: For tokens that use date in some way, we recommmend using @ExecutionDateTime instead of GetDate or other system date methods.
- IsCustom: Mark IsCustom = 1.
- Definition: Provide a descriptive definition, for the use of you and your DBA team.
For example, we can use the following statement to create an Inline Token to represent the full day name (like Monday, etc.):
INSERT INTO dbo.InlineTokens
( DynamicName
, ParseMethod
, IsCustom
, Definition
, IsActive
)
VALUES ( 'DayNameFull'
, 'DATENAME(dw, @ExecutionDateTime)'
, 1
, 'Returns the full name of the current day (e.g. Monday, Tuesday, etc.).'
, 1
);
IMPORTANT: The syntax for using this custom Inline Token is “|DayNameFull|”. Notice that default tokens (like Server) use percent signs (“%Server%”), while custom tokens use pipe delimiters (“|DayNameFull|”).
Custom Inline Tokens
We do have a few guidelines for creating your own tokens:
- Naming DynamicName: We recommend you do not include any special symbols – only alphanumeric characters. We also recommend against using the underscore symbol.
- Defining ParseMethod: To be consistent and avoid anomalies, use @ExecutionDateTime instead of GetDate() (or SYSDATETIME(), or CURRENT_TIMESTAMP, or any of the others).
- Uniqueness: Be aware that there is a unique constraint on DynamicName and IsActive; so you can only have one active “Date”, and one inactive “Date” (as an example).
- IsCustom: Set IsCustom = 1 for your custom dynamic names.
IMPORTANT: Custom inline tokens must be surrounded by pipes, not percent signs.
The tokens are always parsed by the SP dbo.InlineTokenParse.