設定 default language 伺服器組態選項Configure the default language Server Configuration Option

適用於: 是SQL Server 否Azure SQL Database 否Azure Synapse Analytics (SQL DW) 否平行處理資料倉儲 APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

此主題描述如何使用 ,在 SQL Server 2019 (15.x)SQL Server 2019 (15.x) 中設定 SQL Server Management StudioSQL Server Management Studio default language Transact-SQLTransact-SQL伺服器組態選項。This topic describes how to configure the default language server configuration option in SQL Server 2019 (15.x)SQL Server 2019 (15.x) by using SQL Server Management StudioSQL Server Management Studio or Transact-SQLTransact-SQL. default language 選項會指定所有新建登入的預設語言。The default language option specifies the default language for all newly created logins. 若要設定預設語言,請指定所需語言的 langid 值。To set default language, specify the langid value of the language you want. langid 值可透過查詢 sys.syslanguages 相容性檢視來取得。The langid value can be obtained by querying the sys.syslanguages compatibility view.

本主題內容In This Topic

開始之前Before You Begin

建議Recommendations

  • 使用 CREATE LOGIN 或 ALTER LOGIN 可覆寫登入的預設語言。The default language for a login can be overridden by using CREATE LOGIN or ALTER LOGIN. 除非使用開放式資料庫連接 (Open Database Connectivity,ODBC) 或 OLE DB API 分別覆寫每個工作階段的語言,否則工作階段的預設語言就是該工作階段的登入語言。The default language for a session is the language for that session's login, unless overridden on a per-session basis by using the Open Database Connectivity (ODBC) or OLE DB APIs. 請注意,您只能將 default language 選項設為 sys.syslanguages 中定義的語言識別碼 (0-32)。Note that you can only set the default language option to a language ID defined in sys.syslanguages (0-32). 使用自主資料庫時,可以使用 CREATE DATABASE 或 ALTER DATABASE 為資料庫設定預設語言,以及使用 CREATE USER 或 ALTER USER 為自主資料庫使用者設定預設語言。When you are using contained databases, a default language can be set for a database by using CREATE DATABASE or ALTER DATABASE, and for contained database users by using CREATE USER or ALTER USER. 在自主資料庫中設定預設語言會接受 langid 值、語言名稱或語言別名,如 sys.syslanguages中所列。Setting default languages in a contained database accepts langid value, the language name, or a language alias as listed in sys.syslanguages.

安全性Security

權限Permissions

不含參數或只含第一個參數之 sp_configure 上的執行權限預設會授與所有使用者。Execute permissions on sp_configure with no parameters or with only the first parameter are granted to all users by default. 以同時設定兩個參數的 sp_configure 來變更組態選項或執行 RECONFIGURE 陳述式時,使用者必須取得 ALTER SETTINGS 伺服器層級權限。To execute sp_configure with both parameters to change a configuration option or to run the RECONFIGURE statement, a user must be granted the ALTER SETTINGS server-level permission. 系統管理員 (sysadmin)serveradmin 固定伺服器角色會隱含 ALTER SETTINGS 權限。The ALTER SETTINGS permission is implicitly held by the sysadmin and serveradmin fixed server roles.

使用 SQL Server Management StudioUsing SQL Server Management Studio

設定 default language 選項To configure the default language option

  1. 在物件總管中,請以滑鼠右鍵按一下伺服器,然後選取 [屬性] 。In Object Explorer, right-click a server and select Properties.

  2. 按一下 [進階] 索引標籤。Click the Advanced tab.

  3. 在 [預設語言] 方塊中,選擇 MicrosoftMicrosoft SQL ServerSQL Server 應該以哪種語言顯示系統訊息。In the Default language box, choose the language in which MicrosoftMicrosoft SQL ServerSQL Server should display system messages.

    預設語言為英文。The default language is English.

使用 Transact-SQLUsing Transact-SQL

設定 default language 選項To configure the default language option

  1. 連接到 Database EngineDatabase EngineConnect to the Database EngineDatabase Engine.

  2. 在標準列中,按一下 [新增查詢]From the Standard bar, click New Query.

  3. 複製下列範例並將其貼到查詢視窗中,然後按一下 [執行]Copy and paste the following example into the query window and click Execute. 此範例示範如何使用 sp_configuredefault language 選項設定為法文 (2)。This example shows how to use sp_configure to configure the default language option to French (2).

USE AdventureWorks2012 ;  
GO  
EXEC sp_configure 'default language', 2 ;  
GO  
RECONFIGURE ;  
GO  

如需詳細資訊,請參閱 伺服器設定選項 (SQL Server)伺服器組態選項。For more information, see Server Configuration Options (SQL Server).

後續操作:設定預設語言選項之後Follow Up: After you configure the default language option

設定會立即生效,不需要重新啟動伺服器。The setting takes effect immediately without restarting the server.

另請參閱See Also

CREATE LOGIN (Transact-SQL) CREATE LOGIN (Transact-SQL)
ALTER LOGIN (Transact-SQL) ALTER LOGIN (Transact-SQL)
CREATE USER (Transact-SQL) CREATE USER (Transact-SQL)
ALTER USER (Transact-SQL) ALTER USER (Transact-SQL)
CREATE DATABASE (SQL Server Transact-SQL) CREATE DATABASE (SQL Server Transact-SQL)
ALTER DATABASE (Transact-SQL) ALTER DATABASE (Transact-SQL)
RECONFIGURE (Transact-SQL) RECONFIGURE (Transact-SQL)
伺服器組態選項 (SQL Server) Server Configuration Options (SQL Server)
sp_configure (Transact-SQL)sp_configure (Transact-SQL)