Predict the total count

  • Comments posted to this topic are about the item Predict the total count

  • Or, if your locality sets the date format as dd/mm/yyyy, then would not the 01/07/2010 row be saved as first of July? That would seem to still result in two matches.

    But, are there other national settings that might give a different result?

  • Nice question, but since this is an international website, it was better to include some information about the server settings of the set-up. Or include some statements like SET DATEFORMAT.

    I ran a small test, and if you include the statatement SET DATEFORMAT dmy; at the beginning of the script, the result is 1.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • The question asks us to 'predict' the outcome, which implies you do it by inspection. But how is anyone supposed to know that 40358 is a relevant date serial?

    Poorly constructed question, I'd say.

  • Hi,

    Using UK regional settings my result was 1.

  • Interesting question

    but the correct answer is ... 1

  • I agree with Bob: how should we know which date 40358 is, without executing a command?

    Poor question, poor explanation as well (as pointed out in some other reactions).

    Peter Rijs
    BI Consultant, The Netherlands

  • No comment, next question... 🙂

    Best Regards,

    Chris Büttner

  • Grr. This returns 1 on my setup. Ah well.

  • Yes, there are different cultures with different dateformats. Not only strange countries from the east of Europe!

    The different order in writing dates in UK and USA was used as a clue by lord Peter Wimsey. I don't rememeber the name of that story.



    See, understand, learn, try, use efficient
    © Dr.Plch

  • Terrible question. The only correct answer is "it depends", and that answer was missing.

    If the default language of your server happens to be, for example, British English, you'll get 1 as your answer. Same for German, Dutch, French, and several other languages.

    Add this to the fact that it's impossible to know what date the number 40358 represents, and you get a question that is impossible to answer without running the code, and even after running it leaves you with a choice between two answers.

    (I used an educated guess - in my experience, over 90% of the code that does not cater for international use comes from the US, so I picked the answer I got when using SET LANGUAGE us_english)

    Please do submit more questions in the future - but not of this quality.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • Both 1 and 2 are the correct answer depending of the Dateformat set!. As others has said a poor question unless we have SET DATEFORMAT at the start.

  • Poor US-centric question. The answer is dependent upon the cultural settings of your server.

    Remember the rest of the world does not share this irrational date format. We on the whole use either day/month/year or year/month/day. Plus how is anyone supposed to know what date 40358 relates to without running a query?

    See me after class - must try harder.

  • Like selyod, with Italian settings (dd/mm/yyyy) this statement return 1

  • Even ignoring the date format problem, what is this question supposed to teach us? Why would anyone want to convert a date to a float?

Viewing 15 posts - 1 through 15 (of 54 total)

You must be logged in to reply to this topic. Login to reply