Udostępnij za pośrednictwem


sysmail_update_account_sp (Transact-SQL)

Zmienia informacje z istniejącego konta poczty bazy danych.

Topic link iconKonwencje składni języka Transact-SQL

sysmail_update_account_sp [ [ @account_id = ] account_id ] [ , ] [ [ @account_name = ] 'account_name' ] ,
    [ @email_address = ] 'email_address' , 
    [ @display_name = ] 'display_name' , 
    [ @replyto_address = ] 'replyto_address' ,
    [ @description = ] 'description' , 
    [ @mailserver_name = ] 'server_name' , 
    [ @mailserver_type = ] 'server_type' , 
    [ @port = ] port_number , 
    [ @username = ] 'username' ,
    [ @password = ] 'password' ,
    [ @use_default_credentials = ] use_default_credentials ,
    [ @no_credential_change = ] changes to username and password ,
    [ @enable_ssl = ] enable_ssl 

Argumenty

  • [ @ account_id = ] account_id
    The account ID to update.account_id is int, with a default of NULL.Co najmniej jeden z account_id lub account_name musi być określona. Jeśli określone są oba, procedura zmienia nazwę konta.

  • [ @ nazwa_konta = ] "account_name'
    The name of the account to update.account_name is sysname, with a default of NULL.Co najmniej jeden z account_id lub account_name musi być określona. Jeśli określone są oba, procedura zmienia nazwę konta.

  • [ @ email_address = ] "email_address'
    Nowy adres e-mail, aby wysłać wiadomość.Adres ten musi być adresu internetowej poczty e-mail.The server name in the address is the server that Database Mail uses to send mail from this account.email_address is nvarchar(128), with a default of NULL.

  • [ @ display_name = ] "display_name'
    The new display name to use on e-mail messages from this account.display_name is nvarchar(128), with no default.

  • [ @ replyto_address = ] "replyto_address'
    The new address to use in the Reply-To header of e-mail messages from this account.replyto_address is nvarchar(128), with no default.

  • [ Opis @= ] "description'
    The new description for the account.description is nvarchar(256), with a default of NULL.

  • [ @ mailserver_name = ] "server_name'
    Nowa nazwa serwera poczty SMTP, który ma być używany dla tego konta.The computer that runs SQL Server must be able to resolve the server_name to an IP address.server_name is sysname, with no default.

  • [ @ mailserver_type = ] "server_type'
    The new type of the mail server.server_type is sysname, with no default.Dla SQL Server 2005 i nowszych wyświetlana wartość „ SMTP „ jest obsługiwany.

  • [ @port = ] port_number
    The new port number of the mail server.port_number is int, with no default.

  • [ nazwa_użytkownika @ = ] "username'
    The new user name to use to log on to the mail server.User name is sysname, with no default.

  • [ @ hasła = ] "password'
    The new password to use to log on to the mail server.password is sysname, with no default.

  • [ @ use_default_credentials =] use_default_credentials
    Określa, czy będzie wysyłana poczta do serwera SMTP przy użyciu poświadczeń usługi SQL Server Database Engine .Opcja use_default_credentials jest wartością bitową, bez wartości domyślnej.Gdy ten parametr wynosi 1, poczta bazy danych stosuje poświadczenia usługi Database Engine.Gdy ten parametr wynosi 0, poczta bazy danych stosuje parametry @username i @password w celu uwierzytelnienia na serwerze SMTP.Jeśli wartość parametrów @username i @password wynosi NULL, zostanie zastosowane uwierzytelnienie anonimowe.Przed określeniem tego parametru należy skontaktować się z administratorem serwera SMTP.

  • [ @ no_credential_change =] zmieni się nazwy użytkownika i hasła
    Określa, czy mają zostać zmienione istniejących poświadczenia (nazwy użytkownika i hasło).Kiedy ten parametr ma wartość 1, oznacza to, żadne zmiany poświadczeń i nazwa_użytkownika @ and @ hasła nie są wymagane.Kiedy ten parametr ma wartość 0, oznacza to, zmiany poświadczeń i nazwa_użytkownika @ and @ hasła należy podać.Ten parametr jest bit 0 jako wartość domyślna.

  • [ @enable_ssl = ] enable_ssl
    Określa, czy poczta bazy danych szyfruje korespondencję przy użyciu protokołu SSL (Secure Sockets Layer).Tej opcji należy użyć, jeśli serwer SMTP wymaga szyfrowania SSL.Opcja enable_ssl jest wartością bitową, bez wartości domyślnej.

