Skip to content
Home » SQL SET Language

SQL SET Language

The SET Language is one of the SQL Server SET Statement that change the default language for the session. The session language determines the datetime formats and system messages.


SET LANGUAGE [ N ] 'language'

Lets look at an example of using SET Language in SQL Server.

First we check the name of the language currently being used using @@Language function.

SELECT @@LANGUAGE AS 'Language Name'

As you can see, currently the default language ‘US English’ is being used by SQL Server.


Change the default Language using SET Language

Lets use the SET Language Statement to change the default language from US English to Spanish, and select a Month Name from current date.


SELECT @@LANGUAGE AS 'Language Name', DATENAME(month, GETDATE()) AS 'Month Name';

You can see, Now current language is set to Spanish and also Month Name is returned by Function is in Spanish Language.

You can also see, now system messages is also changed to Spanish language.

Lets produce an error case, where SQL Server will return an error message, in following statement we  purposely try to convert non convertible string into Date format and that returns an error in Spanish language.

SELECT CAST('Hello world' AS DATE) ;

Lets change the default language back to US English, and then execute all above scripts again.

Following statement returns, current language being used by SQL Server, and month name in English.

SET LANGUAGE us_english;

SELECT @@Language AS 'Language Name', DATENAME(month, GETDATE()) AS 'Month Name' ;


Lets execute the below scripts, and you can see now error message is returned in English.
SELECT CAST('Hello world' AS DATE) ;

SQL Basics TutorialSQL Advance TutorialSSRSInterview Q & A
SQL Create tableSQL Server Stored ProcedureCreate a New SSRS Project List Of SQL Server basics to Advance Level Interview Q & A
SQL ALTER TABLESQL Server MergeCreate a Shared Data Source in SSRSSQL Server Question & Answer Quiz
SQL DropSQL Server PivotCreate a SSRS Tabular Report / Detail Report
..... More.... More....More
Power BI TutorialAzure TutorialPython TutorialSQL Server Tips & Tricks
Download and Install Power BI DesktopCreate an Azure storage accountLearn Python & ML Step by stepEnable Dark theme in SQL Server Management studio
Connect Power BI to SQL ServerUpload files to Azure storage containerSQL Server Template Explorer
Create Report ToolTip Pages in Power BICreate Azure SQL Database ServerDisplaying line numbers in Query Editor Window


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.