Target Audience:

This is for people who regularly write SQL code to solve varied problems, and who find themselves writing a lot of repetitive code, or frequently tweaking some code to fit new environments. You don’t need to know what dynamic SQL is to follow this talk.


Dynamic SQL is the name for SQL that’s written to a variable, and then executed, allowing you to modify the code you’re running based on information you gather from the database. Using dynamic SQL is like taking an airplane instead of a car – there’s some extra hassle up front, but it can go some places cars can’t, or only could after a much longer journey. It’s easy to get hung up on it starting out, because the errors are cryptic and hard to understand – but it’s worth blasting through those first barriers to add a powerful tool to your toolkit. That’s what I’m here for.

After this session, you’ll know what dynamic SQL is and what it can do. You’ll learn how to diagnose some common errors and fix them. I’ll also include some examples of problems that are either only solvable with dynamic SQL, or that would require a lot more error-prone copy-pasting without dynamic SQL. They’ll be there to show some useful design patterns, and hopefully inspire you to think of problems this might help you with.

Why I Want to Present This Session:

I learned about dynamic SQL by getting some personal instruction from colleagues. I hit all of the roadblocks you can hit square on my face, and now I’m at the point where I can catch these problems quickly and find myself relying on dynamic SQL to solve a lot of otherwise-intractable problems. Because errors in dynamic SQL are nearly impossible to find answers for by Googling, I want to give those same instructions I received years ago, so you can break through those barriers.

Additional Resources:

The following two tabs change content below.

Collin Lysford

Latest posts by Collin Lysford (see all)

Previous Post
The SQL Server Performance Tasting Menu
Next Post
Working with Very Large Tables Like a Pro in SQL Server 2017

1 Comment. Leave new

Eugene Meidinger
September 14, 2019 9:05 am

Great abstract! No suggested changes here. You communicate why the audience should care, how they should grow and you use a great analogy. Love it.


Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.