The SQL LANGUAGE is one of the Set Function, which will set the Language or change the default language. This Set language Statement determines the system message, and datetime format.
This article will show you, How to use the SQL Server SET LANGUAGE with example. Before we get into the example, let us see the syntax behind this:
SQL LANGUAGE Syntax
The basic syntax of the SQL Server SET LANGUAGE is as shown below:
SET LANGUAGE Language_Name -- For example, SET LANGUAGE French;
SQL SET LANGUAGE Example
In this example we will show you, How the SET LANGUAGE in SQL Server will affect the datetime, and message formats. if you find it difficult to understand the language names then use sp_helplanguage stored procedure.
SELECT DATENAME(month, GETDATE()) AS 'Month Name' SET LANGUAGE French SELECT DATENAME(month, GETDATE()) AS 'Month Name' SET LANGUAGE Italian SELECT DATENAME(month, GETDATE()) AS 'Month Name'
Let me show you the system messages. For this we are selecting divide by zero statement
SET LANGUAGE English SELECT 1/0 SET LANGUAGE French SELECT 1/0 SET LANGUAGE Italian SELECT 1/0
You can see the message in different languages.
Thank You for Visiting Our Blog