MS needs to improve the performance of the Format command - a Convert(101) makes NO sense when reviewing code for date formatting problems - unlike the format which is highly understandable (and maintainable). We all agree performance is important, but not at the cost of mysterious functions. Thanks for the article.
I 100% agree. It's a wonderful function for ease of use. If it worked much faster, I wouldn't have written the article. As for reviewing code, most people never have an issue with it because it's usually not the final format that matters in what they're looking for. If it actually is what they're looking for, then it only takes seconds to either look it up or write SELECT CONVERT(VARCHAR(30),GETDATE(),101).
Usually, folks never have to do that with my code because I put in a comment like -- mm/dd/yyyy in the code next to the convert.
If I know I'm going to be reviewing a lot of code where the format of the dates is important, then I'll copy and paste the convert chart into a document and then I can lookup "101" or whatever almost instantaneously. I think I'd only have to do that once or twice to remember it long enough to make it through the code.
And I disagree on FORMAT being so very readable because of the format shortcuts smarties use like "D". Figure that one out if you aren't familiar with it.
And, to be sure, if FORMAT wasn't at least 17.1 times slower, I'd be using it, for sure. It's like the STR() function... it's usually only about 3 times slower than CONVERT but I still won't use it because it's just another slice in the "Death by a thousand cuts". In my mind, I ask, why do it wrong when you know how to easily do it right?
And I have to say the same to you as I did to the person in my last post... Thanks for the read and thank you for the feedback and I mean that seriously and nicely. You're one of the very few out of more than 11,000 in the last 36 hours.