THE SQL Server Blog Spot on the Web

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

Browse by Tags

All Tags » Best Practices » habits   (RSS)
Showing page 2 of 2 (18 total posts)
  • Bad habits to kick : using SELECT or RETURN instead of OUTPUT

    In my last post in this series, I covered the use of ''bad'' characters in entity names, such as spaces or dashes.  In this post I will talk about using RETURN and OUTPUT inappropriately. Jamie Thomson touched on part of this pet peeve in response to one of the other posts in this series.  So let me ask, do you see anything wrong ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on October 9, 2009
  • Bad habits to kick : using dashes and spaces in entity names

    In my last post in this series, I talked about defining varchar columns, parameters, or variables without length.  Next I want to talk about using ''bad'' characters, like spaces or dashes, in entity names. Every once in a while, I see people who have issues with T-SQL code, or the Management Studio UI, or 3rd party applications - because ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on October 9, 2009
  • Bad habits to kick : declaring VARCHAR without (length)

    In my last post in this series, I talked about using meaningless table aliases.  This time I'm going to talk about a pet peeve of mine: declaring varchar / nvarchar variables or parameters without specifying how many characters they should hold. Thankfully, I see this issue seldom in the code I've inherited in my own systems.  But I do ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on October 9, 2009
  • Bad Habits to Kick: Not Using "AS"

    Aaron has recently been doing an absolutely fantastic series of posts detailing various ''bad habits'' that many of us pick up somewhere along the way. These coding anti-patterns aren't going to crash your server, but they will make your code more difficult to read and maintain. I'm enjoying Aaron's series so much that I've decided to join in the ...
    Posted to Adam Machanic (Weblog) by Adam Machanic on October 8, 2009
  • Bad habits to kick : using table aliases like (a, b, c) or (t1, t2, t3)

    In my last post in this series, I talked about using old-style JOINs.  Today I'd like to touch on using aliases.  No, I don't mean fake passports and a life of crime, I mean using an alias as shorthand for referencing a table or view in a query. Some code I once had to clean up on an inherited system looked a lot like ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on October 8, 2009
  • Bad habits to kick : using old-style JOINs

    In my last post in this series, I talked about using simple loops to populate large tables.  This time I'd like to focus on getting rid of old, ANSI-89 joins. I am sure most veterans know better than to use old ANSI-89 JOIN syntax, such as: SELECT o.OrderID, od.ProductID ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on October 8, 2009
  • Bad habits to kick : using loops to populate large tables

    In my last post in this series, I talked about using ORDER BY <ordinal position>.  Today I'd like to talk about using primitive loops to generate a large number of rows. Okay, I will admit, in most cases you are doing this for a demo or proof of concept, and so speed / performance is not all that important.  But using a loop to ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on October 7, 2009
  • Bad habits to kick : ORDER BY ordinal

    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.  I provided a little more background on this series over on my company's site.  Today's topic: using ordinal numbers in our ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on October 6, 2009
Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement