Category Archives: Dynamic SQL
-
Comments in your generated code : T-SQL Tuesday #155
4October 11, 2022 by Kenneth Fisher
The ever amazing Steve Jones (blog|twitter) is our host this month. And in case you didn’t know he also is …
Continue reading -
Running dynamic SQL in a different database
10May 19, 2022 by Kenneth Fisher
This is one of those things that on hindsight was a stupid problem, but still cost me hours and a …
Continue reading -
You can’t use GO in dynamic SQL.
2February 10, 2022 by Kenneth Fisher
This is one of those things that when I look back on it seems really obvious. Note: If at the …
Continue reading -
The curious case of CHAR(0)
12November 14, 2019 by Kenneth Fisher
Over the years I’ve seen quite a few strange things with SQL Server. This one may not have been the …
Continue reading -
Parameterized dynamic SQL is parameterized.
3November 15, 2018 by Kenneth Fisher
Ok, that title sounds silly, but it’s actually a real point. The first parameterized refers to using parameters within dynamic …
Continue reading -
Escaping strings
Leave a commentSeptember 24, 2018 by Kenneth Fisher
No, I’m not talking about that nightmare everyone has where a bunch of strings are chasing you across a loom. …
Continue reading -
Using Table Valued Parameters with sp_executesql
3September 13, 2018 by Kenneth Fisher
Recently I did a presentation on dynamic SQL. In the presentation I pointed out the similarity of using sp_executesql to …
Continue reading -
Nada to Speaker: Demystifying and Diminishing Dynamic SQL Difficulties
3August 20, 2018 by Kenneth Fisher
Last Thursday I spoke at NTSSUG (North Texas SQL Server User Group). This is my local group (only 1.5 hours …
Continue reading -
Variables in Dynamic SQL
4November 16, 2017 by Kenneth Fisher
I had someone ask me about this the other day. Specifically getting variable data out of a dynamic SQL statement. …
Continue reading -
Dynamically generate the command line DMA statement for each database
1June 21, 2017 by Kenneth Fisher
If you are upgrading your instance to 2016 (or 2017 soon) then you probably are going to want to run …
Continue reading