Look ma, no hands!

It’s dynamic. It’s SQL. It’s Dynamic SQL.

Build your own strings, they said.
Execute them, they said.
It’ll be fun and fast, they said.

Dynamic SQL can be an awesome, powerful, and fast solution to a lot of performance problems. It can also be a route to sitting under your desk, banging your head against a wine bottle, wishing you could stop seeing double apostrophes mocking you.

Here’s my presentation on how dynamic SQL comes in so handy for building multi-parameter search stored procedures:

Dynamic SQL: How to Build Fast Multi-Parameter Stored Procedures from Brent Ozar

In this session, we’ll be using the Stack Overflow public database. You can use the smaller StackOverflow2010 one if you haven’t got time for the pain of downloading the full one – you’ll still get the idea of how it works.

Here’s the demo script to follow along:


Hope you enjoyed the class. If you like that, there’s more where that came from – check out SQL ConstantCare®, a system where I mentor you all year long, or my Live Class Season Pass.