Predict the total count

  • bazzkar

    SSC Veteran

    Points: 270

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

  • john.arnott

    SSChampion

    Points: 11882

    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?

  • Koen Verbeeck

    SSC Guru

    Points: 258854

    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

  • Bob JH Cullen

    SSCrazy

    Points: 2022

    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.

  • Jinx-640161

    Ten Centuries

    Points: 1078

    Hi,

    Using UK regional settings my result was 1.

  • micniv

    Valued Member

    Points: 50

    Interesting question

    but the correct answer is ... 1

  • Peter Rijs

    Hall of Fame

    Points: 3380

    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

  • Christian Buettner-167247

    SSChampion

    Points: 13729

    No comment, next question... 🙂

    Best Regards,

    Chris Büttner

  • selyod

    Valued Member

    Points: 59

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

  • honza.mf

    SSCertifiable

    Points: 5519

    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

  • Hugo Kornelis

    SSC Guru

    Points: 64645

    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/

  • SG Cowley

    Hall of Fame

    Points: 3132

    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.

  • ipounder

    SSCommitted

    Points: 1541

    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.

  • Andrea-227199

    SSC Rookie

    Points: 48

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

  • Toreador

    SSChampion

    Points: 11220

    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 55 total)

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