SQL Set Language Transact-SQL 設置國家語言

2022-06-29 19:58:32 浏览数 (1)

http://technet.microsoft.com/en-us/library/aa259215(SQL.80).aspx http://www.sqlusa.com/bestpractices/setdefaultlanguage/ http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=59051 http://msdn.microsoft.com/en-us/library/ms187335.aspx http://msdn.microsoft.com/en-us/library/aa259642(v=sql.80).aspx

代码语言:javascript复制
-- 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

-- Get languages information

EXEC sp_helplanguage

------------

-- 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

------------

 --季度
select datename(quarter,getdate())
--季度
select DATEPART(quarter,getdate())

-- Setting default database for login

EXEC sp_defaultdb 'kimberlyhay', 'AdventureWorks'

 

-- SQL Server 2005 and SQL Server 2008

ALTER LOGIN kimberlyhay WITH DEFAULT_DATABASE = AdventureWorks2008;

------------顯示各國語言的星期幾(2000,2005,2008版本支持)Geovin Du 塗聚文注
--顯示語言周幾
SET LANGUAGE swedish
select datename(weekday,getdate())
--
SET LANGUAGE 简体中文
select datename(weekday,getdate())

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/101194.html原文链接:https://javaforall.cn

0 人点赞