Remarque
L’accès à cette page nécessite une autorisation. Vous pouvez essayer de vous connecter ou de modifier des répertoires.
L’accès à cette page nécessite une autorisation. Vous pouvez essayer de modifier des répertoires.
Gets or sets the owner of the job.
Espace de noms : Microsoft.SqlServer.Management.Smo.Agent
Assembly : Microsoft.SqlServer.Smo (en Microsoft.SqlServer.Smo.dll)
Syntaxe
'Déclaration
<SfcPropertyAttribute(SfcPropertyFlags.Standalone)> _
Public Property OwnerLoginName As String
Get
Set
'Utilisation
Dim instance As Job
Dim value As String
value = instance.OwnerLoginName
instance.OwnerLoginName = value
[SfcPropertyAttribute(SfcPropertyFlags.Standalone)]
public string OwnerLoginName { get; set; }
[SfcPropertyAttribute(SfcPropertyFlags::Standalone)]
public:
property String^ OwnerLoginName {
String^ get ();
void set (String^ value);
}
[<SfcPropertyAttribute(SfcPropertyFlags.Standalone)>]
member OwnerLoginName : string with get, set
function get OwnerLoginName () : String
function set OwnerLoginName (value : String)
Valeur de propriété
Type : System.String
A String value that specifies the logon name of the job owner.
Notes
Microsoft SQL Server establishes ownership rules for jobs. Some permissions default to a job owner, and ownership forms one part of SQL Server access control.
Set the OwnerLoginName property to change ownership for the referenced job. The value must specify an existing SQL Server database user. Permission to change job ownership defaults to members of the sysadmin group.
Exemples
The following code example creates a job and gives ownership of the job to a different login.
C#
Server srv = new Server("(local)");
Job jb = new Job(srv.JobServer, "Test Job");
jb.Create();
jb.OwnerLoginName = "OperatorName"
PowerShell
$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$jb = new-object Microsoft.SqlServer.Management.Smo.Agent.Job($srv.JobServer, "Test Job")
$jb.Create()
$jb.OwnerLoginName = "OperatorName"
Voir aussi
Référence
Espace de noms Microsoft.SqlServer.Management.Smo.Agent
Autres ressources
Tâches d'administration automatisée (Agent SQL Server)
Planification des tâches administratives automatiques dans l'Agent SQL Server