Execute the following Microsoft SQL Server T-SQL scripts in Management Studio Query Editor to demonstrate the getting and setting of default language and default database:
-- Find out default language
SELECT @@language
------------
-- Find out default database
SELECT loginname as LoginName,
dbname as DefaultDatabase,
DATABASEPROPERTYEX(dbname, 'Status') as DatabaseStatus
FROM sys.syslogins
ORDER BY LoginName
------------
-- Get all languages information
EXEC sp_helplanguage
------------
-- Setting default language for login
use master
EXEC sp_defaultlanguage 'kimberlyhay', 'us_english'
GO
-- SQL Server 2005 and onward
ALTER LOGIN kimberlyhay WITH DEFAULT_LANGUAGE = British;
GO
-- Languages in SQL Server 2008 with dateformat
SELECT LanguageID = langid,
name,
alias,
dateformat
FROM sys.syslanguages
ORDER BY langid
GO
-- Results
LanguageID | name | alias | dateformat |
0 | us_english | English | mdy |
1 | Deutsch | German | dmy |
2 | Français | French | dmy |
3 | 日本語 | Japanese | ymd |
4 | Dansk | Danish | dmy |
5 | Español | Spanish | dmy |
6 | Italiano | Italian | dmy |
7 | Nederlands | Dutch | dmy |
8 | Norsk | Norwegian | dmy |
9 | Português | Portuguese | dmy |
10 | Suomi | Finnish | dmy |
11 | Svenska | Swedish | ymd |
12 | čeština | Czech | dmy |
13 | magyar | Hungarian | ymd |
14 | polski | Polish | dmy |
15 | română | Romanian | dmy |
16 | hrvatski | Croatian | ymd |
17 | slovenčina | Slovak | dmy |
18 | slovenski | Slovenian | dmy |
19 | ελληνικά | Greek | dmy |
20 | български | Bulgarian | dmy |
21 | русский | Russian | dmy |
22 | Türkçe | Turkish | dmy |
23 | British | British English | dmy |
24 | eesti | Estonian | dmy |
25 | latviešu | Latvian | ymd |
26 | lietuvių | Lithuanian | ymd |
27 | Português (Brasil) | Brazilian | dmy |
28 | 繁體中文 | Traditional Chinese | ymd |
29 | 한국어 | Korean | ymd |
30 | 简体中文 | Simplified Chinese | ymd |
31 | Arabic | Arabic | dmy |
32 | ไทย | Thai | dmy |
------------
-- Setting default database for login
EXEC sp_defaultdb 'kimberlyhay', 'AdventureWorks'
-- SQL Server 2005 and SQL Server 2008
ALTER LOGIN kimberlyhay WITH DEFAULT_DATABASE = AdventureWorks2008;
------------
No comments:
Post a Comment