Changing the default language
The language set in SQL Server can influence the way character strings are interpreted as dates.
Changing the language automatically updates the date format.
In this exercise, you will analyze the impact of the SET LANGUAGE
command on some practical examples.
You will select between the English, Croatian, and Dutch language, taking into account that they use the following formats:
Language | Date format |
---|---|
English | mdy |
Croatian | ymd |
Dutch | dmy |
Este exercício faz parte do curso
Functions for Manipulating Data in SQL Server
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
DECLARE @date1 NVARCHAR(20) = '30.03.2019';
-- Set the correct language
SET LANGUAGE ___;
SELECT
@date1 AS initial_date,
-- Check that the date is valid
ISDATE(@date1) AS is_valid,
-- Select the name of the month
___ AS month_name;