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.