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 (16 total posts)
  • 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 : 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
Privacy Statement