October 27, 2009 at 7:21 am
dmoldovan (10/27/2009)
Bob, Tom - please see http://sqlblog.com/blogs/jonathan_kehayias/archive/2009/02/19/sql-tip-keep-your-presentation-logic-in-your-presentation-layer.aspx...
Let me be clear, my comments about the usefulness of convert are in the context of doing an import data task, or a one-off query to go to another system. For example, I occasionally pull data that feeds some SAS code for one of our statistics gurus. He asks me to convert dates to YYYYMMDD.
Now, I am absolutely sure that I waste a few cycles doing this with a CONVERT() in my query. But the system is under no CPU stress, and the alternative is to either refuse his request, requiring him to figure out how to handle native data formats on his side and go through all his code making changes... or to learn enough SAS to do it myself. That is a waste of valuable man hours to keep an insignificant load off the CPU. Those man-hours could be better spent on projects that would REALLY make a difference to performance, or to my company's revenue. In this case, common sense dictates that I sacrifice a little machine resource to save a lot of people resource.
Machines are still meant to serve man.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 27, 2009 at 7:39 am
Bob - at the end of the article there is a link to another post containing some "pros" for using CONFERT(), etc...
October 27, 2009 at 8:05 am
My apologies for not reading it in the entirety. I will go back and do that now. Thanks. 🙂
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 27, 2009 at 8:29 am
dmoldovan (10/27/2009)
Bob, Tom - please see http://sqlblog.com/blogs/jonathan_kehayias/archive/2009/02/19/sql-tip-keep-your-presentation-logic-in-your-presentation-layer.aspx...
Both articles make good points, but note that I did say with some reporting applications. For instance it would be wasted time with a Crystal report.
I think that the original blog picked an example that doesn't really line up with the conversation that we're having, but his opinion is valid never the less, except the part about the T-SQL example being more difficult to read than C# or VB. That would definitely be an 'in the eye of the beholder' opinion.
As for performance. That is always a consideration, but tweaking it to the max can be a luxury item with some jobs. For instance with a medium sized company needing a custom report from an over-powered, under-utilized database server. I don't work with Enterprise level projects every day, but my time still counts, and ultimately giving the client the most bang for his buck is what we are measured by.
October 27, 2009 at 10:03 am
There's been a lot of interesting discussion here, but now I'm curious what Volkan, the author of this QOD, had in mind. Was it to show that CONVERT could isolate the time portion of a datetime? The explanation given would imply that. Or was the use of mixed delimiters the "trick" to which the title referred?
Viewing 5 posts - 16 through 19 (of 19 total)
You must be logged in to reply to this topic. Login to reply