Skip to content

Latest commit

 

History

History
77 lines (56 loc) · 2.75 KB

core-sp-add-collector-type-transact-sql.md

File metadata and controls

77 lines (56 loc) · 2.75 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
core.sp_add_collector_type (Transact-SQL)
Adds a new entry to the core.supported_collector_types view in the management data warehouse database.
markingmyname
maghan
randolphwest
08/21/2024
sql
system-objects
reference
sp_add_collector_type
sp_add_collector_type_TSQL
core.sp_add_collector_type stored procedure
management data warehouse, data collector stored procedures
sp_add_collector_type
data collector [SQL Server], stored procedures
TSQL

core.sp_add_collector_type (Transact-SQL)

[!INCLUDE SQL Server]

Adds a new entry to the core.supported_collector_types view in the management data warehouse database. The procedure must be executed in the context of the management data warehouse database.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

core.sp_add_collector_type [ @collector_type_uid = ] 'collector_type_uid'
[ ; ]

Arguments

[ @collector_type_uid = ] 'collector_type_uid'

The GUID for the collector type. @collector_type_uid is uniqueidentifier, with no default value.

Return code values

0 (success) or 1 (failure).

Permissions

Requires membership in the mdw_admin (with EXECUTE permission) fixed database role.

Examples

The following example adds the Generic T-SQL Query collector type to the core.supported_collector_types view. By default, the Generic T-SQL Query collector type already exists. Therefore, if you run this code on a default installation, you see a message that the collector type already exists.

This code runs successfully if you previously removed the Generic T-SQL Query collector type by using the core.sp_remove_collector_type stored procedure, and then wanted to re-add it as a registered collector type that can upload data to the management data warehouse.

USE <management_data_warehouse>;
GO

DECLARE @RC INT;
DECLARE @collector_type_uid UNIQUEIDENTIFIER;

SELECT @collector_type_uid = (
    SELECT collector_type_uid
    FROM msdb.dbo.syscollector_collector_types
    WHERE name = N'Generic T-SQL Query Collector Type'
);

EXECUTE @RC = core.sp_add_collector_type @collector_type_uid;

Related content