<budget_ name>!ADD_ TAG¶
Adds a tag to a custom budget. The tag must be added by reference.
Important
This method has been deprecated. Use <budget_name>!SET_RESOURCE_TAGS instead.
语法
实参
'tag_reference'The serialized string representation that resolves to a tag. This string is the output of the SYSTEM$REFERENCE function.
reference_statementA SYSTEM$REFERENCE statement that creates a reference for the tag to be added to the budget.
'tag_value'您要添加到预算的标签的值。
返回
返回一个 VARCHAR 值,用于指明标签是否已成功添加到预算中。
如果标签未添加到预算,函数会返回错误消息。
访问控制要求
要为自定义预算调用此方法,需要具备以下权限和角色:
- ADMIN instance role for the budget instance.
- 对包含预算实例的数据库和架构的 USAGE 权限。
- 对包含标签的数据库和架构的 USAGE 权限。
- 对被添加标签的 APPLYBUDGET 权限。
For more information, see Budgets roles and privileges.
使用说明
- 您只能将标签添加到 自定义预算。
-
Calling this method does not return the object. Because of this, you can’t use method chaining to call another method on the return value of this method. Instead, call each method in a separate SQL statement.
示例
- Retrieve the tag reference before calling the method to add a tag.
The following statement creates and returns a reference for the
cost_centertag:该语句会在输出中返回引用。
The following statement uses the string literal for this reference to add the
cost_center = 'sales'tag/value combination to thebudget_db.budget_schema.my_budgetbudget:- Include the SYSTEM$REFERENCE function in the argument directly
After executing the following statement, the budget will track all objects that are tagged with the tag/value combination
team_tag = 'finance'.