Udostępnij za pośrednictwem


JobServer.ReassignJobsByLogin Method

Changes ownership for any SQL Server Agent job currently owned by a SQL Server login.

Namespace: Microsoft.SqlServer.Management.Smo.Agent
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Syntax

'Deklaracja
Public Sub ReassignJobsByLogin ( _
    oldLogin As String, _
    newLogin As String _
)
public void ReassignJobsByLogin (
    string oldLogin,
    string newLogin
)
public:
void ReassignJobsByLogin (
    String^ oldLogin, 
    String^ newLogin
)
public void ReassignJobsByLogin (
    String oldLogin, 
    String newLogin
)
public function ReassignJobsByLogin (
    oldLogin : String, 
    newLogin : String
)

Parameters

  • oldLogin
    A String value that specifies the old SQL Server login.
  • newLogin
    A String value that specifies the new SQL Server login.

Remarks

By default, any SQL Server login has membership, through the user guest, in the public role of the system database maintaining SQL Server Agent jobs (msdb). When a SQL Server user is created in msdb, jobs created by the user mapping the login are owned by the login, not the user.

Reassigning SQL Server Agent job ownership by using the ReassignJobsByLogin method requires appropriate permission. The SQL Server login used for the current connection must be a member of the fixed role sysadmin.

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server.

Target Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server.