Dec 5, 2009

How to Display DateTime Formats in Different Languages using SQL Server


SET LANGUAGE can be used to specify the language environment for the current session. You can use the sys.syslanguages to first determine the languages present in an instance of SQL Server

SELECT * FROM sys.syslanguages

image

Once you know the different languages, use SET LANGUAGE to display the DateTime in the language you desire as shown below. You can specify either the alias of the language (Spanish, German) or the name(us_english) as the argument. The query shown below displays the Day Name in different languages:

SET LANGUAGE Spanish
SELECT DATENAME(dw, GETDATE()) AS 'DayName'

SET LANGUAGE German
SELECT DATENAME(dw, GETDATE()) AS 'DayName'

SET LANGUAGE us_english
SELECT DATENAME(dw, GETDATE()) AS 'DayName'
GO

OUTPUT

image

Submit this story to DotNetKicks

Related Posts In This Category



Widget by Hoctro | Jack Book

 
  Feedback:

comments

0 Responses to "How to Display DateTime Formats in Different Languages using SQL Server"
 

Copyright 2009 All Rights Reserved SQL Server Curry by Suprotim Agarwal