Signs You Need Dynamic SQL In Your SQL Server Queries

  Рет қаралды 1,330

Erik Darling (Erik Darling Data)

Erik Darling (Erik Darling Data)

Күн бұрын

Пікірлер: 20
@gustavswanepoel9207
@gustavswanepoel9207 2 ай бұрын
Thank you Erik. Great video post with a important information regarding "To Dynamic or not to Dynamic"
@ErikDarlingData
@ErikDarlingData 2 ай бұрын
Ha ha, thank you! Stay dynamic, my friend.
@PeterSchott
@PeterSchott 2 ай бұрын
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. :)
@ErikDarlingData
@ErikDarlingData 2 ай бұрын
My Rates Are Reasonable™️
@TuanTran-dt2bh
@TuanTran-dt2bh 2 ай бұрын
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!!! 🤟🤟💯
@ErikDarlingData
@ErikDarlingData 2 ай бұрын
Aw, thank you! I appreciate the kind words.
@chaitanya284
@chaitanya284 2 ай бұрын
Thanks Erik, I am also fan of dynamic sql but had some doubts which you cleared
@ErikDarlingData
@ErikDarlingData 2 ай бұрын
Good to know! I'm glad those got cleared up.
@ahmadjuran5988
@ahmadjuran5988 2 ай бұрын
You’re a good person i love your content thanks ❤️
@ErikDarlingData
@ErikDarlingData 2 ай бұрын
Aw, thank you! Appreciate the kind words.
@douglascoats7081
@douglascoats7081 2 ай бұрын
Nice. I totally expect to see some kitchen sink query nonsense next lol
@ErikDarlingData
@ErikDarlingData 2 ай бұрын
We shall see.
@vasylpavuk391
@vasylpavuk391 2 ай бұрын
Thank you for the nice description. Do you also have signs that Dynamic SQL is overused? Greetings from Ukraine.
@ErikDarlingData
@ErikDarlingData 2 ай бұрын
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.
@2Fast4Mellow
@2Fast4Mellow 2 ай бұрын
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...
@ErikDarlingData
@ErikDarlingData 2 ай бұрын
It doesn't throw an error. Try it out some time.
@2Fast4Mellow
@2Fast4Mellow 2 ай бұрын
@@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'
@ErikDarlingData
@ErikDarlingData 2 ай бұрын
You are free to write queries as they please you.
@vklude
@vklude 2 ай бұрын
Missing some examples how those queries could be replaced with dynamic sql
@ErikDarlingData
@ErikDarlingData 2 ай бұрын
I have lots of videos about that. Check those out.
Why Expressions Are Better Than Local Variables For Performance In SQL Server
21:41
Erik Darling (Erik Darling Data)
Рет қаралды 2 М.
Hot Tips For Safer Dynamic SQL In SQL Server
21:59
Erik Darling (Erik Darling Data)
Рет қаралды 1,1 М.
这是自救的好办法 #路飞#海贼王
00:43
路飞与唐舞桐
Рет қаралды 60 МЛН
Office Hours: SQL Server Questions & Answers
21:48
Brent Ozar Unlimited
Рет қаралды 1,7 М.
A Little About Paging Queries And Batch Mode In SQL Server
19:45
Erik Darling (Erik Darling Data)
Рет қаралды 947
Fundamentals of Selects
25:21
Smart Postgres
Рет қаралды 2,9 М.
pg_duckdb: Postgres analytics just got faster with DuckDB
14:19
MotherDuck
Рет қаралды 3,9 М.
Coding Was HARD Until I Learned These 5 Things...
8:34
Elsa Scola
Рет қаралды 607 М.
How to Think Like the SQL Server Engine
1:40:28
Brent Ozar Unlimited
Рет қаралды 14 М.
A Little About Working With Binary and Varbinary Data In SQL Server
14:16
Erik Darling (Erik Darling Data)
Рет қаралды 453
Advanced String Searching In SQL Server
14:31
Erik Darling (Erik Darling Data)
Рет қаралды 1 М.
Solving one of PostgreSQL's biggest weaknesses.
17:12
Dreams of Code
Рет қаралды 209 М.
A Little About Optimizer Timeouts In SQL Server
14:23
Erik Darling (Erik Darling Data)
Рет қаралды 516