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 |
This exercise is part of the course
Functions for Manipulating Data in SQL Server
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
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;