Archive

Posts Tagged ‘datename’

Set Language in Sql Server

When  you are working with multi lingual web applications, you may need to retrieve data like month name, day name etc to be displayed in different languages. For example month “June” is in English, its dutch translation would be “Juni” .This is possible with “Set Language languagname” feature of sql server. where language name is the name of language you want to set.. you can complete list of languages that sql support using

select * from sys.syslanguages

Below is one example using set language, retrieving day and month name in different languages:
DECLARE @Today DATETIME
SET @Today = ‘6/22/2009’

SET LANGUAGE Deutsch
SELECT DATENAME(month, @Today) AS ‘Month Name in Dutch’
SELECT DATENAME(dw, @Today) AS ‘Day Name in Dutch’

SET LANGUAGE us_english
SELECT DATENAME(month, @Today) AS ‘Month Name in English’
SELECT DATENAME(dw, @Today) AS ‘Day Name in English’

Sql Server Functions

February 24, 2009 Leave a comment

Most of us are unaware about various sql server functions..

we are only limited to functions we are knowing. but there are other useful functions which should be known.. do have a look they might be useful to you…

http://get-shorty.com/shorty/60464/