首頁 資料庫 mysql教程 重命名SQL中的Agent代理

重命名SQL中的Agent代理

Jun 07, 2016 pm 02:54 PM
agent sql 代理商 雙重命名

重命名SQL中的Agent代理 Agent --(SQL Server 2000 only) use msdbgoif exists (select * from sysobjects where name = N'sp_sqlagent_rename' and type ='P') drop proc dbo.sp_sqlagent_renamegocreate proc dbo.sp_sqlagent_rename @old_server nvarchar(

重命名SQL中的Agent代理 Agent
--(SQL Server 2000 only) 

use msdb
go

if exists (select * from sysobjects where name = N'sp_sqlagent_rename' and type ='P')
    drop proc dbo.sp_sqlagent_rename
go

create proc dbo.sp_sqlagent_rename 
@old_server nvarchar(30)
as

set nocount on

if (charindex(N'8.00', @@version, 0) = 0)
begin
    raiserror('sp_sqlagent_rename is only required on SQL Server 2000, procedure will abort', 11, 1)
end

if (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) = 0)
begin
    raiserror('sp_sqlagent_rename can only be used by sysadmin role members, procedure will abort', 11, 1)
end

declare @new_server nvarchar(30)
select @new_server = convert(nvarchar(30), serverproperty(N'servername'))

if exists(select * from msdb.dbo.sysjobs where upper(originating_server) = upper(@old_server))
begin
    update msdb.dbo.sysjobs
    set originating_server = @new_server
    where originating_server = @old_server

    raiserror('sp_sqlagent_rename, %d entries updated from %s to %s', 10, 1, 
        @@rowcount,  @old_server, @new_server )
end
else
begin
    raiserror('sp_sqlagent_rename, no entries found for @old_server = %s, 0 rows are updates', 10, 1, @old_server)
end
go

-- sample usage
-- exec msdb.dbo.sp_sqlagent_rename @old_server = 'GERTD00\DEV'
登入後複製
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
2 週前 By 尊渡假赌尊渡假赌尊渡假赌
倉庫:如何復興隊友
4 週前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

在 Windows 11上快速重新命名印表機的 4 種方法 在 Windows 11上快速重新命名印表機的 4 種方法 Sep 11, 2023 pm 03:26 PM

在 Windows 11上快速重新命名印表機的 4 種方法

Hibernate 框架中 HQL 和 SQL 的差異是什麼? Hibernate 框架中 HQL 和 SQL 的差異是什麼? Apr 17, 2024 pm 02:57 PM

Hibernate 框架中 HQL 和 SQL 的差異是什麼?

Oracle SQL中除法運算的用法 Oracle SQL中除法運算的用法 Mar 10, 2024 pm 03:06 PM

Oracle SQL中除法運算的用法

SQL中的identity屬性是什麼意思? SQL中的identity屬性是什麼意思? Feb 19, 2024 am 11:24 AM

SQL中的identity屬性是什麼意思?

Oracle與DB2的SQL語法比較與區別 Oracle與DB2的SQL語法比較與區別 Mar 11, 2024 pm 12:09 PM

Oracle與DB2的SQL語法比較與區別

詳解MyBatis動態SQL標籤中的Set標籤功能 詳解MyBatis動態SQL標籤中的Set標籤功能 Feb 26, 2024 pm 07:48 PM

詳解MyBatis動態SQL標籤中的Set標籤功能

如何在 Windows 11/10 上變更文件類型 如何在 Windows 11/10 上變更文件類型 Oct 27, 2023 pm 02:13 PM

如何在 Windows 11/10 上變更文件類型

重命名的快捷鍵是什麼 重新命名是什麼按鍵 重命名的快捷鍵是什麼 重新命名是什麼按鍵 Feb 22, 2024 pm 02:50 PM

重命名的快捷鍵是什麼 重新命名是什麼按鍵

See all articles