Jeff Moden (8/23/2014)
Sean Lange (8/22/2014)
There is no valid reason that one is preferred over the other.Actually, there is 😀 ... the first code is both shorter to write and easier to read, not to mention that the original code didn't cost extra to have a change put in that didn't matter. 😉
The "valid" reasons here are subject to personal preference (other then fewer keystrokes). I would not have changed the original because I too think that is easier to read. I certainly would never force somebody to change their code because I don't like the style in which they wrote it. Now if performance was measurably an issue that would be another story.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/