BaşlayınÜcretsiz başlayın

Parse strings to dates

Changing our language for data loading is not always feasible. Instead of using the SET LANGUAGE syntax, we can instead use the PARSE() function to parse a string as a date type using a specific locale.

We will once again use the dbo.Dates table, this time parsing all of the dates as German using the de-de locale.

Bu egzersiz, kursun bir parçasıdır

Time Series Analysis in SQL Server

Kursa Göz Atın

Egzersiz talimatları

  • Parse DateText as dates using the German locale (de-de).
  • Then, parse DateText as the data type DATETIME2(7), still using the German locale.

Uygulamalı etkileşimli egzersiz

Bu egzersizi bu örnek kodu tamamlayarak deneyin.

SELECT
	d.DateText AS String,
	-- Parse as DATE using German
	___(d.___ AS DATE USING ___) AS StringAsDate,
	-- Parse as DATETIME2(7) using German
	___(d.___ AS DATETIME2(7) USING ___) AS StringAsDateTime2
FROM dbo.Dates d;
Kodu Düzenle ve Çalıştır