SQL SERVER – Puzzle – Playing with Datetime with Customer Data

Playing with Datetime became a puzzle when one conversion worked for a customer but failed for me. The input was unchanged.

One leaf-impressed tile sits between two different interpretation templates.

I was preparing for a European consulting tour when a customer sent code and data about slow queries. I restored that subset on my machine. One stored procedure contained this conversion:

SELECT CONVERT(datetime, '10 listopad 2015', 113);
The original customer screenshot supplied with the datetime puzzle.
The original customer screenshot supplied with the datetime puzzle.

My session reported a character-to-date conversion failure. The different outcome was the clue. It didn’t prove that the customer’s data was invalid.

The original challenge

  1. Why does this expression fail in one session and succeed in another?
  2. Which setting could make it work on my machine?
  3. What values can that setting take, and what should an application rely on?

My hint was Croatian months. Try the puzzle before reading the comments. A month spelling can occur in more than one language with different meanings. A successful conversion alone doesn’t establish the intended date.

Use a separate test connection for experiments. Restore any changed session setting afterward. Share your reasoning without assuming another reader’s language settings.

Related reading

A successful conversion is not proof of the intended date, it is one outcome under particular session rules.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.


Discover more from SQL Authority with Pinal Dave

Subscribe to get the latest posts sent to your email.

SQL DateTime, SQL Scripts, SQL Server
Previous Post
SQL SERVER – Puzzle – Solve Splitting Strings Puzzle
Next Post
Change in Date Format: Why LEFT Turns GETDATE Into Text

Related Posts

189 Comments. Leave new

  • It may cause of creation language environment setup on client machine.

    Reply
  • Prashanth KUmar
    April 11, 2017 7:36 pm

    SET LANGUAGE Croatian;
    select convert(datetime,’10 listopad 2015′,113)

    Reply
  • NISHIKANT GOUTAM
    April 27, 2017 8:59 pm

    set language Polish

    select convert(datetime, ’10 listopad 2015′, 113)

    –This will also result as expected ,SET LANGUAGE Croatian; is best way to do it , but in Czech and Polish listopad means November – rather than October in Croatian – perhaps because the leaves stay on the trees longer in those countries.

    Reply
  • write string date with complete format ‘2017-05-19 00:00:00’ HH:MM:SS at least or with ‘.000’

    Reply
  • hello sir, You have been providing great content, we indebted you a lot.

    Reply
  • basketball bros
    June 15, 2026 12:43 pm

    “Sounds like a busy but rewarding trip—bring on the puzzle!”

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.