THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | Join | Help
in Search

Browse by Tags

All Tags » bad habits   (RSS)
Showing page 1 of 2 (16 total posts)
  • Bad Habits to Kick : Thinking a WHILE loop isn't a CURSOR

    I see a lot of people suggest while loops instead of cursors in situations where row-based processing is required (or, at least, where folks think that row-based processing is required). Sometimes the justification is that constructing a while loop is simpler and more straightforward than constructing a cursor. Others suggest that a while loop is ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on January 26, 2012
  • Bad Habits to Kick : Using AS instead of = for column aliases

    This one is quite subjective, and I'm sure I will face plenty of opposition - not only because it's a preference thing and many people are married to their preferences, but also because it violates the strict interpretation of the standard. Personally, I'm more worried about the former than the latter - I have no concerns whatsoever that ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on January 23, 2012
  • What do BETWEEN and the devil have in common?

    I'll make no bones about it: BETWEEN is evil. For one, the meaning of the word in English does not always match the meaning of the operator in T-SQL. In T-SQL, BETWEEN is an *inclusive* range - not everyone gets that. Sure, in casual conversation when someone says ''between 3 and 6'' the answer really could be 3, 4, 5 or 6; but other times, they ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on October 19, 2011
  • Bad Habits to Kick : Using shorthand with date/time operations

    I've come across quite a bit of code that uses date/time shorthand that can either be confusing or downright dangerous. There are two areas I want to focus on: shorthand for date arithmetic, and shorthand for date parts. Date Arithmetic This one I mentioned quite briefly in a previous ''Bad Habits to Kick'' post, but I see it in use enough ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on September 20, 2011
  • Bad Habits to Kick : Using EXEC() instead of sp_executesql

    Today in my T-SQL: Bad Habits to Kick session at SQL Saturday #84 in Kalamazoo, a user asked if SQL Server supported anything like bind variables in Oracle when using dynamic SQL. When using dynamic SQL, you have two choices: EXEC() / EXECUTE(), or sp_executesql. Early on my career, I used EXEC() a lot, because it was much easier. I've since ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on September 17, 2011
  • T-SQL Tuesday #21 : Crap Code

    Yes, Adam is right: we've all written crap code (the topic of this month's T-SQL Tuesday Wednesday. Usually we have an excuse: tight deadline, short shelf life of the code, or didn't know any better. I'm sure if I perused my career codebase I'd find tons and tons of examples that I'd write differently today, because back then it fell under ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on August 10, 2011
  • T-SQL Tuesday #20 : T-SQL Best Practices

    T-SQL Tuesday, the invention of Adam Machanic (@AdamMachanic), is what he calls a recurring, revolving blog party. Each month, a new host picks a topic, invites bloggers of all levels to join in, and then after all the submissions are in, writes a summary of all of the entries. This encourages people to participate in the community more ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on July 12, 2011
  • SQL Saturday #71, Boston: "T-SQL : Bad Habits to Kick"

    In Boston today I presented my ''Bad Habits to Kick'' deck to 66 people. You can download the deck and samples from the SQL Saturday web site or directly from http://bit.ly/AB-71-Slides. Like the Chicago event, folks were encouraged to submit feedback immediately after the session, by picking a random eval and giving the winner a token (in this ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on April 2, 2011
  • The old "do as I say, not as I do" problem

    Microsoft is often considered a leader, an innovator, a trend-setter.  The same could be said for Apple, Google, and a host of other tech companies.  And each of those has its set of critics as well, who think that the company is the opposite - or worse.  Some people think it is a good idea to model their own code, architecture or ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on December 14, 2010
  • Bad habits to kick : ignoring I/O

    In my last post in this series, I talked about problems associated with creating (and using) what I call the ''uber-view.''  This time, in line with tomorrow's T-SQL Tuesday hosted by Mike Walsh, I wanted to talk about some I/O issues that tend to get ignored in a lot of environments. Introduction In my experience, today's SQL Server ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on March 8, 2010
1 2 Next >
Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement