Just curious, what are your SQL pet peeves ?

  • Sean Lange (5/29/2014)


    Luis Cazares (5/29/2014)

    JOIN keywords on the right of the tables.

    +1000 That one drives me nuts!!! (ok I know it is a short trip)

    NOT a fan of that format style either. At least ctrl ky fixes that.

    Same with trailing commas. I dislike that practice but it is an easy one to fix with a little ctrl ky.

    In case you are wondering, I dislike trailing commas because it makes it more of a pain to comment out a column if I want to test the results without the column. It also helps break up the list kind of like bullet points.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • SQLRNNR (5/29/2014)


    Sean Lange (5/29/2014)


    Luis Cazares (5/29/2014)

    JOIN keywords on the right of the tables.

    +1000 That one drives me nuts!!! (ok I know it is a short trip)

    NOT a fan of that format style either. At least ctrl ky fixes that.

    Same with trailing commas. I dislike that practice but it is an easy one to fix with a little ctrl ky.

    In case you are wondering, I dislike trailing commas because it makes it more of a pain to comment out a column if I want to test the results without the column. It also helps break up the list kind of like bullet points.

    I go back and forth on the trailing commas. I don't much like the look of leading ones but I don't like the extra effort with trailing ones. 😉

    _______________________________________________________________

    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/

  • SQLRNNR (5/29/2014)


    Sean Lange (5/29/2014)


    Luis Cazares (5/29/2014)

    JOIN keywords on the right of the tables.

    +1000 That one drives me nuts!!! (ok I know it is a short trip)

    NOT a fan of that format style either. At least ctrl ky fixes that.

    Same with trailing commas. I dislike that practice but it is an easy one to fix with a little ctrl ky.

    In case you are wondering, I dislike trailing commas because it makes it more of a pain to comment out a column if I want to test the results without the column. It also helps break up the list kind of like bullet points.

    But what does ctrl ky do?

    _______________________________________________________________

    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/

  • Sean Lange (5/29/2014)


    SQLRNNR (5/29/2014)


    Sean Lange (5/29/2014)


    Luis Cazares (5/29/2014)

    JOIN keywords on the right of the tables.

    +1000 That one drives me nuts!!! (ok I know it is a short trip)

    NOT a fan of that format style either. At least ctrl ky fixes that.

    Same with trailing commas. I dislike that practice but it is an easy one to fix with a little ctrl ky.

    In case you are wondering, I dislike trailing commas because it makes it more of a pain to comment out a column if I want to test the results without the column. It also helps break up the list kind of like bullet points.

    But what does ctrl ky do?

    it is the shortcut in sql prompt to reformat the code to match your preferences. Sure it takes some time to define your preferences, but it saves a lot of time and angst down the road.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • SQLRNNR (5/29/2014)


    Sean Lange (5/29/2014)


    SQLRNNR (5/29/2014)


    Sean Lange (5/29/2014)


    Luis Cazares (5/29/2014)

    JOIN keywords on the right of the tables.

    +1000 That one drives me nuts!!! (ok I know it is a short trip)

    NOT a fan of that format style either. At least ctrl ky fixes that.

    Same with trailing commas. I dislike that practice but it is an easy one to fix with a little ctrl ky.

    In case you are wondering, I dislike trailing commas because it makes it more of a pain to comment out a column if I want to test the results without the column. It also helps break up the list kind of like bullet points.

    But what does ctrl ky do?

    it is the shortcut in sql prompt to reformat the code to match your preferences. Sure it takes some time to define your preferences, but it saves a lot of time and angst down the road.

    Had a feeling it might be sql prompt. Don't have that one. :crying: I have to use the freebie one. It does many of the same things as far as formatting.

    _______________________________________________________________

    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/

  • Sean Lange (5/29/2014)


    SQLRNNR (5/29/2014)


    Sean Lange (5/29/2014)


    SQLRNNR (5/29/2014)


    Sean Lange (5/29/2014)


    Luis Cazares (5/29/2014)

    JOIN keywords on the right of the tables.

    +1000 That one drives me nuts!!! (ok I know it is a short trip)

    NOT a fan of that format style either. At least ctrl ky fixes that.

    Same with trailing commas. I dislike that practice but it is an easy one to fix with a little ctrl ky.

    In case you are wondering, I dislike trailing commas because it makes it more of a pain to comment out a column if I want to test the results without the column. It also helps break up the list kind of like bullet points.

    But what does ctrl ky do?

    it is the shortcut in sql prompt to reformat the code to match your preferences. Sure it takes some time to define your preferences, but it saves a lot of time and angst down the road.

    Had a feeling it might be sql prompt. Don't have that one. :crying: I have to use the freebie one. It does many of the same things as far as formatting.

    In the end, as long as it saves pain on the eyes with having to deal with muck code from other people - it's all good.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Databases that have been restored to a new database name, but the logical file names have not been changed.

    INSERTS without columns specified.

    Pages and pages of commented out code (I would prefer they keep a backup of the original and just delete the redundant code).

    Itellisense that sorts columns alphabetically rather than based on the table design (not really SQL that one, but it is related)

    Having (sometimes) to Divide'n'Conquer because the optimiser can't handle the truth.

    Topics about SQL in the "Anything that is NOT about SQL!" forum 😀

    MM



    select geometry::STGeomFromWKB(0x0106000000020000000103000000010000000B0000001000000000000840000000000000003DD8CCCCCCCCCC0840000000000000003DD8CCCCCCCCCC08408014AE47E17AFC3F040000000000104000CDCCCCCCCCEC3F9C999999999913408014AE47E17AFC3F9C99999999991340000000000000003D0000000000001440000000000000003D000000000000144000000000000000400400000000001040000000000000F03F100000000000084000000000000000401000000000000840000000000000003D0103000000010000000B000000000000000000143D000000000000003D009E99999999B93F000000000000003D009E99999999B93F8014AE47E17AFC3F400000000000F03F00CDCCCCCCCCEC3FA06666666666FE3F8014AE47E17AFC3FA06666666666FE3F000000000000003D1800000000000040000000000000003D18000000000000400000000000000040400000000000F03F000000000000F03F000000000000143D0000000000000040000000000000143D000000000000003D, 0);

  • Forum Etiquette: How to post Reporting Services problems
  • [/url]
  • Forum Etiquette: How to post data/code on a forum to get the best help - by Jeff Moden
  • [/url]
  • How to Post Performance Problems - by Gail Shaw
  • [/url]

  • mister.magoo (5/29/2014)


    Databases that have been restored to a new database name, but the logical file names have not been changed.

    INSERTS without columns specified.

    Pages and pages of commented out code (I would prefer they keep a backup of the original and just delete the redundant code).

    Itellisense that sorts columns alphabetically rather than based on the table design (not really SQL that one, but it is related)

    Having (sometimes) to Divide'n'Conquer because the optimiser can't handle the truth.

    Topics about SQL in the "Anything that is NOT about SQL!" forum 😀

    All top shelf pet peeves.:-D

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • I agree with a lot of what's been said, but I don't much care whether commas are leading or trailing.

    Some extra hates are

    code layout that forces frequent left/right scrolling even on a very wide screen

    using 6 space tabs (I prefer 2 space tabs, but can put up with 4 at a push)

    order clauses on the LHS of a union operator (and other meaningless order clauses)

    embedded SQL other than SP calls

    an app passing strings to be used other than as string parameters

    hungarian notation

    systems where the support team doesn't have adequate access to fix problems (and DBAs who want to impose such stupidity)

    systems where DBAs with no sysops competence have enterprise operator status

    systems where DBAs exist who have bo SQL development competence

    systems where database developers exist who have no DBA competence

    systems where C++, VB, or Java (etcetera) programmers are allowed to write SQL without being trained in it

    (developers who use decent functional languages and logic languages writing SQL are much less of a problem)

    SQL with complex procedural (flow-control) logic (and system architecture that requires such nonsense)

    Schemas with inadequate normalisation (particularly schemas designed by those who say business rules have no part in schema design)

    Schemas which are in BCNF or higher normal form but not in EKNF

    schemas where domain constraints implied by the business rules are not enforced by check (or other) constraints

    triggers enforcing what should be check constraints

    triggers enforceing referential transparency instead of constraints

    any use of NOLOCK hint

    systems built to use the default isolation level (read committed) even for operations that need a higher isolation level.

    NULLs used lazily to evade doing proper design

    unproductive complexity

    Tom

  • Sean Lange (5/29/2014)


    SQLRNNR (5/29/2014)


    Sean Lange (5/29/2014)


    Luis Cazares (5/29/2014)

    JOIN keywords on the right of the tables.

    +1000 That one drives me nuts!!! (ok I know it is a short trip)

    NOT a fan of that format style either. At least ctrl ky fixes that.

    Same with trailing commas. I dislike that practice but it is an easy one to fix with a little ctrl ky.

    In case you are wondering, I dislike trailing commas because it makes it more of a pain to comment out a column if I want to test the results without the column. It also helps break up the list kind of like bullet points.

    I go back and forth on the trailing commas. I don't much like the look of leading ones but I don't like the extra effort with trailing ones. 😉

    Totally agree with Sean, but I still prefer trailing.

    -------------------------------------------------------------
    we travel not to escape life but for life not to escape us
    Don't fear failure, fear regret.

  • Formatting is my biggest pet peeve. This includes indenting code, spaces between column names or in the where clause. I'm trying to get in the habit of capitalizing the key words(SELECT, FROM, WHERE...) but I can't seem to do it all the time. I also dislike the use of the square brackets, I understand they are needed at times, but not all the time. And I can't seem to find the setting to turn this off when I drag tables or column names to my query(SSMS 2012).

    -------------------------------------------------------------
    we travel not to escape life but for life not to escape us
    Don't fear failure, fear regret.

  • below86 (5/30/2014)


    Formatting is my biggest pet peeve. This includes indenting code, spaces between column names or in the where clause. I'm trying to get in the habit of capitalizing the key words(SELECT, FROM, WHERE...) but I can't seem to do it all the time. I also dislike the use of the square brackets, I understand they are needed at times, but not all the time. And I can't seem to find the setting to turn this off when I drag tables or column names to my query(SSMS 2012).

    OK, one more, I would prefer that table names and column names be set up with underscores instead of it all run together, (Table_Name instead of TableName). Just easier to read IMHO. 🙂

    -------------------------------------------------------------
    we travel not to escape life but for life not to escape us
    Don't fear failure, fear regret.

  • I notice a small difference between myself and others where I work, in inserts and selects, I like each column on its own line, but I regularily deal with lines with many columns. Even worse, I occasionally have to work on one system with rather beefy views that are ENTIRELY ON ONE LINE, most likely they're generated I suppose. If I have to decifer one, its going to be some time spent reformatting and saving in a text file.

    On the other hand (ommitting the one line views), if you put many columns on one line in stored procedures, the logic can be a bit more apparent because long lists of columns DO tend to separate the other part of the statements.

    Having (sometimes) to Divide'n'Conquer because the optimiser can't handle the truth.

    I have a real theory for that one, once a query starts getting nontrivial, the number of different strategies simply multiplies beyond what the optimizer can individually test and rate in a given timeframe. But it would be nice to have a new sql keyword to help with this occasionally, something like 'TRY_HARDER' 🙂

    - Trying to use object oriented programming techniques within SQL. This comes from queries a few of my former colleagues (all Dot Net developers) used to write where they'd embed small queries into Views and Functions with their queries becoming a hierarchy of sorts. When troubleshooting I'd often have to dig 8-10 views or functions deep or more before finding where the table was actually used. A house of cards indeed.

    I'm guilty of that one! Its tough to transition from all these great programming language advances and leave things like abstraction, modularization and law of demeter behind. My running joke is that current database design has rediscovered the "one big object" antipattern!

    I'm adapting though!

  • Sean Lange (5/29/2014)


    SQLRNNR (5/29/2014)


    Sean Lange (5/29/2014)


    Luis Cazares (5/29/2014)

    JOIN keywords on the right of the tables.

    +1000 That one drives me nuts!!! (ok I know it is a short trip)

    NOT a fan of that format style either. At least ctrl ky fixes that.

    Same with trailing commas. I dislike that practice but it is an easy one to fix with a little ctrl ky.

    In case you are wondering, I dislike trailing commas because it makes it more of a pain to comment out a column if I want to test the results without the column. It also helps break up the list kind of like bullet points.

    But what does ctrl ky do?

    Ctrl-K-Y is the Red Gate SQL Prompt quick key to reformat the SQL, which I use all the time. Also the comma position is more of personal preference for sure. I agree it's easier to comment out lines with them at the front of the line, but for me it's just much easier to read when they're at the end. Again, just personal preference.

    Something else that may have been mentioned already is using DISTINCT instead of fixing the query to remove duplicate rows. I see this way too often, and IMO if the query returns unexpected duplicate rows the query isn't written correctly so adding a DISTINCT isn't the correct move.

  • ORM's

    Uncommented code

  • Viewing 15 posts - 16 through 30 (of 271 total)

    You must be logged in to reply to this topic. Login to reply