Thank you Erik. Great video post with a important information regarding "To Dynamic or not to Dynamic"
@ErikDarlingData2 ай бұрын
Ha ha, thank you! Stay dynamic, my friend.
@PeterSchott2 ай бұрын
ISNULL/COALESCE seems to be a pretty common pattern I see in a lot of views people write. I get the reasons for it with little control over the underlying data and not knowing if the app (vendor) put a NULL in or stored some default, but still annoying trying to write that sort of code. I do appreciate the reminders about dynamic SQL and checking for local variables. I'm fighting a proc right now that takes a regular datetime type and then converts that to an Epoch value in the proc to do comparisons. This seems like a good time to revisit either dynamic SQL or tweaking the datatypes. :)
@ErikDarlingData2 ай бұрын
My Rates Are Reasonable™️
@TuanTran-dt2bh2 ай бұрын
One of the best! Your content is always exceed the expectation. Glad that I've joined and learned a lots from your training. Keep it up, man!!! 🤟🤟💯
@ErikDarlingData2 ай бұрын
Aw, thank you! I appreciate the kind words.
@chaitanya2842 ай бұрын
Thanks Erik, I am also fan of dynamic sql but had some doubts which you cleared
@ErikDarlingData2 ай бұрын
Good to know! I'm glad those got cleared up.
@ahmadjuran59882 ай бұрын
You’re a good person i love your content thanks ❤️
@ErikDarlingData2 ай бұрын
Aw, thank you! Appreciate the kind words.
@douglascoats70812 ай бұрын
Nice. I totally expect to see some kitchen sink query nonsense next lol
@ErikDarlingData2 ай бұрын
We shall see.
@vasylpavuk3912 ай бұрын
Thank you for the nice description. Do you also have signs that Dynamic SQL is overused? Greetings from Ukraine.
@ErikDarlingData2 ай бұрын
Good question. I'd never thought about that much. I suppose some line has to be drawn about the necessity of it in some places, but beyond that I'm not sure.
@2Fast4Mellow2 ай бұрын
Pretty sure the 'select 1/0' will result in a division by zero exception. Dynamic sql can be great, but you have to be careful with literal values that comes from outside. I spend a lot of time rewriting dynamic queries to dynamic sql with parameters queries because query plans where messed up because user_id would change in every query...
@ErikDarlingData2 ай бұрын
It doesn't throw an error. Try it out some time.
@2Fast4Mellow2 ай бұрын
@@ErikDarlingData Inside an exists clause it indeed does work. But outside exists it does throw an error. I think it is okay because the whole select clause it ignored inside the exists clause. Personally I would rather see a 'select 1 from'
@ErikDarlingData2 ай бұрын
You are free to write queries as they please you.
@vklude2 ай бұрын
Missing some examples how those queries could be replaced with dynamic sql
@ErikDarlingData2 ай бұрын
I have lots of videos about that. Check those out.