Question: The new SQL Server 2008 database returns me values formatted English (date/float).
Is there a way I can set the return format ?
For example temporarely switching the database language?
Or just set the language for the current query ?
Question: The new SQL Server 2008 database returns me values formatted English (date/float).
Is there a way I can set the return format ?
For example temporarely switching the database language?
Or just set the language for the current query ?
You cannot switch the language in SQL Server for just a single statement or specify a different language for a select.
What you need to do is:
DATETIME
to string using an appropriate "style" value in your CONVERT
statement (see the MSDN docs on CONVERT for details)BOL: Specifies the language environment for the session. The session language determines the datetime formats and system messages.
DECLARE @Today DATETIME
SET @Today = '12/5/2007'
SET LANGUAGE Italian
SELECT DATENAME(month, @Today) AS 'Month Name'
SET LANGUAGE us_english
SELECT DATENAME(month, @Today) AS 'Month Name'
GO