Introduction Over my whole software engineering career, I have watched and learned the right way and the wrong way to style and format code. Especially […]
Pivoting data without an aggregation column
Don’t use PIVOT for non-aggregate-able data I ran into a rather displeasurable experience where a separate team of people built some very important tools for […]
Padding a string in tSQL
Gotcha There isn’t a Pad Left or Pad Right function in tSQL. Solution There is a lengthy discussion about this topic already on Stack Overflow […]
Incorrect syntax was encountered while parsing :SETVAR
Gotcha When working with SQL CMD mode every now and then I will get this vague error and I can’t figure out what the problem […]
Avoiding the Red Gate Sql compare “Non-Schema statement was ignored” warning
Gotcha I recently had to create some non-schema related objects for a database project I am working on. It caused an annoying problem with Red […]
Sql Server REPLACE function makes expression string NULL when replacement string is NULL
Obscure problem This has happened to me before, but naturally I forgot because it has been a while. The scenario is that you have dynamic […]
How to find the current profile required to send an email in SQL Server
Problem You are trying to send an email using “msdb..sp_send_dbmail” but you keep getting one of the following errors: Msg 14636, Level 16, State 1, […]
SQL Server rows appear to not be deleting
The Stupid Problem You are working on a database that you are not very familiar with as a developer – meaning that you are not […]
Sql Server tSql: DELETE statement executes but won’t delete
Problem I ran into the most puzzling issue recently where I was executing a DELETE statement inside of a transaction among other statements inside of a stored procedure. […]
I have no words for how bad this is
I think this should win the “Most Horrible Sproc Parameters” contest if there were such a thing. And then people wonder why I get mad […]