Aan de slagGa gratis aan de slag

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

Deze oefening maakt deel uit van de cursus

Functions for Manipulating Data in SQL Server

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

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;
Code bewerken en uitvoeren