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
SQLRNNR
SQLRNNR
SSC Guru
SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)

Group: General Forum Members
Points: 67041 Visits: 18570
Sean Lange (5/29/2014)
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".


I think of Spacely Space Sprockets



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
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40902 Visits: 19475
Sean Lange (5/29/2014)
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".

That, and I ignore the pun, would be my pointy ears:-D
Eirikur Eiriksson
Eirikur Eiriksson
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40902 Visits: 19475
samalex (5/29/2014)
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:

Just a quick thought:
- Commas at the beginning of the line instead of end. Not sure why this bugs me, but it does.

Columnar editing with variable length lines! Makes it easier, and of course ignoring JC's rant about punch cards.

- Sub-Selects when a CTE or Join will work
Working from bottom up, CTEs may not be the most readable options
- 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


Gives an immense power, packets creating packets, fully metadata driven, do it all the time.

- 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


+100!


- 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.

+1, cannot object to that!

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.

Not being a DBA, no commentw00t
Luis Cazares
Luis Cazares
SSC-Forever
SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)

Group: General Forum Members
Points: 42219 Visits: 19829
I'm not in favor of "sprocs" but I prefer them over "store procedures". AFAIK, we're not selling anything.
At work we have DTS that simply call an SP or even better, they have a SQL task with "SELECT 1".
But one of the worst things is having to read code written as if formatting was prohibited and the less lines the better.
Other things are:
SQL-86 Joins and JOIN keywords on the right of the tables.


Luis C.
General Disclaimer:
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?


How to post data/code on a forum to get the best help: Option 1 / Option 2
Sean Lange
Sean Lange
SSC Guru
SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)

Group: General Forum Members
Points: 63021 Visits: 17959
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)

_______________________________________________________________

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)
SQLRNNR
SQLRNNR
SSC Guru
SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)

Group: General Forum Members
Points: 67041 Visits: 18570
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

Sean Lange
Sean Lange
SSC Guru
SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)

Group: General Forum Members
Points: 63021 Visits: 17959
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.

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)
Sean Lange
Sean Lange
SSC Guru
SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)

Group: General Forum Members
Points: 63021 Visits: 17959
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.

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)
SQLRNNR
SQLRNNR
SSC Guru
SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)

Group: General Forum Members
Points: 67041 Visits: 18570
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

Sean Lange
Sean Lange
SSC Guru
SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)

Group: General Forum Members
Points: 63021 Visits: 17959
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.

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