Tuesday, 15 October 2013

How to Display DateTime Formats in Different Languages using SQL Server

Hi friends, in this article I will explain about How to Display DateTime Formats in Different Languages using SQL Server.
I already explained in the previous articles about How to Calculate Age from Date Of Birth using SQL ServerHow to encrypt/decrypt string in sql server and How to get second-highest salary employees in a table,Find 2nd highest salary in SQL server, SQL Query for second maximum salary from employee table

You can get the list of languages support in SQL SERVER by using below Query
select * from sys.syslanguages


The output of above code as shown in the below figure.


We can set the languages  as shown in the below in code.
SET LANGUAGE English
SELECT DATENAME(DW, GETDATE()) AS 'DAY Name in English'

SET LANGUAGE Polish
SELECT DATENAME(M, GETDATE()) AS 'Month Name in Polski'

SET LANGUAGE Italian
SELECT DATENAME(DW , GETDATE()) AS 'DayName in Italian'

SET LANGUAGE ROMANIAN
SELECT DATENAME(M, GETDATE()) AS  'Month Name in Romanian'

SET LANGUAGE THAI
SELECT DATENAME (DW,GETDATE()) AS 'DAYNAME in THAI'
GO

The output of above code as shown in the below figure.

No comments:

Post a Comment

© 2012-2018 Aspdotnet-Kishore.blogspot.com. All Rights Reserved.
The content is copyrighted to Kishore and may not be reproduced on other websites without permission from the owner.