Wartości kodów powrotnych

0 (sukces) lub 1 (brak)

Remarks

Po określeniu nazwy konta i identyfikator konta procedura przechowywana zmienia nazwę konta w uzupełnieniu do aktualizowania informacji o dla konta.Zmiana nazwy konta może być przydatne, aby poprawić błędy w polu Nazwa konta.

The @no_credential_change parameter can be used to make changes other than username and password for an account that is using basic uwierzytelnianie to send mail.Na przykład można włączyć protokołu SSL, bez konieczności podać nazwę użytkownika i hasło, określając @ no_credential_change = 1.

Procedura przechowywana sysmail_update_account_sp is in the msdb bazy danych, a właścicielem dbo schematu.Procedura musi być wykonane o nazwie trzy części, jeśli bieżąca baza danych nie jest msdb.

Uprawnienia

Członkostwo w grupie wymaga sysadmin stała rola serwera.

Przykłady

A.Zmiana informacji w przypadku konta

W poniższym przykładzie aktualizuje konto AdventureWorks Administrator W msdb bazy danych.Informacji dotyczących konta jest równa wartości dostarczone.

EXECUTE msdb.dbo.sysmail_update_account_sp
    ,@account_name = 'AdventureWorks Administrator'
    ,@description = 'Mail account for administrative e-mail.'
    ,@email_address = 'dba@Adventure-Works.com'
    ,@display_name = 'AdventureWorks Automated Mailer'
    ,@replyto_address = NULL
    ,@mailserver_name = 'smtp.Adventure-Works.com'
    ,@mailserver_type = 'SMTP'
    ,@port = 25
    ,@username = NULL
    ,@password = NULL
    ,@use_default_credentials = 0
    ,@enable_ssl = 0;

B.Zmiana nazwy konta i informacji dla konta

Poniższy przykład powoduje zmianę i aktualizuje informacje o koncie o identyfikatorze konta 125. Nowa nazwa konta jest Backup Mail Server.

EXECUTE msdb.dbo.sysmail_update_account_sp
    ,@account_id = 125
    ,@account_name = 'Backup Mail Server'
    ,@description = 'Mail account for administrative e-mail.'
    ,@email_address = 'dba@Adventure-Works.com'
    ,@display_name = 'AdventureWorks Automated Mailer'
    ,@replyto_address = NULL
    ,@mailserver_name = 'smtp-backup.Adventure-Works.com'
    ,@mailserver_type = 'SMTP'
    ,@port = 25,
    ,@username = NULL
    ,@password = NULL
    ,@use_default_credentials = 0
    ,@enable_ssl = 0;

C.Aby zmienić tylko zabezpieczeń SSL dla konta przy użyciu @ no_credential_change

W poniższym przykładzie zmienia ustawienia zabezpieczeń SSL dla identyfikatora konta 125. Wszystkie inne informacje o koncie pozostaje bez zmian.

EXECUTE msdb.dbo.sysmail_update_account_sp
    ,@account_id = 125
    ,@enable_ssl = 1
    ,@no_credential_change = 1;

Jeśli @ no_credential_change = 1 nie jest określony, wartość NULL jest przypisany do użytkownika @ i @ hasło, chyba że ich wartości są.

Historia zmian

Microsoft Learning

Informacje dotyczące nowego parametru @ no_credential_change zostało dodane do sekcji Składnia, argument i uwagi.

Przykład w przypadku zmiany ustawień protokołu SSL, za pomocą nowego parametru @ no_credential_change został dodany.