SQL Clone
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-Addicted
SSC-Addicted (423 reputation)SSC-Addicted (423 reputation)SSC-Addicted (423 reputation)SSC-Addicted (423 reputation)SSC-Addicted (423 reputation)SSC-Addicted (423 reputation)SSC-Addicted (423 reputation)SSC-Addicted (423 reputation)

Group: General Forum Members
Points: 423 Visits: 1061
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
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2187 Visits: 1746
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
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26100 Visits: 17536
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 Modens 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 Guru
SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)

Group: General Forum Members
Points: 87265 Visits: 45272
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-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32320 Visits: 18552
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
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15116 Visits: 18598
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 Guru
SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)

Group: General Forum Members
Points: 87265 Visits: 45272
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-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32320 Visits: 18552
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-Addicted
SSC-Addicted (423 reputation)SSC-Addicted (423 reputation)SSC-Addicted (423 reputation)SSC-Addicted (423 reputation)SSC-Addicted (423 reputation)SSC-Addicted (423 reputation)SSC-Addicted (423 reputation)SSC-Addicted (423 reputation)

Group: General Forum Members
Points: 423 Visits: 1061
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
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26100 Visits: 17536
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 Modens 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