Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Just curious, what are your SQL pet peeves ?


Just curious, what are your SQL pet peeves ?

Author
Message
samalex
samalex
SSC Veteran
SSC Veteran (216 reputation)SSC Veteran (216 reputation)SSC Veteran (216 reputation)SSC Veteran (216 reputation)SSC Veteran (216 reputation)SSC Veteran (216 reputation)SSC Veteran (216 reputation)SSC Veteran (216 reputation)

Group: General Forum Members
Points: 216 Visits: 1050
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 Smile 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.
DBA From The Cold
DBA From The Cold
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1788 Visits: 1728
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!
Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16626 Visits: 17024
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)
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47299 Visits: 44392
Nolock
Nested views
Scalar UDFs
Queries that try to handle too many possible cases
Developers who think they know more than I do. ;-) Hehe


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
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


SQLRNNR
SQLRNNR
SSC-Insane
SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)

Group: General Forum Members
Points: 21099 Visits: 18259
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, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

Eirikur Eiriksson
Eirikur Eiriksson
SSCertifiable
SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)

Group: General Forum Members
Points: 6763 Visits: 17735
GilaMonster (5/29/2014)
Developers who think they know more than I do. ;-) Hehe

Ouch..... good thing that my title is no longer a "developer" :-P:-P
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47299 Visits: 44392
SQLRNNR (5/29/2014)
Here's one more - Devs with SA access


Fixed that for you.


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
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


SQLRNNR
SQLRNNR
SSC-Insane
SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)

Group: General Forum Members
Points: 21099 Visits: 18259
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, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

samalex
samalex
SSC Veteran
SSC Veteran (216 reputation)SSC Veteran (216 reputation)SSC Veteran (216 reputation)SSC Veteran (216 reputation)SSC Veteran (216 reputation)SSC Veteran (216 reputation)SSC Veteran (216 reputation)SSC Veteran (216 reputation)

Group: General Forum Members
Points: 216 Visits: 1050
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.
Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16626 Visits: 17024
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)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search