<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Why won't Dynamic SQL Die?</title><link>http://msmvps.com/blogs/williamryan/archive/2004/03/20/4063.aspx</link><description>On a regular basis someone posts a question on the NG's about how apostrophes are screwing up their code and what can be done about it. So let me be blunt: DYNAMIC SQL NEEDS TO DIE. Period, end of story. For a long time, I was rather passive about this</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>Using the SqlConnectionStringBuilder to guard against Connection String Injection Attacks</title><link>http://msmvps.com/blogs/williamryan/archive/2004/03/20/4063.aspx#81116</link><pubDate>Sun, 15 Jan 2006 15:50:02 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:81116</guid><dc:creator>Bill's House O Insomnia</dc:creator><description>One new object in the ADO.NET 2.0 Library worth taking a look at is the SqlConnectionStringBuilder&amp;amp;amp;nbsp;.&amp;amp;amp;nbsp;...&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=81116" width="1" height="1"&gt;</description></item><item><title>re: Why won't Dynamic SQL Die?</title><link>http://msmvps.com/blogs/williamryan/archive/2004/03/20/4063.aspx#68031</link><pubDate>Tue, 27 Sep 2005 03:05:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:68031</guid><dc:creator>William</dc:creator><description>You're correct, for that instance, there's this &lt;a target="_new" href="http://support.microsoft.com/default.aspx?scid=kb;en-us;555167"&gt;http://support.microsoft.com/default.aspx?scid=kb;en-us;555167&lt;/a&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=68031" width="1" height="1"&gt;</description></item><item><title>re: Why won't Dynamic SQL Die?</title><link>http://msmvps.com/blogs/williamryan/archive/2004/03/20/4063.aspx#68028</link><pubDate>Tue, 27 Sep 2005 02:43:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:68028</guid><dc:creator>William</dc:creator><description>this post look convincing... but what if in the 'where' part needs to use the reserved work 'like'?&lt;br&gt;&lt;br&gt;such as &amp;quot;where someValue like '%&amp;quot; &amp;amp; something &amp;amp; %'&amp;quot;&lt;br&gt;&lt;br&gt;I won't be able to use the @SomeValue and set parameters already, right?&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=68028" width="1" height="1"&gt;</description></item><item><title>re: Why won't Dynamic SQL Die?</title><link>http://msmvps.com/blogs/williamryan/archive/2004/03/20/4063.aspx#38990</link><pubDate>Sat, 19 Mar 2005 09:21:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:38990</guid><dc:creator>William</dc:creator><description>Here you go:&lt;br&gt;1. Paging&lt;br&gt;2. Dynamic Search Conditions&lt;br&gt;3. Dynamic Filters&lt;br&gt;4. Dynamic Reports&lt;br&gt;5. Dynamic databse structure&lt;br&gt;6. Correctly constructed and executed dynamic SQL is as efficient as a Stored Procedure&lt;br&gt;&lt;br&gt;Of course, stored procedures and paramterized queries are the way to go for structured data access, however, dynamic SQL is (unfortunatly) the only way in some dynamic scenarios.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=38990" width="1" height="1"&gt;</description></item><item><title>re: Why won't Dynamic SQL Die?</title><link>http://msmvps.com/blogs/williamryan/archive/2004/03/20/4063.aspx#18138</link><pubDate>Sat, 06 Nov 2004 22:06:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:18138</guid><dc:creator>William</dc:creator><description>You can still use Paramaterized Queries and construct the dynamically.  You need to know this in advance anyway when using a regular dynamic sql construct, so by using Paramaters instead, you mitigate most of the potential damage that can be done.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=18138" width="1" height="1"&gt;</description></item><item><title>re: Why won't Dynamic SQL Die?</title><link>http://msmvps.com/blogs/williamryan/archive/2004/03/20/4063.aspx#18136</link><pubDate>Sat, 06 Nov 2004 21:36:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:18136</guid><dc:creator>William</dc:creator><description>what if you're not sure how many parameters will be used? how would you use your method for that?&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=18136" width="1" height="1"&gt;</description></item><item><title>Dynamic SQL</title><link>http://msmvps.com/blogs/williamryan/archive/2004/03/20/4063.aspx#10605</link><pubDate>Sat, 24 Jul 2004 22:00:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:10605</guid><dc:creator>TrackBack</dc:creator><description>Dynamic SQL&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=10605" width="1" height="1"&gt;</description></item><item><title>Dynamic Sql</title><link>http://msmvps.com/blogs/williamryan/archive/2004/03/20/4063.aspx#9645</link><pubDate>Tue, 06 Jul 2004 18:55:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:9645</guid><dc:creator>TrackBack</dc:creator><description>Dynamic Sql&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=9645" width="1" height="1"&gt;</description></item><item><title>re: Why won't Dynamic SQL Die?</title><link>http://msmvps.com/blogs/williamryan/archive/2004/03/20/4063.aspx#4177</link><pubDate>Wed, 24 Mar 2004 12:17:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:4177</guid><dc:creator>William</dc:creator><description>Thanks Scorp.  Yeah, i could definitely get used to this sort of thing..too bad there aren't any really high paying jobs who's onily requirement is attending these things.&lt;br&gt;&lt;br&gt;I'll have some more info posted later today.&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;&lt;br&gt;Bill&lt;br&gt;&lt;br&gt;&lt;br&gt;W.G. Ryan MVP&lt;br&gt;www.knowdotnet.com&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=4177" width="1" height="1"&gt;</description></item><item><title>re: Why won't Dynamic SQL Die?</title><link>http://msmvps.com/blogs/williamryan/archive/2004/03/20/4063.aspx#4156</link><pubDate>Tue, 23 Mar 2004 22:23:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:4156</guid><dc:creator>William</dc:creator><description>Very cool plan. You ae so lucky I bet you are having a blast. I suspect a lot of people will turn on to this just because working with Excel and Word are so integral to our tasks in companies.&lt;br&gt;&lt;br&gt;Reporting is my life such as it is. Is there a sample app in the 101 vb.net samples that demonstrate the SQL Server 2000 Reporting Services?&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=4156" width="1" height="1"&gt;</description></item><item><title>re: Why won't Dynamic SQL Die?</title><link>http://msmvps.com/blogs/williamryan/archive/2004/03/20/4063.aspx#4149</link><pubDate>Tue, 23 Mar 2004 19:12:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:4149</guid><dc:creator>William</dc:creator><description>Scorp:&lt;br&gt;&lt;br&gt;Have you had a chance to look at SQL Server 2000 Reporting Services?  It's free, is extremely intuitive and allows you to flip from Design to Preview like Crystal Reports used to let you do.  I got to play with it at DevDays last week and since then quite a bit.  It's very very cool, and if you are doing a lot of reporting, it's well worth looking into.&lt;br&gt;&lt;br&gt;When I get back Saturday, we'll talk some more about the article, but I think your code would be great and we can mix the Word stuff with it (and XML) and have ourselves a great little article.&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;&lt;br&gt;Bill&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=4149" width="1" height="1"&gt;</description></item><item><title>re: Why won't Dynamic SQL Die?</title><link>http://msmvps.com/blogs/williamryan/archive/2004/03/20/4063.aspx#4148</link><pubDate>Tue, 23 Mar 2004 19:09:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:4148</guid><dc:creator>William</dc:creator><description>Hey Scorp:&lt;br&gt;&lt;br&gt;I posted these a few days ago, but it's not in relation to the code you showed me ;-).  Looks suspicious I know, but it's been a pet peeve of mine for a while.&lt;br&gt;&lt;br&gt;I actually have the code and it's definitely on my priority list.  I've also found that AVG on an INT column has all kinds of rounding issues and I've yet been able to use a cast/convert effectively (even though the documentation says you can).  Even if there is a valid work around, I know this has given a lot of people a lot of grief and the documentation needs updated.  I'll be in touch later this evening and let you know what I find out.&lt;br&gt;&lt;br&gt;Thanks again for writing and if you think of anything else, let me know.&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;&lt;br&gt;Bill&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=4148" width="1" height="1"&gt;</description></item><item><title>re: Why won't Dynamic SQL Die?</title><link>http://msmvps.com/blogs/williamryan/archive/2004/03/20/4063.aspx#4144</link><pubDate>Tue, 23 Mar 2004 15:17:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:4144</guid><dc:creator>William</dc:creator><description>Hey while you are there in the next ADO.NET update it would be nice if they would make the table.select and table.compute methods more flexible. You can show them that thread and ask them why filters were being ignored....&lt;br&gt;&lt;br&gt;Just a thought.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=4144" width="1" height="1"&gt;</description></item><item><title>re: Why won't Dynamic SQL Die?</title><link>http://msmvps.com/blogs/williamryan/archive/2004/03/20/4063.aspx#4142</link><pubDate>Tue, 23 Mar 2004 15:10:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:4142</guid><dc:creator>William</dc:creator><description>I would be happy to contribute the excel code if you like.&lt;br&gt;&lt;br&gt;Did you see my Word version?&lt;br&gt;&lt;br&gt;I know I know I should know better than to use dynamic SQL but it was an internal application (within my network) and I didnt really feel that that was too much of a threat.&lt;br&gt;&lt;br&gt;Crystal Reports - UGH I hate it.&lt;br&gt;&lt;br&gt;It caused some very adverse effects on folks computers especially the Windows 2000 computers.&lt;br&gt;&lt;br&gt;I don't like the limitations it puts on me. Sometimes I feel like I have to learn another language.&lt;br&gt;&lt;br&gt;And to be honest, I love learning how to do what Crystal seems to make so easy. I don't want a tool that does everything for me. Call me crazy I guess....&lt;br&gt;&lt;br&gt;By the way I am clicking on your site reguarly today.....:)&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=4142" width="1" height="1"&gt;</description></item></channel></rss>