Converting Questionable Dates

  • g.maxfield (3/18/2016)


    I also get error

    Msg 195, Level 15, State 10, Line 2

    'VARCHAR' is not a recognized built-in function name.

    Vide supra.

  • David Day (3/18/2016)


    Then (with all due respect) the questions either need to indicate the version, or have version-specific options. Given the mess the latter would become, the former would be much more to the point (and much more in keeping with good test-writing practices... 😉 )

    For the questions of the day, it is generally accepted that if no version information is supplied in the question, the latest released version of SQL Server is to be assumed. The same assumption is made for environment settings. If no environment settings are indicated in the question, default settings are to be assumed.

  • Looks like another version error issue! How do we know until we test the code? Could the version number be added to the Question then in that case it's fairer to those of us on lower versions? Just a thought. This would reduce the error rate on those who are compromised by version restrictions.

  • g.maxfield (3/18/2016)


    Looks like another version error issue! How do we know until we test the code? Could the version number be added to the Question then in that case it's fairer to those of us on lower versions? Just a thought. This would reduce the error rate on those who are compromised by version restrictions.

    If no version is defined, then the current released version should be assumed.

    This function was released on 2012. If you're not capable to update versions at work, you should do it on yourself to update knowledge and be prepared for what may come.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Nice amusing question.

    Very misleading title, though 😀

    Tom

  • Well thought through. Thanks, Steve!

  • Apologies on the versioning.

    SQL 2008R2 and below are no longer supported from MS as they are too old. Typically the current version(s) should be used, though I changed the question today to say SQL 2012 +.

  • The best explanation I found here

    "When character expressions are converted to a character data type of a different size, values that are too long for the new data type are truncated."

  • Another week-end question for tired DBA.

    As nowhere in the query I have not seen explicitly a type ( Date , DateTime ... ) , I concluded that it will happen only a truncation of the input string. Maybe it is not the good way to reply , only the way that a C#, .Net developer is thinking.

    Thanks for the question and for the replies ( I have discovered some words I didn't know , don't forget I am an old Frenchie using the English language on forums or sites like this one )

  • Thanks for the question.

  • Thanks for the advice on versions. I'll look into this for future questions :unsure:

  • Nice question, thanks.

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

Viewing 12 posts - 16 through 26 (of 26 total)

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