This months T-SQL Tuesday (January 2022) invite is brought to you by Andy Yun – @sqlbek.
Andy’s asked us to write about preconceived notions.
Anyway, before I put pen to paper (so to be speak) – or more accurately fingers to keyboard, I decided to have a look around the web at the definitions for “Preconceived Notions” – I like this one,
“a personal belief or judgment that is not founded on proof or certainty”
And my problem for at least the early part of career was that I was too willing to take the word of other people at face value, even when I suspected they weren’t correct rather than debating with them. I guess I had the preconceived notion that others preconceived notions (that often they were quite happy to tell anybody who cared to listen about) were correct.
Here’s an example, somebody once told me ‘All cursors are bad, never write one’ – and then their preconceive notion became mine (unfortunately)
Now, I soon found that cursors did have there uses, maybe not as a standard approach in production, but certainly to help me ‘write code , that writes code’.
I used them for things like, generating comma separated lists for select statements that I’d pulled from INFORATION_SCHEMA views.
I used then to create multiple DDL statements and cycle through a list, executing individual statements programmatically- usually just on my local dev machine.
Most of this type of thing I can now do with other concepts, such as XML for generating CSV lists or window functions for retrieving values from rows other than the current one.
While my use of cursors has probably subsided over the years, I still use them – but mainly when I’m developing to ‘write code, that writes code’
The moral of story – I think – is avoid letting other peoples reconceived notions become your preconceived notions, that how myths start and are continue.
I soon learned my lesson to question everything, the world revolves around people – or is it data? – but that’s just an expression, or is it yet another preconceived notion 🙂
Have a great day.