Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

Just curious, what are your SQL pet peeves ? Expand / Collapse
Author
Message
Posted Thursday, May 29, 2014 10:38 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 12:53 PM
Points: 204, Visits: 912
Everyone has their own style of writing code and doing things, but there are some pet peeves I've developed over the years, especially when I review other people's code, and I'm curious to know what pet peeves you guys have too.

Here are some of mine:
- Commas at the beginning of the line instead of end. Not sure why this bugs me, but it does.
- Sub-Selects when a CTE or Join will work
- SSIS packages with a single Script Task and nothing else. My thought, just write it in VS, save it to an EXE, and schedule it as a Windows Task instead of adding the overhead of SSIS and SQL
- Spaces in column names. I generally try to use square brackets around my column names anyway, but I also always avoid using spaces in column names though not everyone else does
- Requests to add a Total to the end of the query. Yes, I had this request just last week. This should be in whatever presents the data and not in the SQL query pulling the data.
- 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.

Anyway, not to sound like a stickler, but just a few things that always catch my eye :) I assume most DBA's have a similar list of things that make them cringe, so just curious to see what's on anyone else's list.

Post #1575686
Posted Thursday, May 29, 2014 10:57 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 8:05 AM
Points: 1,157, Visits: 849
Completely agree with you on the nested views/stored procedures.

Trying to trouble shoot an issue when a stored procedure has called ten other procedures, which in turn call another load of procedures can be a real nightmare!
Post #1575698
Posted Thursday, May 29, 2014 12:01 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 10:47 AM
Points: 13,302, Visits: 12,165
Let's see...in no particular order.

storing datetime in ANY other datatype.

NOLOCK

Poor formatting

Not having a space between parameters in a function call (parm1,parm2,parm3)

Not having a space in a where clause or join condition. (MyColumn=SomeOtherColumn)

GUIDs as clustered indexes


_______________________________________________________________

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 Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1575746
Posted Thursday, May 29, 2014 12:11 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 7:53 AM
Points: 42,822, Visits: 35,952
Nolock
Nested views
Scalar UDFs
Queries that try to handle too many possible cases
Developers who think they know more than I do.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1575754
Posted Thursday, May 29, 2014 12:49 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 9:36 AM
Points: 21,644, Visits: 15,314
In addition to what has been said (e.g. nolock, nesting views and procs, poor formatting etc)

I don't like it when stored procedures are called "sprocs"
I don't like calling a server by some nickname (e.g. prod2 when the box name is prod4) - talk about confusion there.

Here's one more - Devs with SA access when the DBA doesn't




Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1575785
Posted Thursday, May 29, 2014 12:54 PM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 10:20 AM
Points: 1,727, Visits: 4,551
GilaMonster (5/29/2014)
Developers who think they know more than I do.

Ouch..... good thing that my title is no longer a "developer"
Post #1575789
Posted Thursday, May 29, 2014 1:06 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 7:53 AM
Points: 42,822, Visits: 35,952
SQLRNNR (5/29/2014)
Here's one more - Devs with SA access


Fixed that for you.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1575800
Posted Thursday, May 29, 2014 1:15 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 9:36 AM
Points: 21,644, Visits: 15,314
GilaMonster (5/29/2014)
SQLRNNR (5/29/2014)
Here's one more - Devs with SA access


Fixed that for you.


That in and of itself is a pet peeve. But it is far worse when a DBA doesn't even have that level of access.




Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1575804
Posted Thursday, May 29, 2014 1:16 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 12:53 PM
Points: 204, Visits: 912
Wow, I agree with literally 100% of what you guys have entered, including 'sprocs'. We have a few non-DBA's who use this verbiage, and it always makes me cringe.
Post #1575808
Posted Thursday, May 29, 2014 1:21 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 10:47 AM
Points: 13,302, Visits: 12,165
samalex (5/29/2014)
Wow, I agree with literally 100% of what you guys have entered, including 'sprocs'. We have a few non-DBA's who use this verbiage, and it always makes me cringe.


I don't know why but I always think of Vulcans when I hear "sproc".


_______________________________________________________________

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 Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1575810
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse