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
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
thanks! help me a lot!
ReplyDelete