jobs.sp_delete_target_group_member (Azure 彈性作業) (Transact-SQL)
適用於:Azure SQL 資料庫
從適用於 Azure SQL 資料庫 的 Azure 彈性作業服務目標群組中移除資料庫或資料庫群組。
語法
[jobs].sp_delete_target_group_member [ @target_group_name = ] 'target_group_name'
[ , [ @target_id = ] 'target_id' ]
引數
@target_group_name
要從中移除目標群組成員的目標群組名稱。 target_group_name為 nvarchar(128),沒有預設值。
@target_id
指派給要移除的目標群組成員的目標識別碼。 target_id是 uniqueidentifier,預設值為 NULL
。
傳回碼值
0
(成功) 或 1
(失敗)。
權限
依預設,只有 系統管理員 (sysadmin) 固定伺服器角色的成員,才能夠執行這個預存程序。 只有系統管理員的成員可以使用此預存程序來編輯其他使用者所擁有的作業屬性。
範例
從目標組移除伺服器
下列範例會 London
從「維護客戶資訊的伺服器」群組中移除伺服器。 在此情況下 ElasticJobs
,您必須連接到建立作業代理程式時指定的作業資料庫。
--Connect to the jobs database specified when creating the job agent
USE ElasticJobs ;
GO
-- Retrieve the target_id for a target_group_members
DECLARE @tid uniqueidentifier
SELECT @tid = target_id
FROM [jobs].target_group_members
WHERE target_group_name = 'Servers Maintaining Customer Information'
AND server_name = 'London.database.windows.net';
-- Remove a target group member of type server
EXEC jobs.sp_delete_target_group_member
@target_group_name = N'Servers Maintaining Customer Information',
@target_id = @tid;
GO