1
kudos
spam Kudos Remove

Bad habits to kick : ORDER BY ordinal

published 842 days, 22 hours, 5 minutes ago posted by sasa 850 days, 17 hours, 30 minutes ago
Saturday, October 17, 2009 3:12:46 PM GMT Friday, October 09, 2009 7:47:47 PM GMT

A few weeks ago, I wrote a post about forming a new habit: always terminate statements with semi-colons.  Today I thought I would start a series on kicking bad habits that many of us have developed over time.  Today's topic: using ordinal numbers in our ORDER BY clauses.  At least once a week, I catch myself using ordinal position to define order.  For example, I might have this:  SELECT foo, bar FROM dbo.splunge ORDER BY 1, 2 DESC; This is lazy shorthand, and is bound to get screwed up at som...

category: News | clicked: 0 | | source: sqlblog.com | show counter code
tags: Best Practices, future-proofing, habits, T-sql

No comments yet, be the first one to post comment.

To post your comment please login or signup