﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Moving SQL</title>
    <description>My occasional adventures in performance, administration, secuirty and other database topics. -- RBarryYoung</description>
    <link>http://movingsql.com/dnn/Home/tabid/125/BlogId/2/Default.aspx</link>
    <language>en-US</language>
    <managingEditor>rbarryyoung+movingsql@gmail.com</managingEditor>
    <webMaster>rbarryyoung+movingsql@gmail.com</webMaster>
    <pubDate>Wed, 10 Mar 2010 14:52:07 GMT</pubDate>
    <lastBuildDate>Wed, 10 Mar 2010 14:52:07 GMT</lastBuildDate>
    <docs>http://backend.userland.com/rss</docs>
    <generator>Blog RSS Generator Version 3.5.1.19887</generator>
    <item>
      <title>Best Practices for Applications Login to SQL Server?</title>
      <description>&lt;p&gt;&lt;font face="Verdana" size="2"&gt;An interesting question came up on the MSDN SQL Forums yesterday about best practices for applications to access their databases on SQL Server:&lt;/font&gt;&lt;/p&gt;
&lt;div&gt;&lt;blockquote style="background-color: #f8ffff"&gt;
&lt;div&gt;&lt;em&gt;&lt;font face="Arial" size="2"&gt;In what situations will application roles suffice, I have read about how it works, but in applications that I have seen, e.g. an exe which expects a servername as a parameter, a username and a password. How will an application role work here.&lt;/font&gt;&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;&lt;br /&gt;
&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;&lt;font face="Arial" size="2"&gt;In what applications/scenarios have other SQL server experts used application roles.&lt;/font&gt;&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;&lt;br /&gt;
&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;&lt;font face="Arial" size="2"&gt;If SQL server login is to be used, what is the best practice approach of how this should be managed?&lt;/font&gt;&lt;/em&gt;&lt;/div&gt;
&lt;/blockquote&gt;&lt;font face="Verdana" size="2"&gt;In order to answer this question, it is necessary to first understand that a "SQL Server Login"and an "Application Role" are two different things.  
&lt;div&gt;
&lt;p&gt;&lt;font face="Verdana" size="2"&gt;A SQL Server Login, is a SQL Server-only account (i.e., &lt;em&gt;not&lt;/em&gt; a Windows Login/account) that is used by supplying a username and password  to SQL Server when connecting.  Because such a SQL Server Login is created just for this application's use, and is used only by this application, they are typically called "Application Logins".  They are popular with applications because 1) they provide a way to authenticate and authorize &lt;em&gt;just&lt;/em&gt; the application, irrespective of the user, so that the user cannot access the database on their own without the application.  And 2) they can be externally parametrized and thus managed and modified externally.  &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana" size="2"&gt;Its downsides are that gaining access to the application is tantamount to gaining access to the applications data, and even worse, gaining access to the executable image and/or executable environment gives hackers the ability to strip the application login's username and password out and use it on their own (because the Window account using it is never checked by SQL Server). &lt;/font&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana" size="2"&gt;
&lt;p&gt;&lt;font face="Verdana" size="2"&gt;This is all in contrast to a Windows or Domain Login that uses a Trusted connection that needs no validation on connection.  Typically in Client-Server architectures, this is the Users domain account that the client application is piggy-backing on to connect to the database.  Authorization in the database is implemented by adding the Windows domain account or a Windows group that the application user are in (usually a group created solely for this purpose) as a Windows Login in SQL Server and then as a User in the application database.  User/Group authorization of windows logins for applications access to SQL Server database is popular because 1) it takes virtually nothing in the application code to implement it, its all up to Windows and SQL Server, and 2) access to the application, or its image/environment will not give you access to the data because you have to be in the right Windows Group before SQL Server will give you that access.  &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana" size="2"&gt;Its disadvantages are that the users can access the database (and therefore usually, the data) all on their own without ever having to use the application (because SQL Server is *only* checking the Windows Login/Group and requires nothing else).&lt;/font&gt;&lt;/p&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana" size="2"&gt; An Application Role, on the other hand is a way to "sort of" combine the security advantages of both of these approaches.  An Application Role is a database-only principal (that is, non-server level, so it cannot normally cross databases) that is intended to be used by an application AFTER it has successfully connected to the database.  The Application Role is invoked by using the command: &lt;strong&gt;EXEC sp_setapprole "rolename", "password"&lt;/strong&gt;, which causes SQL Server to drop the connections current security context and assume the Application Role's.  The idea here is that the application's users' Windows Logins (or Windows Group) is authorized by SQL Server to connect to the database, but *nothing else*, it has no access to anything else in the database (tables, views, application stored procedures, etc.).  This allows the application to use Trusted connections to the database based on the authorization of the user.  At that point the application runs&lt;strong&gt; sp_setapprole&lt;/strong&gt; to switch to the Application Role in the database, which is authorized to do everything that the database needs to do. &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana" size="2"&gt;
&lt;p&gt;&lt;font face="Verdana" size="2"&gt;The advantages of this approach are that 1) Authorized users cannot access the application data on their because they do not have the approle's password.  And, 2) access to the application, image or environment, does not enable a hacker to gain access to the SQL Server or the application's database, because you must still be in the right Windows Group to connect to the database.  &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Verdana" size="2"&gt;The disadvantages are that this approach is complicated and harder to implement (both in code and in the DB) than the other two.  Even worse, because it can only be implemented explicitly in code, it cannot be retrofitted in the field onto an existing product, application or other executable through external configuration, the access code has to be rewritten.&lt;/font&gt;&lt;/p&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;/font&gt;&lt;/div&gt;</description>
      <link>http://movingsql.com/dnn/Home/tabid/125/EntryId/219/Best-Practices-for-Applications-Login-to-SQL-Server.aspx</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/8/default.aspx">Security</category>
      <comments>http://movingsql.com/dnn/Home/tabid/125/EntryId/219/Best-Practices-for-Applications-Login-to-SQL-Server.aspx#Comments</comments>
      <guid isPermaLink="true">http://movingsql.com/dnn/Home/tabid/125/EntryId/219/Best-Practices-for-Applications-Login-to-SQL-Server.aspx</guid>
      <pubDate>Sat, 17 Oct 2009 16:31:00 GMT</pubDate>
      <slash:comments>4</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=219</trackback:ping>
    </item>
    <item>
      <title>SQL Server Express summary from Pinal Dave...</title>
      <description>&lt;p&gt;Pinal Dave is one of the most prolific SQL Server bloggers ever, his &lt;a href="http://blog.sqlauthority.com"&gt;SQLAuthority&lt;/a&gt; blog alone has thousands of his articles.  And today, he has posted an execllent summary of &lt;a href="http://blog.sqlauthority.com/2009/08/26/sql-server-sql-server-express-a-complete-reference-guide/"&gt;SQL Server Express&lt;/a&gt; what you can (or cannot) do with this FREE software for both you and your customers.  Read it!&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Home/tabid/125/EntryId/218/SQL-Server-Express-summary-from-Pinal-Dave.aspx</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://www.movingsql.com/dnn/Home/tabid/125/EntryId/218/SQL-Server-Express-summary-from-Pinal-Dave.aspx#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Home/tabid/125/EntryId/218/SQL-Server-Express-summary-from-Pinal-Dave.aspx</guid>
      <pubDate>Wed, 26 Aug 2009 04:14:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=218</trackback:ping>
    </item>
    <item>
      <title>Object/Relational Mapping, The Vietnam of Computer Science?</title>
      <description>&lt;p&gt;Wow, it's been over a month since I've posted...  Just a quick note this time, I re-read today "&lt;a href="http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx"&gt;The Vietnam of Computer Science&lt;/a&gt;" by Ted Neward from 2006.  This is certianly one of the best blog posts ever on technical development and the definitive explanation of what the "Object-Relational Impedance Mismatch" is really all about. &lt;/p&gt;
&lt;p&gt;While I generally agree with what is said in this article, I think that most of the problems mentioned can be readily addressed just byadopting a slightly more pragmatic perspective.  The exception is inheritance-based design patterns which simply have no good answer in the relational model.  Yes, there are answers, but they all have significant drawbacks.&lt;/p&gt;
&lt;p&gt;If you've never read it, do yourself a favor and read it now.  If you have read it before, that's no reason not to read it again...&lt;/p&gt;</description>
      <link>http://movingsql.com/dnn/Home/tabid/125/EntryId/217/Object-Relational-Mapping-The-Vietnam-of-Computer-Science.aspx</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://movingsql.com/dnn/Home/tabid/125/EntryId/217/Object-Relational-Mapping-The-Vietnam-of-Computer-Science.aspx#Comments</comments>
      <guid isPermaLink="true">http://movingsql.com/dnn/Home/tabid/125/EntryId/217/Object-Relational-Mapping-The-Vietnam-of-Computer-Science.aspx</guid>
      <pubDate>Mon, 20 Jul 2009 00:19:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=217</trackback:ping>
    </item>
    <item>
      <title>News articles on SQL Injection</title>
      <description>&lt;p&gt;A couple of news articles I cam cross this week on SQl Injection;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.baselinemag.com/c/a/Security/SQL-Injections-Wreaking-Havoc-258450/"&gt;http://www.baselinemag.com/c/a/Security/SQL-Injections-Wreaking-Havoc-258450/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www-935.ibm.com/services/us/iss/xforce/trendreports/xforce-2008-annual-report.pdf"&gt;http://www-935.ibm.com/services/us/iss/xforce/trendreports/xforce-2008-annual-report.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.baselinemag.com/c/a/IT-Management/Six-Steps-to-Stop-SQL-Injections-129263/"&gt;http://www.baselinemag.com/c/a/IT-Management/Six-Steps-to-Stop-SQL-Injections-129263/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.blackhat.com/presentations/bh-europe-09/Guimaraes/Blackhat-europe-09-Damele-SQLInjection-whitepaper.pdf"&gt;http://www.blackhat.com/presentations/bh-europe-09/Guimaraes/Blackhat-europe-09-Damele-SQLInjection-whitepaper.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There is some realy great stuff in here including some references to the frequency of Injection attacks this past year, a report from European Black Hats of a new technique that can take an Injection attacker from SQL Server to the OS, and some ways to protect yourself.&lt;/p&gt;
&lt;p&gt;Let me know what you think!&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Home/tabid/125/EntryId/216/News-articles-on-SQL-Injection.aspx</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://www.movingsql.com/dnn/Home/tabid/125/EntryId/216/News-articles-on-SQL-Injection.aspx#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Home/tabid/125/EntryId/216/News-articles-on-SQL-Injection.aspx</guid>
      <pubDate>Sun, 14 Jun 2009 01:52:00 GMT</pubDate>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=216</trackback:ping>
    </item>
    <item>
      <title>VB to C# (and vice-versa) Cheat Sheet</title>
      <description>&lt;p&gt;I just came across this, a simple table formatted cheat sheet that allows you to tranlsate VB features to C# or C# features to VB.&lt;/p&gt;
&lt;p&gt;You can find it at:  &lt;a href="http://aspalliance.com/625"&gt;http://aspalliance.com/625&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I realize that it's a few years old, but if you're like me and need to go back and forth between these two languages, but can't always remember  what the equivalents for one language are in the other, then you might find this useful.&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Home/tabid/125/EntryId/215/VB-to-C-and-vice-versa-Cheat-Sheet.aspx</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://www.movingsql.com/dnn/Home/tabid/125/EntryId/215/VB-to-C-and-vice-versa-Cheat-Sheet.aspx#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Home/tabid/125/EntryId/215/VB-to-C-and-vice-versa-Cheat-Sheet.aspx</guid>
      <pubDate>Sun, 31 May 2009 04:20:00 GMT</pubDate>
      <slash:comments>3</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=215</trackback:ping>
    </item>
    <item>
      <title>Great Tutorial on Preventing SQL Injection</title>
      <description>&lt;p&gt;Wow.  I was following a link from a forum post on SQL Injecitn that I was reaidng and it led me &lt;a href="http://st-curriculum.oracle.com/tutorial/SQLInjection/index.htm"&gt;here&lt;/a&gt;. Wow.  What a great resource!  This is the kind of tutorial that Microsoft should have written years ago.  And then started promoting it to address Injection, and started following it themselves, and encouraged SW vendors to follow.  And encourage customers to require from their SW vendors.&lt;/p&gt;
&lt;p&gt;The catch?  It's from ... Oracle.  &lt;img alt="" src="/dnn/Providers/HtmlEditorProviders/Fck/FCKeditor/editor/images/smiley/msn/sad_smile.gif" /&gt;  That also means that the recommended solutions are very Oracle-specific.  The good news?  I did not see anything in there that could not be easily translated to Transact-SQL.  Happy reading!&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=212</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=212#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=212</guid>
      <pubDate>Thu, 28 May 2009 01:21:00 GMT</pubDate>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=212</trackback:ping>
    </item>
    <item>
      <title>Making SQLBulkCopy faster ...</title>
      <description>&lt;p&gt;(trying to get better about just blogging in the moment, instead of saving it up ...)&lt;/p&gt;
&lt;p&gt;I saw a post abut the next release of ClearTrace at &lt;a href="http://weblogs.sqlteam.com/billg/archive/2009/05/27/ClearTrace-2008.34.aspx"&gt;http://weblogs.sqlteam.com/billg/archive/2009/05/27/ClearTrace-2008.34.aspx&lt;/a&gt; that mentioned its heavy use of &lt;a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx"&gt;SQLBulkCopy&lt;/a&gt; to speed up Trace loading, and I was reminded about my own experiences with it:&lt;/p&gt;
&lt;p&gt;SQLBulkCopy is part of SQLClient and is pretty cool.  I did some performance testing of it last year, trying to match BCP and BULK INSERT's speed with it.  Could only get about 50% as fast because of the amount of CPU time it was spending in type conversions. &lt;/p&gt;
&lt;p&gt;Turns out that both the .Net and the default SQL Server text-to-numeric (and text-to-datetime) conversion routines have a lot of overhead, I suspect to handle the zillions of different text-numeric formats.  Since I knew exactly what my text-numeric formats were I hand coded my own type-conversion routines (in VB no less!) and almost doubled its speed.  I was curious if anyone else had noticed the same thing?&lt;/p&gt;
&lt;p&gt;(I have attached the code in a .ZIP file &lt;a href="http://movingsql.com/dnn/LinkClick.aspx?fileticket=eeZpSelIJH0%3d&amp;tabid=125&amp;mid=461"&gt;here&lt;/a&gt;).&lt;/p&gt;</description>
      <link>http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=211</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=211#Comments</comments>
      <guid isPermaLink="true">http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=211</guid>
      <pubDate>Wed, 27 May 2009 15:27:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=211</trackback:ping>
    </item>
    <item>
      <title>New US Gov Site for free downloading Fed databases</title>
      <description>&lt;p&gt;It may seem boring, but this is actually big news.  The US Federal government has just launched a website that allows anyone to download any of a large number of databases from various federal agencies.  The new site is &lt;a href="http://www.data.gov/"&gt;http://www.data.gov/&lt;/a&gt;, try it out and let me know what you think!  (Hmm, formatting seems to be less than I would want...).&lt;/p&gt;</description>
      <link>http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=210</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=210#Comments</comments>
      <guid isPermaLink="true">http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=210</guid>
      <pubDate>Tue, 26 May 2009 20:38:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=210</trackback:ping>
    </item>
    <item>
      <title>So I'm a Twit...</title>
      <description>&lt;p&gt;So I'm a twit.. or a twiteratii, or a twitron, or whatever the digest-sized denzens of Twitter call themselves.  I've resisted the tempatation for a long time because it really seemed like short attention-span blogging and why feed that particular beast?&lt;/p&gt;
&lt;p&gt;Then it occured to me that maybe I would find those short tweets (or twix? or twonks?) easier than writing whole paragraphs, so I singed up.  And I have to say, for SQL Server stuff it's twitterlicious, lots of high profile and interesting SQL Server MVPs and experts out there.&lt;/p&gt;
&lt;p&gt;So my Twit-Name is (you guessed it) @RBarryYoung.  And has anybody else noticed how much the twitern language resembles Smurfish?  :-)&lt;/p&gt;</description>
      <link>http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=209</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=209#Comments</comments>
      <guid isPermaLink="true">http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=209</guid>
      <pubDate>Tue, 26 May 2009 20:09:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=209</trackback:ping>
    </item>
    <item>
      <title>Buying the ANSI/ISO SQL Standards?</title>
      <description>&lt;p&gt;&lt;span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" class="Apple-style-span"&gt;&lt;span style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap;" class="Apple-style-span"&gt;Just a follow up to me earlier post on reading the SQL 2006 Draft Standards (&lt;a href="http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=204"&gt;here&lt;/a&gt;), Glenn Pauley of Sybase pointed out to me that you download the standards for much less from the ANSI Store at &lt;/span&gt;&lt;/span&gt;&lt;a href="http://webstore.ansi.org"&gt;&lt;span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" class="Apple-style-span"&gt;&lt;span style="border-collapse: collapse; font-family: 'Lucida Console'; font-size: 9px;" class="Apple-style-span"&gt;http://webstore.ansi.org&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" class="Apple-style-span"&gt;&lt;span style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap;" class="Apple-style-span"&gt;.  The ANSI/ISO SQL Standards are all code with "9075" so the easiest way is to use the Document Number search for "IEC 9075".&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" class="Apple-style-span"&gt;&lt;span style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap;" class="Apple-style-span"&gt;And the good news is that the SQL:2003 standards are just $30 for each section.&lt;/span&gt;&lt;/span&gt;  The bad news is that there are 14 sections and the SQL:2008 documents are &lt;em&gt;&lt;strong&gt;$180&lt;/strong&gt;&lt;/em&gt; apeice.&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=208</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=208#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=208</guid>
      <pubDate>Mon, 25 May 2009 17:24:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=208</trackback:ping>
    </item>
    <item>
      <title>Performance Test-Harness, pt1: Capturing the execution plan.</title>
      <description>&lt;p&gt;&lt;span&gt;&lt;span id="_ctl6_ctlTopic"&gt;&lt;span id="_ctl6_ctlTopic_ctlPanelBar"&gt;&lt;span id="_ctl6_ctlTopic_ctlPanelBar_ctlTopicsRepeater__ctl5_lblFullMessage"&gt; I am developing a T-SQL test harness for automated performance tests. The testing procedure will receive a string to execute as Dynamic SQL. I am going to add a bunch of standard initialization and measurement stuff to it, that's all easy. However, one additional thing that I want to do is to capture the Execution Plan (the actual plan is preferred) into an XML variable or column to be saved as part of the test header record.&lt;br /&gt;
&lt;br /&gt;
I puzzled over how to do this for while this morning, until I came up with the following approach:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;meta content="text/html; charset=utf-8" http-equiv="Content-Type" /&gt;
&lt;meta content="Word.Document" name="ProgId" /&gt;
&lt;meta content="Microsoft Word 12" name="Generator" /&gt;
&lt;meta content="Microsoft Word 12" name="Originator" /&gt;
&lt;link href="file:///C:\DOCUME~1\byoung\LOCALS~1\Temp\msohtmlclip1\01\clip_filelist.xml" rel="File-List" /&gt;
&lt;link href="file:///C:\DOCUME~1\byoung\LOCALS~1\Temp\msohtmlclip1\01\clip_themedata.thmx" rel="themeData" /&gt;
&lt;link href="file:///C:\DOCUME~1\byoung\LOCALS~1\Temp\msohtmlclip1\01\clip_colorschememapping.xml" rel="colorSchemeMapping" /&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
&lt;w:WordDocument&gt;
&lt;w:View&gt;Normal&lt;/w:View&gt;
&lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
&lt;w:TrackMoves /&gt;
&lt;w:TrackFormatting /&gt;
&lt;w:PunctuationKerning /&gt;
&lt;w:ValidateAgainstSchemas /&gt;
&lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
&lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
&lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
&lt;w:DoNotPromoteQF /&gt;
&lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
&lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
&lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
&lt;w:Compatibility&gt;
&lt;w:BreakWrappedTables /&gt;
&lt;w:SnapToGridInCell /&gt;
&lt;w:WrapTextWithPunct /&gt;
&lt;w:UseAsianBreakRules /&gt;
&lt;w:DontGrowAutofit /&gt;
&lt;w:SplitPgBreakAndParaMark /&gt;
&lt;w:DontVertAlignCellWithSp /&gt;
&lt;w:DontBreakConstrainedForcedTables /&gt;
&lt;w:DontVertAlignInTxbx /&gt;
&lt;w:Word11KerningPairs /&gt;
&lt;w:CachedColBalance /&gt;
&lt;/w:Compatibility&gt;
&lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;
&lt;m:mathPr&gt;
&lt;m:mathFont m:val="Cambria Math" /&gt;
&lt;m:brkBin m:val="before" /&gt;
&lt;m:brkBinSub m:val="--" /&gt;
&lt;m:smallFrac m:val="off" /&gt;
&lt;m:dispDef /&gt;
&lt;m:lMargin m:val="0" /&gt;
&lt;m:rMargin m:val="0" /&gt;
&lt;m:defJc m:val="centerGroup" /&gt;
&lt;m:wrapIndent m:val="1440" /&gt;
&lt;m:intLim m:val="subSup" /&gt;
&lt;m:naryLim m:val="undOvr" /&gt;
&lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
&lt;w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267"&gt;
&lt;w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal" /&gt;
&lt;w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 1" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 2" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 3" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 4" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 5" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 6" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 7" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 8" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 9" /&gt;
&lt;w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /&gt;
&lt;w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title" /&gt;
&lt;w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /&gt;
&lt;w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /&gt;
&lt;w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong" /&gt;
&lt;w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid" /&gt;
&lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /&gt;
&lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /&gt;
&lt;w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /&gt;
&lt;w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote" /&gt;
&lt;w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /&gt;
&lt;w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /&gt;
&lt;w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title" /&gt;
&lt;w:LsdException Locked="false" Priority="37" Name="Bibliography" /&gt;
&lt;w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /&gt;
&lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style type="text/css"&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:1;
	mso-generic-font-family:roman;
	mso-font-format:other;
	mso-font-pitch:variable;
	mso-font-signature:0 0 0 0 0 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
	{font-family:"Lucida Sans Typewriter";
	panose-1:2 11 5 9 3 5 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:modern;
	mso-font-pitch:fixed;
	mso-font-signature:3 0 0 0 1 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:"";
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0in;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
&lt;/style&gt;
&lt;![endif]--&gt;
&lt;p style="margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: "Lucida Sans Typewriter"; color: blue;"&gt;Declare&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: "Lucida Sans Typewriter";"&gt; @qp &lt;span style="color: blue;"&gt;as&lt;/span&gt; &lt;span style="color: blue;"&gt;XML&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: "Lucida Sans Typewriter"; color: blue;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: "Lucida Sans Typewriter";"&gt; @qp &lt;span style="color: gray;"&gt;=&lt;/span&gt; query_plan&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: "Lucida Sans Typewriter";"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;From&lt;/span&gt; &lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: green;"&gt;dm_exec_requests&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: "Lucida Sans Typewriter";"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color: gray;"&gt;Cross&lt;/span&gt; &lt;span style="color: gray;"&gt;Apply&lt;/span&gt; &lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: green;"&gt;dm_exec_query_plan&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;plan_handle&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: "Lucida Sans Typewriter";"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;Where&lt;/span&gt; session_id &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: fuchsia;"&gt;@@spid&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: "Lucida Sans Typewriter"; color: fuchsia;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: "Lucida Sans Typewriter"; color: green;"&gt;-- Put Code to Test Here&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: "Lucida Sans Typewriter"; color: green;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: "Lucida Sans Typewriter"; color: blue;"&gt;select&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: "Lucida Sans Typewriter";"&gt; @qp&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span id="_ctl6_ctlTopic"&gt;&lt;span id="_ctl6_ctlTopic_ctlPanelBar"&gt;&lt;span id="_ctl6_ctlTopic_ctlPanelBar_ctlTopicsRepeater__ctl5_lblFullMessage"&gt;True, this will include some extra/redundant stuff like the QP for the Test-Harness statments themselves, but I think that I can live with that.&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=207</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=207#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=207</guid>
      <pubDate>Fri, 08 May 2009 15:04:00 GMT</pubDate>
      <slash:comments>7</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=207</trackback:ping>
    </item>
    <item>
      <title>CONNECT Suggestion 440375: Add Query-based bulk EXECUTE</title>
      <description>&lt;p&gt;I added my first Suggestion to Microsoft CONNECT yesterday, you can find it &lt;a href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=440375"&gt;here&lt;/a&gt;.  Please support this suggestion by rating and/or voting for it.  Thanks.&lt;/p&gt;
&lt;p&gt;For convenience, I have copied it below:&lt;/p&gt;
&lt;p&gt;Please add a query-based bulk EXECUTE command feature, with following (or similar) syntax:&lt;br /&gt;
&lt;br /&gt;
[WITH &lt;common_table_expression&gt; [,...n]]&lt;br /&gt;
[ { EXEC | EXECUTE } ]&lt;br /&gt;
    { &lt;br /&gt;
      [ @return_status = ]&lt;br /&gt;
      { module_name [ ;number ] | @module_name_var | (string_expression) }&lt;br /&gt;
        [ [ @parameter = ] { value &lt;br /&gt;
                           | @variable [ OUTPUT ] &lt;br /&gt;
                           | column&lt;br /&gt;
                           | ( expression )&lt;br /&gt;
                           | [ DEFAULT ] &lt;br /&gt;
        ]      [ ,...n ]&lt;br /&gt;
    FROM
&lt;table_source&gt;
&lt;br /&gt;
    [ WHERE  &lt;search_condition&gt; ]&lt;br /&gt;
    [ ORDER BY { order_by_expression | column_position [ ASC | DESC ] }  ]&lt;br /&gt;
    }[;]&lt;br /&gt;
&lt;br /&gt;
The execution procedure or command string will be executed once for every row returned from the query (may be zero) using the parameters or string value(s) calculated from each row's content.&lt;br /&gt;
&lt;br /&gt;
If ORDER BY is specified then each EXECUTE instance will be executed sequentially in the order specified. If ORDER BY is not specified then the EXECUTE instances will be eligible to be executed in parallel (per thresholds, MAXDOP, available cores, etc). The command will be complete only once all instances have completed.&lt;br /&gt;
&lt;br /&gt;
Despite the many possible multiple batches executed by this command, it is still considered a single command following the same rules of implicit/explicit transactions. Thus all instances will rollback or commit together. TRY..CATCH over this command will only be able to catch the first error. @return_status will only contain the value returned by the last completed instance.&lt;/search_condition&gt;
&lt;/table_source&gt;
&lt;/common_table_expression&gt;&lt;/p&gt;
&lt;p&gt;------------------&lt;/p&gt;
&lt;p&gt; &lt;span&gt;This provides a direct REDUCE-like capability for T-SQL. Although this ability can be approximated by WHILE loops or Dynamic SQL execution of aggregated strings, this would be significantly faster, more declarative than either, more set-oriented, more readable and maintainable. Additionally, this would be able to aggressively leverage parallelism, which no other simple or direct approach could do in SQL Server. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Benefits:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;
    &lt;div class="Body"&gt;
    &lt;div&gt;&lt;span&gt;Faster Development&lt;/span&gt;&lt;/div&gt;
    &lt;div&gt;&lt;span&gt;Improved User Interface&lt;/span&gt;&lt;/div&gt;
    &lt;div&gt;&lt;span&gt;Improved Administration&lt;/span&gt;&lt;/div&gt;
    &lt;div&gt;&lt;span&gt;Improved Performance&lt;/span&gt;&lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="data-item"&gt;
    &lt;div class="Body"&gt;&lt;span&gt;More readable; more set-oriented, more declarative.&lt;/span&gt;&lt;/div&gt;
    &lt;/div&gt;
    &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;</description>
      <link>http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=206</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=206#Comments</comments>
      <guid isPermaLink="true">http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=206</guid>
      <pubDate>Mon, 04 May 2009 18:29:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=206</trackback:ping>
    </item>
    <item>
      <title>Submitted to PASS...</title>
      <description>&lt;p&gt;Well, I submitted my sessions to PASS from my hospital bed Friday a week ago.  So I figured today, I would just go to PASS, copy my submissions and post them here, like &lt;a href="http://sqlinthewild.co.za/index.php/2009/04/11/pass-summit-submissions/"&gt;Gail Shaw&lt;/a&gt;, &lt;a href="http://scarydba.wordpress.com/2009/04/08/pass-summit-09-call-for-speakers-deadline-extended/#comment-717"&gt;Grant Fritchey&lt;/a&gt;, &lt;a href="http://wiseman-wiseguy.blogspot.com/2009/04/pass-sessions-submitted-should-i-be.html"&gt;Jack Cobett &lt;/a&gt;and others have done.  Unfortunately, now that the call for speakers has been closed it seems that not only is the list of all submissions no longer avaialabe, I cannot even find my own submissions! &lt;img alt="" src="/dnn/Providers/HtmlEditorProviders/Fck/FCKeditor/editor/images/smiley/msn/sad_smile.gif" /&gt;  Anyone who knows how I can get to my submissions please let me know.  Yeah, I know I should have saved them off myself before hand, but I was larboring under gallstones, pancreatitis, an IV od Dilaudin and a hospital supplied wireless keyboard/trackpad wrapped in a teflon baggy for sanitation.  I was amazed I could get it done at all as any kind of cut and paste took me literally minutes.&lt;/p&gt;
&lt;p&gt;So from memory, here are my submissions:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;There Must Be 15 Ways to Lose Your Cursors.&lt;/li&gt;
    &lt;li&gt;The Top Ten Reasons You Aren't already using Service Broker&lt;/li&gt;
    &lt;li&gt; Injected, Inspected, Detected, Infected, Neglected and Selected!&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;</description>
      <link>http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=205</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=205#Comments</comments>
      <guid isPermaLink="true">http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=205</guid>
      <pubDate>Sun, 03 May 2009 22:24:00 GMT</pubDate>
      <slash:comments>3</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=205</trackback:ping>
    </item>
    <item>
      <title>Reading the ANSI SQL:2008 Draft</title>
      <description>&lt;p&gt;It has always bothered me that in this age of virtually all computer reference material being available online, dynamically and free, the ANSI/ISO committees still follow the 20th century "Brick and Mortar" practices of charging exorbiant fees for their standards documents and then has made itself financially dependent on this revenue.  The ANSI SQL:2008 standard is broken into the following part(with Wikipedia links):&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a rel="nofollow" title="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=45498" class="external text" href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=45498"&gt;ISO/IEC 9075-1:2008&lt;/a&gt; Framework (SQL/Framework)&lt;/li&gt;
    &lt;li&gt;&lt;a rel="nofollow" title="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38640" class="external text" href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38640"&gt;ISO/IEC 9075-2:2008&lt;/a&gt; Foundation (SQL/Foundation)&lt;/li&gt;
    &lt;li&gt;&lt;a rel="nofollow" title="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38641" class="external text" href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38641"&gt;ISO/IEC 9075-3:2008&lt;/a&gt; Call-Level Interface (&lt;a title="SQL/CLI" href="http://en.wikipedia.org/wiki/SQL/CLI"&gt;SQL/CLI&lt;/a&gt;)&lt;/li&gt;
    &lt;li&gt;&lt;a rel="nofollow" title="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38642" class="external text" href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38642"&gt;ISO/IEC 9075-4:2008&lt;/a&gt; Persistent Stored Modules (&lt;a title="SQL/PSM" href="http://en.wikipedia.org/wiki/SQL/PSM"&gt;SQL/PSM&lt;/a&gt;)&lt;/li&gt;
    &lt;li&gt;&lt;a rel="nofollow" title="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38643" class="external text" href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38643"&gt;ISO/IEC 9075-9:2008&lt;/a&gt; Management of External Data (&lt;a title="SQL/MED" href="http://en.wikipedia.org/wiki/SQL/MED"&gt;SQL/MED&lt;/a&gt;)&lt;/li&gt;
    &lt;li&gt;&lt;a rel="nofollow" title="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38644" class="external text" href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38644"&gt;ISO/IEC 9075-10:2008&lt;/a&gt; Object Language Bindings (&lt;a title="SQL/OLB" href="http://en.wikipedia.org/wiki/SQL/OLB"&gt;SQL/OLB&lt;/a&gt;)&lt;/li&gt;
    &lt;li&gt;&lt;a rel="nofollow" title="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38645" class="external text" href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38645"&gt;ISO/IEC 9075-11:2008&lt;/a&gt; Information and Definition Schemas (&lt;a title="SQL/Schemata" href="http://en.wikipedia.org/wiki/SQL/Schemata"&gt;SQL/Schemata&lt;/a&gt;)&lt;/li&gt;
    &lt;li&gt;&lt;a rel="nofollow" title="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38646" class="external text" href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38646"&gt;ISO/IEC 9075-13:2008&lt;/a&gt; SQL Routines and Types Using the Java TM Programming Language (&lt;a title="SQL/JRT" href="http://en.wikipedia.org/wiki/SQL/JRT"&gt;SQL/JRT&lt;/a&gt;)&lt;/li&gt;
    &lt;li&gt;&lt;a rel="nofollow" title="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=45499" class="external text" href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=45499"&gt;ISO/IEC 9075-14:2008&lt;/a&gt; XML-Related Specifications (&lt;a title="SQL/XML" href="http://en.wikipedia.org/wiki/SQL/XML"&gt;SQL/XML&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The part 2: Foundation, the core of the standard costs about $450, even just to download the PDF.  Getting all of them would probably cost about $1500.  Now I ask you, how can they even pretend to aspire to be a unversal standard for SQL when the average professional would have to pay almost 2 weeks salary to have the right to read and reference it?...&lt;/p&gt;
&lt;p&gt;Anyway, the SQL:2008 standard came out last summer, Sybase has a nice summary of the new features &lt;a href="http://iablog.sybase.com/paulley/2008/07/sql2008-now-an-approved-iso-international-standard/"&gt;here&lt;/a&gt;.  Every couple of months I debate with myself whether or not to pay the $450 to get the Foundation PDF, but I just cannot justify it.  Finally it occured to me that I could acheive a kind of compromise by downloading the free PDFs of the draft of the standard from 2006, &lt;a href="http://www.wiscorp.com/sql200n.zip"&gt;here&lt;/a&gt;.  Although only a draft, it is pretty close to that standard that was adopted (or so I here).  More importantly, it does incorporate everything that was already in the SQL:2003 standard. &lt;/p&gt;
&lt;p&gt;Si I have it now and will be slowly reading through it, making the occasional post about interesting things as I go.&lt;/p&gt;</description>
      <link>http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=204</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=204#Comments</comments>
      <guid isPermaLink="true">http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=204</guid>
      <pubDate>Sat, 02 May 2009 17:48:00 GMT</pubDate>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=204</trackback:ping>
    </item>
    <item>
      <title>Stuck in the HOS[ITAL</title>
      <description>For anyone who has been wondering where I've been, let's jsut say that it has been an eventful two weeks.  I am writing this now from my hospistal bed, which it turns out is very difficult, so please forgive any errors.&lt;br /&gt;&lt;br /&gt;I gave my SQL Injection speech two weeks ago (which I think that I did blog about).  Then part one of my series "There must be fifteen ways to lose your cursors" was published over at SqlServerCentral.com to a firestorm of response (over 300 posts so far).  Then I gave speech on the same topic to Philly.net code camp to very favoarable reviews (so far anyway).&lt;br /&gt;&lt;br /&gt;Then last monday I had to go to the ER for intense stomach pains that were diagnosed a Gallstones.  Tuesday I go to see a Surgeon about getting my Gall bladder removed.  He schedules me for surgery on May 4 and puts me on an "Absolutely no Fat or Glycol" diet, meaning fruits, vegetables, water and skim milk only.  Joy!&lt;br /&gt;&lt;br /&gt;Thursday I have to leave work with stomach pains so bad I almost don't make it home.  Then I have my younger son, Chris drive me to the ER again.  They say that is is another Gallstone attack but as an added bonus I now have pancreaitis too.&lt;br /&gt;&lt;br /&gt;They say they cannot remove the gall bladder until the pancreaitis goes away, but it is taking its own sweet time.  So on monday they will do some surgical procedure to relieve the pancreaitis and assuming that goes OK remove my gall bladder on tuesday.&lt;br /&gt;&lt;br /&gt;Of course part 2 of mu series comes out on Monday, so I guess that Jeff and Lynn and Gus and the others will have to field the questions.&lt;br /&gt;&lt;br /&gt;Hopefully, I will be back soon ...&lt;br /&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=203</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=203#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=203</guid>
      <pubDate>Sun, 26 Apr 2009 14:05:00 GMT</pubDate>
      <slash:comments>4</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=203</trackback:ping>
    </item>
    <item>
      <title>Injected, Inspected, Detected, Infected, Neglected and Selected! Re-Update! ...</title>
      <description>&lt;p&gt;The downlod link in the prior update was pointing to the wrong presentation.  It has been corrected there and you can get it &lt;a href="http://www.movingsql.com/dnn/LinkClick.aspx?fileticket=pa1HXFdJ5Bs%3d&amp;tabid=125&amp;mid=461"&gt;here&lt;/a&gt; as well.&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=202</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=202#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=202</guid>
      <pubDate>Thu, 09 Apr 2009 15:53:00 GMT</pubDate>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=202</trackback:ping>
    </item>
    <item>
      <title>Injected, Inspected, Detected, Infected, Neglected and Selected! Update ...</title>
      <description>&lt;p&gt;I gave this presentation to PSSUG at SCP last night to very favorable reviews.  Nonetheless IMHO it is only 2/3rds done, so I hope to refine it quite a bit by the next time that I give it.  You can download the slides and code &lt;a href="http://www.movingsql.com/dnn/LinkClick.aspx?fileticket=pa1HXFdJ5Bs%3d&amp;tabid=125&amp;mid=461"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Note:  Link was bad (old presentation), it has been fixed.&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=201</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=201#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=201</guid>
      <pubDate>Thu, 09 Apr 2009 14:31:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=201</trackback:ping>
    </item>
    <item>
      <title>Injected, Inspected, Detected, Infected, Neglected and Selected!</title>
      <description>&lt;p&gt;Halfway though the most overloaded two weeks I have had in a long time, ... I have finally finished installment #2 of my series "&lt;u&gt;There Must Be 15 Ways to Lose Your Cursors&lt;/u&gt;" for &lt;a href="http://www.sqlservercentral.com"&gt;SQLServerCentral &lt;/a&gt;and I will submit it to Steve soon (lat minut formatting). &lt;/p&gt;
&lt;p&gt;Next up is my presentation to &lt;a href="http://www.pssug.org"&gt;PSSUG &lt;/a&gt;(Philadelphia Sql Server Users Group, a PASS chapther) the Wednesday evening entitled "&lt;u&gt;Injected, Inspected, Detected, Infected, Neglected and Selected!  Using Dynamic SQL Safely, without SQL Injection&lt;/u&gt;".  (Hmm, I notice that my titles keep getting longer and longer, I wonder if that's a trend?) &lt;/p&gt;
&lt;p&gt;I'll be working on this brand new Injection speech over the next few days and then I have the PASS speaker proposals due by midnight Friday.  Never mind work and three Easter week services this week.  Whew!&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=200</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=200#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=200</guid>
      <pubDate>Mon, 06 Apr 2009 15:45:00 GMT</pubDate>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=200</trackback:ping>
    </item>
    <item>
      <title>My Big Book Week</title>
      <description>&lt;p&gt;Wow, what a time for SQL books.  First I received my pre-ordered &lt;u&gt;SQL Server 2008 Query Performance Tuning Distilled&lt;/u&gt; by &lt;a href="http://scarydba.wordpress.com/2009/03/13/its-a-book/"&gt;Grant Fritchey&lt;/a&gt; last week, about a week earlier than expected.  Grant is a friend from SQLServerCentral and PASS 2008 and a great guy to boot.  Follow the link to his blog where you will find more links to order his book online.&lt;/p&gt;
&lt;p&gt;Then yesterday, I received my pre-ordered &lt;u&gt;SQL Server 2008 Internals&lt;/u&gt; by &lt;a href="http://sqlblog.com/blogs/kalen_delaney/archive/2009/02/18/my-book-is-at-the-printers.aspx?CommentPosted=true#commentmessage"&gt;Kalen Delaney&lt;/a&gt;, &lt;a href="http://www.sqlskills.com/BLOGS/PAUL/post/Our-book-has-been-published!.aspx"&gt;Paul S. Randal&lt;/a&gt;, &lt;a href="http://sqlskills.com/BLOGS/KIMBERLY/"&gt;Kimberly L. Tripp&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/03/23/sql-server-2008-internals-book-now-available.aspx"&gt;Connor Cunningham&lt;/a&gt;, &lt;a href="http://sqlblog.com/blogs/adam_machanic/default.aspx"&gt;Adam Machanic&lt;/a&gt;, and Ben Nevarez two weeks ahead of schedule.  The incredible line up of writers on this book has made it the most hotly anticipated new SQL book in many years.&lt;/p&gt;
&lt;p&gt;The irony is that becuase of the demands of my current project and because I am already behind in sumbitting my PASS 2009 proposals, I probable won't be able to get to them for a while yet.  &lt;img src="/dnn/Providers/HtmlEditorProviders/Fck/FCKeditor/editor/images/smiley/msn/sad_smile.gif" alt="" /&gt;  Oh well.  Just thumbing through, both look great though ...&lt;/p&gt;</description>
      <link>http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=199</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=199#Comments</comments>
      <guid isPermaLink="true">http://movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=199</guid>
      <pubDate>Wed, 25 Mar 2009 12:46:00 GMT</pubDate>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=199</trackback:ping>
    </item>
    <item>
      <title>Fast Concatenationof SQL Strings Re-re-visted...</title>
      <description>&lt;p&gt;Heh.  Well I forgot to post the best version of the XML aggregator when I posted the other day.  Then &lt;a href="http://blogs.technet.com/wardpond/default.aspx"&gt;Ward Pond&lt;/a&gt; tagged in a post on it (&lt;a href="http://blogs.technet.com/wardpond/archive/2009/02/26/database-programming-the-string-concatenation-xml-trick-revisited.aspx"&gt;here&lt;/a&gt;), and pointed out that I was "improving" on an old version that had been fixed by &lt;a href="http://sqlblog.com/blogs/adam_machanic/default.aspx"&gt;Adam Machanic&lt;/a&gt; among others...&lt;/p&gt;
&lt;p&gt;Here is my "good" version that fixes the entitization problem:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;SELECT &lt;/span&gt;&lt;span style="font-size: 10pt; color: gray; font-family: 'Courier New';"&gt;( &lt;br /&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt; n &lt;span style="color: gray;"&gt;+&lt;/span&gt; &lt;span style="color: red;"&gt;',' &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;FROM &lt;/span&gt;&lt;span style="font-size: 10pt; color: gray; font-family: 'Courier New';"&gt;( &lt;/span&gt;&lt;br /&gt;
&lt;blockquote&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;  SELECT&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt; &lt;span style="color: red;"&gt;'a&lt;b'&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; n &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;UNION&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt; &lt;span style="color: gray;"&gt;ALL &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;  SELECT&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt; &lt;span style="color: red;"&gt;'b&gt;a' &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;UNION&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt; &lt;span style="color: gray;"&gt;ALL &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;  SELECT&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt; &lt;span style="color: red;"&gt;'b&amp;a' &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;UNION&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt; &lt;span style="color: gray;"&gt;ALL &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;  SELECT&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt; &lt;span style="color: red;"&gt;'b &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/blockquote&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;span style="font-size: 10pt; color: red; font-family: 'Courier New';"&gt;a'&lt;/span&gt;&lt;span style="font-size: 10pt; color: gray; font-family: 'Courier New';"&gt;)&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt; r &lt;/span&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;FOR&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt; &lt;span style="color: blue;"&gt;XML&lt;/span&gt; &lt;span style="color: blue;"&gt;PATH&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: red;"&gt;''&lt;/span&gt;&lt;span style="color: gray;"&gt;),&lt;/span&gt; &lt;span style="color: blue;"&gt;TYPE &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;span style="font-size: 10pt; color: gray; font-family: 'Courier New';"&gt;).&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt;value&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: red;"&gt;'.[1]'&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: red;"&gt;'varchar(max)'&lt;/span&gt;&lt;span style="color: gray;"&gt;) &lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: green; font-family: 'Courier New';"&gt;-- ===== &lt;/span&gt;&lt;/p&gt;
&lt;p&gt; And here is the version currenlty being used by Ward and company...:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p style="margin-bottom: 0pt; line-height: normal;" class="MsoNormal"&gt;&lt;font face="courier new,courier"&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt; color: gray;"&gt;;&lt;/span&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt; color: blue;"&gt;WITH&lt;/span&gt;&lt;/font&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt;"&gt;&lt;font face="courier new,courier"&gt; ColumnToPivot &lt;span style="color: gray;"&gt;(&lt;/span&gt;[data()]&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;/font&gt;&lt;span style="color: gray;"&gt;&lt;font face="courier new,courier"&gt;(          &lt;br /&gt;
&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt;"&gt;&lt;font face="courier new,courier"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt; p&lt;span style="color: gray;"&gt;.&lt;/span&gt;ParentString &lt;span style="color: gray;"&gt;+&lt;/span&gt; N&lt;/font&gt;&lt;span style="color: red;"&gt;&lt;font face="courier new,courier"&gt;', '          &lt;br /&gt;
&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt;"&gt;&lt;font face="courier new,courier"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;FROM&lt;/span&gt; Parent p         &lt;br /&gt;
&lt;/font&gt;&lt;/span&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt;"&gt;&lt;font face="courier new,courier"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: gray;"&gt;JOIN&lt;/span&gt; Child c         &lt;br /&gt;
&lt;/font&gt;&lt;/span&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt;"&gt;&lt;font face="courier new,courier"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;ON&lt;/span&gt; c&lt;span style="color: gray;"&gt;.&lt;/span&gt;ParentId &lt;span style="color: gray;"&gt;=&lt;/span&gt; p&lt;span style="color: gray;"&gt;.&lt;/span&gt;ParentId         &lt;br /&gt;
&lt;/font&gt;&lt;/span&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt;"&gt;&lt;font face="courier new,courier"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;WHERE&lt;/span&gt; c&lt;span style="color: gray;"&gt;.&lt;/span&gt;ChildId &lt;span style="color: gray;"&gt;=&lt;/span&gt; 2         &lt;br /&gt;
&lt;/font&gt;&lt;/span&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt;"&gt;&lt;font face="courier new,courier"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;ORDER&lt;/span&gt; &lt;span style="color: blue;"&gt;BY&lt;/span&gt; p&lt;span style="color: gray;"&gt;.&lt;/span&gt;ParentId         &lt;br /&gt;
&lt;/font&gt;&lt;/span&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt;"&gt;&lt;font face="courier new,courier"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;FOR&lt;/span&gt; &lt;span style="color: blue;"&gt;XML&lt;/span&gt; &lt;span style="color: blue;"&gt;PATH&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: red;"&gt;''&lt;/span&gt;&lt;span style="color: gray;"&gt;),&lt;/span&gt; &lt;/font&gt;&lt;span style="color: blue;"&gt;&lt;font face="courier new,courier"&gt;TYPE          &lt;br /&gt;
&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt; color: gray;"&gt;&lt;font face="courier new,courier"&gt;),        &lt;br /&gt;
&lt;/font&gt;&lt;/span&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt;"&gt;&lt;font face="courier new,courier"&gt;&lt;span style=""&gt;    &lt;/span&gt;XmlRawData &lt;span style="color: gray;"&gt;(&lt;/span&gt;CSVString&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;/font&gt;&lt;span style="color: gray;"&gt;&lt;font face="courier new,courier"&gt;(          &lt;br /&gt;
&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt;"&gt;&lt;font face="courier new,courier"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt; &lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt; [data()] &lt;span style="color: blue;"&gt;AS&lt;/span&gt; mydata &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; ColumnToPivot &lt;span style="color: blue;"&gt;AS&lt;/span&gt; d &lt;span style="color: blue;"&gt;FOR&lt;/span&gt; &lt;span style="color: blue;"&gt;XML&lt;/span&gt; &lt;span style="color: blue;"&gt;RAW&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt; &lt;span style="color: blue;"&gt;TYPE&lt;/span&gt;&lt;span style="color: gray;"&gt;).&lt;/span&gt;value&lt;span style="color: gray;"&gt;(&lt;/span&gt; &lt;span style="color: red;"&gt;'/row[1]/mydata[1]'&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;'NVARCHAR(max)'&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; CSV_Column         &lt;br /&gt;
&lt;/font&gt;&lt;/span&gt;&lt;font face="courier new,courier"&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt; color: gray;"&gt;)        &lt;br /&gt;
&lt;/span&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt; color: blue;"&gt;SELECT&lt;/span&gt;&lt;/font&gt;&lt;font face="courier new,courier"&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt;"&gt; &lt;span style="color: gray;"&gt;LEFT(&lt;/span&gt;CSVString&lt;span style="color: gray;"&gt;,&lt;/span&gt; &lt;span style="color: fuchsia;"&gt;LEN&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;CSVString&lt;span style="color: gray;"&gt;)-&lt;/span&gt;1&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; CSVList         &lt;br /&gt;
&lt;/span&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt; color: blue; line-height: 115%;"&gt;FROM&lt;/span&gt;&lt;span courier="courier" mso-no-proof:="mso-no-proof:" style="font-size: 10pt; line-height: 115%;"&gt; XmlRawData&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Finally, I heard yesterday that Adam is has a new &lt;a href="http://sqlblog.com/blogs/adam_machanic/archive/2009/02/27/t-sql-challenge-grouped-string-concatenation.aspx"&gt;challenge&lt;/a&gt;, involving, you guessed it, grouping concatenated strings.  Guess I better get busy...&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=198</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/13/default.aspx">Advanced SQL</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=198#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=198</guid>
      <pubDate>Sat, 28 Feb 2009 22:42:00 GMT</pubDate>
      <slash:comments>3</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=198</trackback:ping>
    </item>
    <item>
      <title>Fast Concatenation of Many/Large Strings, pt2 (FOR XML)</title>
      <description>&lt;p&gt;Just a quick note ...&lt;/p&gt;
&lt;p&gt;Upon further testing and analysis, I feel confident that the best solution for string concatenation in SQL Server 2005+ is the FOR XML method, like so:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font face="Courier New" color="#0000ff"&gt;&lt;span class="Code"&gt;SELECT CAST(&lt;br /&gt;
   (SELECT TABLE_NAME+', '&lt;br /&gt;
     From INFORMATION_SCHEMA.TABLES&lt;br /&gt;
     Order By TABLE_NAME&lt;br /&gt;
     FOR XML PATH('')&lt;br /&gt;
) as VARCHAR(MAX))&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It has a lot of advantages, which I will go into later.  It also has one big problem(Entitization) which I will also demonstrate how to fix...&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=197</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/13/default.aspx">Advanced SQL</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=197#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=197</guid>
      <pubDate>Wed, 25 Feb 2009 15:36:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=197</trackback:ping>
    </item>
    <item>
      <title>There Must Be 15 Ways To Lose Your Cursors, presentation(SJ-PSSUG)</title>
      <description>&lt;p&gt;Last night I premiered my presentation "There Must Be 15 Ways To Lose Your Cursors" to the South Jersey division of the Philadelphia SQL Server Users Group.&lt;/p&gt;
&lt;p&gt;As promised, I have uploaded the presentation and all of the SQL Scripts as a ZIP it to this site.  You can download it &lt;a href="http://www.movingsql.com/dnn/LinkClick.aspx?fileticket=RchGV6rhX94%3d&amp;tabid=125&amp;mid=461"&gt;here&lt;/a&gt;.&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=196</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/251/default.aspx">Performance</category>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=196#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=196</guid>
      <pubDate>Wed, 25 Feb 2009 15:26:00 GMT</pubDate>
      <slash:comments>3</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=196</trackback:ping>
    </item>
    <item>
      <title>Fast Concatenation of Many/Large Strings</title>
      <description>&lt;p&gt;Just a quick note on string concatenation:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;  Concatenation(appending) a table of many small strings together into one big string is easy in SQL Server, but slow.  Fixng it is hard for the reasons that I list &lt;a href="http://www.sqlservercentral.com/blogs/philfactor/archive/2009/02/16/be-careful-with-string-concatenations-in-sql-server-with-big-strings.aspx?CommentPosted=true#commentmessage"&gt;here&lt;/a&gt;.  I beleive that I have "solved" this, reducing the O(n&lt;sup&gt;2&lt;/sup&gt;) operation to effectively O(n*Log(n)).&lt;/p&gt;
&lt;p&gt;A preliminary version of this technique is demonstrated &lt;a href="http://www.sqlservercentral.com/Forums/FindPost643213.aspx"&gt;here&lt;/a&gt;.  The approach seen in these forum posts can be greatly improved by "stacking" the 2&lt;sup&gt;k &lt;/sup&gt;roll-ups concatenating all of the lower level strings together at once, instead of "cacading" them up one level at a time, as demonstrated.&lt;/p&gt;
&lt;p&gt;I will post a more complete version later...&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=195</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/251/default.aspx">Performance</category>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=195#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=195</guid>
      <pubDate>Wed, 18 Feb 2009 20:16:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=195</trackback:ping>
    </item>
    <item>
      <title>Calculating Distance using Latitude and Longitude</title>
      <description>&lt;p&gt;A fast and accurate way to calculate the distance in miles between two points, based on the latitudes and longitudes.&lt;/p&gt;&lt;a href=http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=194&gt;More...&lt;/a&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=194</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/13/default.aspx">Advanced SQL</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=194#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=194</guid>
      <pubDate>Sun, 01 Feb 2009 02:40:00 GMT</pubDate>
      <slash:comments>5</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=194</trackback:ping>
    </item>
    <item>
      <title>Ways to Prevent SQL Injection</title>
      <description>&lt;p&gt;There are basically three (actually four) strategies for protecting against SQL Injection while allowing some use of Dynamic SQL:&lt;br /&gt;
&lt;br /&gt;
  1.  BlackListing&lt;br /&gt;
  2.  Firewalling&lt;br /&gt;
  3.  Parametizing&lt;br /&gt;
  4. &lt;em&gt; Parsing*&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
"Blacklisting" is the practice of scanning the client-supplied text for certain "blacklisted" strings, such as semicolons or words like "EXEC" and "DROP", as a way of detecting injection attacks.  Blacklisting is a bad practice and fails for two simple reasons, first, it is not possible to detect every possible injection attack without actually fully parsing the final Dynamic SQL execution string.  No matter how many banned strings you included in your scanner, you still cannot be sure that you have accounted for every posibility.  For instance, consider the alternate quotation characters in the upper half of the ASCII character set (and many more in Unicode).  Do you know which ones of them can be used to close a quotation?  Neither do I, and neither does anybody that I know.&lt;br /&gt;
&lt;br /&gt;
Secondly, blacklisting invariably breaks the application that it is trying to protect by preventing perfectly valid queries from being executed.  For instance, a query for an employee named "Sally Waldrop" is unlikley to make it through the blacklist.  A report query on a client called "Executive Cleaning" is also likely to be rejected.  And the more that you try to fix the first problem by adding more and more strings to the blacklist, the worse you will be making the second problem.  So blacklisting is a bad choice both because you cannot be sure that it will work and because you &lt;em&gt;can &lt;/em&gt;be sure that it will break your application.&lt;br /&gt;
&lt;br /&gt;
"Firewalling" is the practice of using security settings to restrict the Dynamic SQL's execution context permissions down to only what that Dynamic SQL statement is supposed to do.  Thus, for a procedure that is supposed to execute a dynamic SQL string to produce a report on the CLIENTS table, a special database User called "CLIENTS_Reports" would be created that had SELECT permission granted to the CLIENTS table, Like this:&lt;/p&gt;
&lt;pre&gt;&lt;font color="#0000ff"&gt;    Grant Select on OBJECT::dbo.CLIENTS to CLIENTS_Reporter&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt; but no rights to anything else, nor any other rights on the CLIENTS table.  Then the procedure would execute the dynamic SQL like this:&lt;/p&gt;
&lt;pre&gt;&lt;font color="#0000ff"&gt;    Execute(@query) As USER='CLIENTS_Reporter'&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;
The weaknesses of firewalling are first, that it is a point solution only, as a separate database User needs to be created for each separate stored procedure that uses client text in Dynamic SQL.  Using a single User for multiple stored procedures can comprise the integrity of this strategy because you may have to combine different permission sets to be sure that this one user can do everything that it might be legitimatelly called on to do.  Seperate User accounts for each one is fine if you only have a few of these, but quickly becomes unmanageble with larger numbers.  More discussion on this appraoch by me can be found &lt;a href="http://www.sqlservercentral.com/Forums/Topic645568-149-1.aspx?Update=1"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Secondly, it can be difficult with just security settings and permissions to get the fine control that you may need.  For instance, an application that supports bank tellers may use dynamic SQL to access account information.  While this could be managed with firewalling, you would probably also want to insure that the query could only return information for a single account at a time as any query from a teller that lists information for ALL accounts is likely to be something illegitmate.  In this case, firewalling cannot do much for you.&lt;br /&gt;
&lt;br /&gt;
"Parametizing" is the practice of only allowing client-supplied text to be passed through parameters and variables and never actualized as executable code.  Thus, instead of code like this:&lt;/p&gt;
&lt;pre&gt;&lt;font color="#0000ff"&gt;    Select @query = 'SELECT Column FROM table WHERE key=''' + @UserInput + ''''&lt;br /&gt;    Execute(@query)&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;
The code would be rewritten like this:&lt;/p&gt;
&lt;pre&gt;&lt;font color="#0000ff"&gt;    Select @query = 'SELECT Column FROM table WHERE key=@p1'&lt;br /&gt;    Set @P1Def = N'@P1 NVarchar(255)';&lt;br /&gt;    EXEC sp_executesql @query, @P1Def, @UserQuery;&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;
In the first case, a client string of "&lt;font face="Courier New"&gt; '; DELETE FROM CLIENTS; --&lt;/font&gt;" could spell disaster, however, in the parametized instance, it would just return no records.&lt;br /&gt;
&lt;br /&gt;
The shortcomings of parametization are first, it requires more work and thought than other approaches.  Secondly, it initially seems to be applicable to only the simplest cases of dynamic SQL (as above).  However, it turns out that there are some tricky ways to use parametization that allow it to be applied safely and sucessfully to all but the most complex cases of dynamic SQL.  These methods (variable execution, reconstitution, and directed expression) are beyond the scope of this article, however, it should be noted that they have some disadvantages of their own: primarily that they typically require a stricter and more complex interface between the client and the server procedure and thus cannot usually be implemented with making changes in the client as well.&lt;br /&gt;
&lt;br /&gt;
The fourth stategy, "Parsing" is really only included for completeness as it is not actually implmented in any case that I know of.  If it were used, parsing would invovle completely parsing the SQL syntax of dynamic text to be executed and then insuring that it conforms to restrictions defined for that particular use of dynamic SQL (for instance, that it consist of only a single SQL statement).  Parsing is not used primarily because it would be just too hard to implement on SQL Server.  SQL is not an easy language to parse completely and correctly and SQL is not a language that is well suited the task of syntactically and semantically parsing a string of text.  Even setting aside the difficulty of it, the overhead of doing it repeatedly for a heavily used procedure could be severe.  Consequently, without some substantial help in the future from SQL Server itself (or some other Microsoft facility), this approach will probably always remain impractical.&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=193</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/261/default.aspx">Dynamic SQL</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=193#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=193</guid>
      <pubDate>Fri, 30 Jan 2009 21:25:00 GMT</pubDate>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=193</trackback:ping>
    </item>
    <item>
      <title>Good SQL Injection Article</title>
      <description>&lt;p&gt;Here's a good article on SQL Injection by one of my favorite authors, Michael Coles: &lt;a href="http://www.sqlservercentral.com/articles/Security/updatedsqlinjection/2065/"&gt;http://www.sqlservercentral.com/articles/Security/updatedsqlinjection/2065/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Note that most of the SQL Injection articles will be filed under the "Dynamic SQL" heading.&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=192</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/8/default.aspx">Security</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=192#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=192</guid>
      <pubDate>Wed, 14 Jan 2009 15:41:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=192</trackback:ping>
    </item>
    <item>
      <title>Rules for Shared Schema Multi-Tenant Databases</title>
      <description>&lt;p&gt;I have implemented large shared schema, multi-tenant applications &amp; databases before and it is suprisingly straight-forward as long as you follow certain rules: &lt;br /&gt;
&lt;br /&gt;
1) All application users must be easily distinguishable by tenant to SQL. &lt;/p&gt;
&lt;p&gt; Practically speaking this means that either each tenant has a separate Login or each user has a sepearate Login to SQL Server and a Tenant_Users table to map the user back to their tenant association.&lt;br /&gt;
&lt;br /&gt;
2) Every table that the application can write to must have a tenant_id column that identifies the tenant-owner of the data.&lt;br /&gt;
&lt;br /&gt;
3) Every such table must have a corresponding "security" view that insure that any user can only access rows in that table from the same tenant., like so:&lt;/p&gt;
&lt;pre&gt;CREATE VIEW Secure_TABLE as&lt;br /&gt; Select * &lt;br /&gt; &lt;wbr&gt;&lt;/wbr&gt; From Physical_TABLE T&lt;br /&gt; &lt;wbr&gt;&lt;/wbr&gt;  Inner Join Tenant_Users U&lt;br /&gt; &lt;wbr&gt;&lt;/wbr&gt;  &lt;wbr&gt;&lt;/wbr&gt; ON U.tenant_id = T.tenant_id&lt;br /&gt; &lt;wbr&gt;&lt;/wbr&gt;  &lt;wbr&gt;&lt;/wbr&gt;  And U.UserName = sUser_sName()&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;
4) No application code, including client code, application stored procedures, views, etc., is permitted to directly access the physical tables. &lt;wbr&gt;&lt;/wbr&gt; All such data access is only permitted through the Security views. &lt;wbr&gt;&lt;/wbr&gt; (use database roles, schemas and permissions to implement this, do not rely on code).&lt;br /&gt;
&lt;br /&gt;
If you notice, this approach insures that, except for the user Logon's, the application has no knowledge of the multi-tenancy, and no application changes should normally be necessary. &lt;wbr&gt;&lt;/wbr&gt; This means that you can move a tenants data into or out of this approach without any changes to most applications, other than changing the Server.Database address. (note that to be truly transparent you would have to remove the tenant_id from the output of the security views).&lt;br /&gt;
&lt;br /&gt;
The tenant_id should be made the first field of the primary key and probably also the Clustered Index (if different).&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=191</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/8/default.aspx">Security</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=191#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=191</guid>
      <pubDate>Tue, 13 Jan 2009 23:56:00 GMT</pubDate>
      <slash:comments>4</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=191</trackback:ping>
    </item>
    <item>
      <title>Example of Safely Using Dynamic SQL with User Selected Table Name</title>
      <description>&lt;p&gt;Recently asked question on SQLServerCentral.com:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Well here's my question. In some of the inline sql they are using variables to create the table name.&lt;br /&gt;
The code is in vb.net&lt;br /&gt;
name = "joesshop"&lt;br /&gt;
Example: "Select * from data_" + name&lt;br /&gt;
So the end result would be "Select * from data_joesshop"&lt;br /&gt;
&lt;br /&gt;
Is there anyway to put this in a stored proc?&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Dynamic SQL is the standard solution for this kind of problem, but Injection is an overriding concern.&lt;br /&gt;
&lt;br /&gt;
Here is how you can recode this simple example into a stored procedure that protects itself from SQL Injection:&lt;/p&gt;
&lt;p&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;meta content="Word.Document" name="ProgId" /&gt;
&lt;meta content="Microsoft Word 12" name="Generator" /&gt;
&lt;meta content="Microsoft Word 12" name="Originator" /&gt;
&lt;link href="file:///C:\DOCUME~1\byoung\LOCALS~1\Temp\msohtmlclip1\01\clip_filelist.xml" rel="File-List" /&gt;
&lt;link href="file:///C:\DOCUME~1\byoung\LOCALS~1\Temp\msohtmlclip1\01\clip_themedata.thmx" rel="themeData" /&gt;
&lt;link href="file:///C:\DOCUME~1\byoung\LOCALS~1\Temp\msohtmlclip1\01\clip_colorschememapping.xml" rel="colorSchemeMapping" /&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
&lt;w:WordDocument&gt;
&lt;w:View&gt;Normal&lt;/w:View&gt;
&lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
&lt;w:TrackMoves /&gt;
&lt;w:TrackFormatting /&gt;
&lt;w:PunctuationKerning /&gt;
&lt;w:ValidateAgainstSchemas /&gt;
&lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
&lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
&lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
&lt;w:DoNotPromoteQF /&gt;
&lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
&lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
&lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
&lt;w:Compatibility&gt;
&lt;w:BreakWrappedTables /&gt;
&lt;w:SnapToGridInCell /&gt;
&lt;w:WrapTextWithPunct /&gt;
&lt;w:UseAsianBreakRules /&gt;
&lt;w:DontGrowAutofit /&gt;
&lt;w:SplitPgBreakAndParaMark /&gt;
&lt;w:DontVertAlignCellWithSp /&gt;
&lt;w:DontBreakConstrainedForcedTables /&gt;
&lt;w:DontVertAlignInTxbx /&gt;
&lt;w:Word11KerningPairs /&gt;
&lt;w:CachedColBalance /&gt;
&lt;/w:Compatibility&gt;
&lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;
&lt;m:mathPr&gt;
&lt;m:mathFont m:val="Cambria Math" /&gt;
&lt;m:brkBin m:val="before" /&gt;
&lt;m:brkBinSub m:val="--" /&gt;
&lt;m:smallFrac m:val="off" /&gt;
&lt;m:dispDef /&gt;
&lt;m:lMargin m:val="0" /&gt;
&lt;m:rMargin m:val="0" /&gt;
&lt;m:defJc m:val="centerGroup" /&gt;
&lt;m:wrapIndent m:val="1440" /&gt;
&lt;m:intLim m:val="subSup" /&gt;
&lt;m:naryLim m:val="undOvr" /&gt;
&lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
&lt;w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267"&gt;
&lt;w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal" /&gt;
&lt;w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 1" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 2" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 3" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 4" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 5" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 6" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 7" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 8" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 9" /&gt;
&lt;w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /&gt;
&lt;w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title" /&gt;
&lt;w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /&gt;
&lt;w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /&gt;
&lt;w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong" /&gt;
&lt;w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid" /&gt;
&lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /&gt;
&lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /&gt;
&lt;w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /&gt;
&lt;w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote" /&gt;
&lt;w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /&gt;
&lt;w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /&gt;
&lt;w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title" /&gt;
&lt;w:LsdException Locked="false" Priority="37" Name="Bibliography" /&gt;
&lt;w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /&gt;
&lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style type="text/css"&gt;

&lt;!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:1;
mso-generic-font-family:roman;
mso-font-format:other;
mso-font-pitch:variable;
mso-font-signature:0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
{font-family:"Lucida Sans Typewriter";
panose-1:2 11 5 9 3 5 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:modern;
mso-font-pitch:fixed;
mso-font-signature:3 0 0 0 1 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin-top:0in;
margin-right:0in;
margin-bottom:10.0pt;
margin-left:0in;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
{mso-style-type:export-only;
margin-bottom:10.0pt;
line-height:115%;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
--&gt;&lt;/style&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0in;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
&lt;/style&gt;
&lt;![endif]--&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;Create&lt;/span&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt; &lt;span style="color: blue"&gt;proc&lt;/span&gt; spSelectFromDataTable&lt;span style="color: gray"&gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;        &lt;/span&gt;@SuffixName &lt;span style="color: blue"&gt;Nvarchar&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;255&lt;span style="color: gray"&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;/*&lt;span&gt;        &lt;/span&gt;Procedure to demonstrate how to safely incorporate client&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt; &lt;/span&gt;text parameters into a SQL command.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;        &lt;/span&gt;Note that the key to this technique is to NEVER actually&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;EXECute any string that has client-supplied text.&lt;span&gt;  &lt;/span&gt;Rather all&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;of the client text must be purified by replacing it with the known&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;valid names of the objects being referenced.&lt;span&gt;  &lt;/span&gt;Then Dynamic&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;SQL commands can be safely constructed using ONLY our own text and&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;these idealized replacement values.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;*/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt; &lt;/span&gt;&lt;span style="color: blue"&gt;AS&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;BEGIN&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt; &lt;/span&gt;&lt;span style="color: blue"&gt;Declare&lt;/span&gt; @ActualTableName &lt;span style="color: blue"&gt;SYSNAME&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt; &lt;/span&gt;&lt;span style="color: green"&gt;--Find the actual table name that matches the clients&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt; &lt;/span&gt;&lt;span style="color: green"&gt;-- text parameter:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt; &lt;/span&gt;&lt;span style="color: blue"&gt;Select&lt;/span&gt; @ActualTableName &lt;span style="color: gray"&gt;=&lt;/span&gt; TABLE_NAME&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;  &lt;/span&gt;&lt;span style="color: blue"&gt;From&lt;/span&gt; &lt;span style="color: green"&gt;INFORMATION_SCHEMA.TABLES&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;  &lt;/span&gt;&lt;span style="color: blue"&gt;Where&lt;/span&gt; TABLE_SCHEMA &lt;span style="color: gray"&gt;=&lt;/span&gt; N&lt;span style="color: red"&gt;'dbo'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;   &lt;/span&gt;&lt;span style="color: gray"&gt;And&lt;/span&gt; TABLE_NAME &lt;span style="color: gray"&gt;=&lt;/span&gt; N&lt;span style="color: red"&gt;'data_'&lt;/span&gt; &lt;span style="color: gray"&gt;+&lt;/span&gt; @SuffixName&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;   &lt;/span&gt;&lt;span style="color: green"&gt;--Note that it is safe to use the clients parameter&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;   &lt;/span&gt;&lt;span style="color: green"&gt;-- here because it is only being used as a data value,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;   &lt;/span&gt;&lt;span style="color: green"&gt;-- it is not being EXECuted.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt; &lt;/span&gt;&lt;span style="color: blue"&gt;IF&lt;/span&gt; @ActualTableName &lt;span style="color: gray"&gt;IS&lt;/span&gt; &lt;span style="color: gray"&gt;NOT&lt;/span&gt; &lt;span style="color: gray"&gt;NULL&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;  &lt;/span&gt;&lt;span style="color: blue"&gt;BEGIN&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;        &lt;/span&gt;&lt;span style="color: green"&gt;--Here is where we construct and execute the Dynamic SQL&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;        &lt;/span&gt;&lt;span style="color: blue"&gt;EXEC&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;N&lt;span style="color: red"&gt;'Select * From '&lt;/span&gt;&lt;span style="color: gray"&gt;+&lt;/span&gt;@ActualTableName&lt;span style="color: gray"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;        &lt;/span&gt;&lt;span style="color: green"&gt;--Note that this execution string contains no part of&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;        &lt;/span&gt;&lt;span style="color: green"&gt;-- the clients text parameter, it has been completely&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;        &lt;/span&gt;&lt;span style="color: green"&gt;-- replaced with the known, valid, actual table name.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;  &lt;/span&gt;&lt;span style="color: blue"&gt;END&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt; &lt;/span&gt;&lt;span style="color: blue"&gt;ELSE&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;  &lt;/span&gt;&lt;span style="color: blue"&gt;BEGIN&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;        &lt;/span&gt;&lt;span style="color: blue"&gt;Declare&lt;/span&gt; @msg &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: blue"&gt;NVarchar&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: fuchsia"&gt;MAX&lt;/span&gt;&lt;span style="color: gray"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;        &lt;/span&gt;&lt;span style="color: blue"&gt;Select&lt;/span&gt; @msg &lt;span style="color: gray"&gt;=&lt;/span&gt; @SuffixName&lt;span style="color: gray"&gt;+&lt;/span&gt;N&lt;span style="color: red"&gt;' is an invalid data table name.'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;        &lt;/span&gt;&lt;span style="color: blue"&gt;RAISERROR&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;@msg&lt;span style="color: gray"&gt;,&lt;/span&gt; 11&lt;span style="color: gray"&gt;,&lt;/span&gt; 1&lt;span style="color: gray"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;        &lt;/span&gt;&lt;span style="color: blue"&gt;Return&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;span&gt;  &lt;/span&gt;&lt;span style="color: blue"&gt;END&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; line-height: normal"&gt;&lt;span style="font-size: 9pt" typewriter="" sans="" lucida=""&gt;END&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Comments welcome.&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=190</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/261/default.aspx">Dynamic SQL</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=190#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=190</guid>
      <pubDate>Tue, 13 Jan 2009 23:20:00 GMT</pubDate>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=190</trackback:ping>
    </item>
    <item>
      <title>Ways to Leave Your Cursors</title>
      <description>&lt;p&gt;I've been thinking about writing an article that would be titled "15 Ways to Leave Your Cusors".  Ideas:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Just put it in a Set, Brett  (change the declare cursor select statement  into a select)&lt;/li&gt;
    &lt;li&gt;Put it all together, Heather (later one; using women's names opens this  up a lot too)&lt;/li&gt;
    &lt;li&gt;Put it on the Stack, Jack (recursive CTE's)&lt;/li&gt;
    &lt;li&gt;Its your last resort Mort (or While/Kyle?)&lt;/li&gt;
    &lt;li&gt;Select into a variable, Aribel (simple pseudocursor)&lt;/li&gt;
    &lt;li&gt;Use an ordered update, Nate (complex psuedocursor)&lt;/li&gt;
    &lt;li&gt;Window on OVER, Grover (Row_Number(), etc.)&lt;/li&gt;
    &lt;li&gt;Add a WITH CUBE, Noob (Rollup and Cube)&lt;/li&gt;
    &lt;li&gt;Use a temproary table, Mabel&lt;/li&gt;
    &lt;li&gt;Just begin again, Man (last one; start over with just specs)&lt;/li&gt;
    &lt;li&gt;With OUTPUT (for loops with multiple outputs; no cute rhyme yet)&lt;/li&gt;
    &lt;li&gt;Make a big string, Bing (dynamic SQL)&lt;/li&gt;
    &lt;li&gt;bring it inline, Caroline&lt;/li&gt;
    &lt;li&gt;...?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Other ideas: Joins, Exists, IN(), derived tables, Merge(?)&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=189</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/13/default.aspx">Advanced SQL</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=189#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=189</guid>
      <pubDate>Sat, 13 Dec 2008 18:52:00 GMT</pubDate>
      <slash:comments>7</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=189</trackback:ping>
    </item>
    <item>
      <title>RSS Feeds turned on ...</title>
      <description>&lt;p&gt;Well at &lt;a href="http://wiseman-wiseguy.blogspot.com/"&gt;Jack Corbett's&lt;/a&gt; suggestion I have tunrned on RSS feeds for the blog.  I am still not sure if it will work right, so feel free to let me knowof any problems...&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=188</link>
      <author>rbarryyoung+movingsql@gmail.com</author>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=188#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=188</guid>
      <pubDate>Sat, 13 Dec 2008 03:19:00 GMT</pubDate>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=188</trackback:ping>
    </item>
    <item>
      <title>Shared Schema implementation of Multi-Tenancy Databases</title>
      <description>&lt;p&gt;I've been invovled in some recent discussion on Multi-Tenenacy databases and in particular, the Shared Schema implementation:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.sqlservercentral.com/Forums/FindPost610335.aspx"&gt;http://www.sqlservercentral.com/Forums/FindPost610335.aspx&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://www.sqlservercentral.com/Forums/Topic529170-361-1.aspx"&gt;http://www.sqlservercentral.com/Forums/Topic529170-361-1.aspx&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://www.sqlservercentral.com/Forums/Topic569567-149-1.aspx"&gt;http://www.sqlservercentral.com/Forums/Topic569567-149-1.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Multi-Tenancy databases are databases with multiple customer organizations ("tenants") all running the same application and all using the same database server.  The three stadard approaches to this are:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Seperate Databases&lt;/li&gt;
    &lt;li&gt;Same Database, Seperate Schemas&lt;/li&gt;
    &lt;li&gt;Shared Schemas&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In the last one, all of the tenants use the same tables, but a tenant_id is added to each table to distinguish them.  The is an MSDN article that explains this (&lt;a href="http://msdn.microsoft.com/en-us/library/aa479086.aspx"&gt;http://msdn.microsoft.com/en-us/library/aa479086.aspx&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;As it happens I designed and implemented a large Shared Schema Multi-Tenant DB several years ago, and  learned many insights from that.&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Home/tabid/125/EntryId/187/Shared-Schema-implementation-of-Multi-Tenancy-Databases.aspx</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/8/default.aspx">Security</category>
      <comments>http://www.movingsql.com/dnn/Home/tabid/125/EntryId/187/Shared-Schema-implementation-of-Multi-Tenancy-Databases.aspx#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Home/tabid/125/EntryId/187/Shared-Schema-implementation-of-Multi-Tenancy-Databases.aspx</guid>
      <pubDate>Mon, 01 Dec 2008 17:27:00 GMT</pubDate>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=187</trackback:ping>
    </item>
    <item>
      <title>The Two-Hop rule</title>
      <description>&lt;p&gt;Way back in March I answered question from two posters about the notorious Two-Hop Rule here: &lt;a href="http://www.sqlservercentral.com/Forums/Topic471172-359-1.aspx#bm473248"&gt;www.sqlservercentral.com/Forums/Topic471172-359-1.aspx#bm473248&lt;/a&gt;.  The thread has a good summary of the problem and cause by me, and an excellent post by Brian Kelley on how to use Kerberos to fix it.&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=186</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/8/default.aspx">Security</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=186#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=186</guid>
      <pubDate>Wed, 26 Nov 2008 21:59:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=186</trackback:ping>
    </item>
    <item>
      <title>Service Broker Article and tool from ALZDBA</title>
      <description>&lt;p&gt;A good article and monitoring script from Johan Bijnens (ALZDBA) at SQLServerCentral.com:&lt;/p&gt;
&lt;p&gt;The Article: &lt;a href="http://www.sqlservercentral.com/articles/Service+Broker/2897/"&gt;Adventures with Service Broker&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And the monitoring script with just selects from every Service Broker DMV and catalog view: &lt;a href="http://www.sqlservercentral.com/scripts/Maintenance+and+Management/31867/"&gt;http://www.sqlservercentral.com/scripts/Maintenance+and+Management/31867/&lt;/a&gt;&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=185</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/260/default.aspx">Service Broker</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=185#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=185</guid>
      <pubDate>Wed, 22 Oct 2008 13:58:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=185</trackback:ping>
    </item>
    <item>
      <title>A Lost Scripting Tool for SQL Server 2000 (and 2005?) </title>
      <description>&lt;p&gt;Jon Reade describes a little known microsoft upgrade utility (SCPTXFR.EXE) from SQL Server 2000 that can be used to script the objects in a SQL Server 2000 database.  Apparently it works for SQL Server 2005 also:  &lt;a href="http://www.sqlservercentral.com/articles/Administering/howtoscheduleasqlserverdatabasecreationscript/1834/"&gt;www.sqlservercentral.com/articles/Administering/howtoscheduleasqlserverdatabasecreationscript/1834/&lt;/a&gt;&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=184</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/255/default.aspx">Importing, Exporting and Scripting</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=184#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=184</guid>
      <pubDate>Tue, 21 Oct 2008 13:27:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=184</trackback:ping>
    </item>
    <item>
      <title>Cool function to find Leap Years</title>
      <description>&lt;p&gt;Armand Posted this cool function to tell if a specific year is a leap year or not at &lt;a href="http://www.mssqltips.com/tip.asp?tip=1527"&gt;www.mssqltips.com/tip.asp&lt;/a&gt; :&lt;/p&gt;
&lt;table cellspacing="1" cellpadding="1" width="586"&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td&gt;
            &lt;p&gt;
            &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
            &lt;meta name="ProgId" content="Word.Document" /&gt;
            &lt;meta name="Generator" content="Microsoft Word 12" /&gt;
            &lt;meta name="Originator" content="Microsoft Word 12" /&gt;
            &lt;link rel="File-List" href="file:///C:\DOCUME~1\byoung\LOCALS~1\Temp\msohtmlclip1\01\clip_filelist.xml" /&gt;
            &lt;link rel="themeData" href="file:///C:\DOCUME~1\byoung\LOCALS~1\Temp\msohtmlclip1\01\clip_themedata.thmx" /&gt;
            &lt;link rel="colorSchemeMapping" href="file:///C:\DOCUME~1\byoung\LOCALS~1\Temp\msohtmlclip1\01\clip_colorschememapping.xml" /&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
&lt;w:WordDocument&gt;
&lt;w:View&gt;Normal&lt;/w:View&gt;
&lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
&lt;w:TrackMoves /&gt;
&lt;w:TrackFormatting /&gt;
&lt;w:PunctuationKerning /&gt;
&lt;w:ValidateAgainstSchemas /&gt;
&lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
&lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
&lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
&lt;w:DoNotPromoteQF /&gt;
&lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
&lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
&lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
&lt;w:Compatibility&gt;
&lt;w:BreakWrappedTables /&gt;
&lt;w:SnapToGridInCell /&gt;
&lt;w:WrapTextWithPunct /&gt;
&lt;w:UseAsianBreakRules /&gt;
&lt;w:DontGrowAutofit /&gt;
&lt;w:SplitPgBreakAndParaMark /&gt;
&lt;w:DontVertAlignCellWithSp /&gt;
&lt;w:DontBreakConstrainedForcedTables /&gt;
&lt;w:DontVertAlignInTxbx /&gt;
&lt;w:Word11KerningPairs /&gt;
&lt;w:CachedColBalance /&gt;
&lt;/w:Compatibility&gt;
&lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;
&lt;m:mathPr&gt;
&lt;m:mathFont m:val="Cambria Math" /&gt;
&lt;m:brkBin m:val="before" /&gt;
&lt;m:brkBinSub m:val="--" /&gt;
&lt;m:smallFrac m:val="off" /&gt;
&lt;m:dispDef /&gt;
&lt;m:lMargin m:val="0" /&gt;
&lt;m:rMargin m:val="0" /&gt;
&lt;m:defJc m:val="centerGroup" /&gt;
&lt;m:wrapIndent m:val="1440" /&gt;
&lt;m:intLim m:val="subSup" /&gt;
&lt;m:naryLim m:val="undOvr" /&gt;
&lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
&lt;w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267"&gt;
&lt;w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal" /&gt;
&lt;w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 1" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 2" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 3" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 4" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 5" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 6" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 7" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 8" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 9" /&gt;
&lt;w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /&gt;
&lt;w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title" /&gt;
&lt;w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /&gt;
&lt;w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /&gt;
&lt;w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong" /&gt;
&lt;w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid" /&gt;
&lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /&gt;
&lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /&gt;
&lt;w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /&gt;
&lt;w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote" /&gt;
&lt;w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /&gt;
&lt;w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /&gt;
&lt;w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title" /&gt;
&lt;w:LsdException Locked="false" Priority="37" Name="Bibliography" /&gt;
&lt;w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /&gt;
&lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style type="text/css"&gt;
&lt;!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:1;
mso-generic-font-family:roman;
mso-font-format:other;
mso-font-pitch:variable;
mso-font-signature:0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
{font-family:"Lucida Sans Typewriter";
panose-1:2 11 5 9 3 5 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:modern;
mso-font-pitch:fixed;
mso-font-signature:3 0 0 0 1 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin-top:0in;
margin-right:0in;
margin-bottom:10.0pt;
margin-left:0in;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
{mso-style-type:export-only;
margin-bottom:10.0pt;
line-height:115%;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
--&gt;
&lt;/style&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0in;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
&lt;/style&gt;
&lt;![endif]--&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span color:="" typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;CREATE&lt;/span&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;Function&lt;/span&gt; dbo&lt;span style="color: gray;"&gt;.&lt;/span&gt;fn_IsLeapYear &lt;span style="color: gray;"&gt;(&lt;/span&gt;@year &lt;span style="color: blue;"&gt;INT&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;returns&lt;/span&gt; &lt;span style="color: blue;"&gt;BIT&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;as&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span color:="" typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;BEGIN&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;RETURN&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: blue;"&gt;Select&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;Case&lt;/span&gt; &lt;span style="color: fuchsia;"&gt;datepart&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;mm&lt;span style="color: gray;"&gt;,&lt;/span&gt; &lt;span style="color: fuchsia;"&gt;dateadd&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;dd&lt;span style="color: gray;"&gt;,&lt;/span&gt; 1&lt;span style="color: gray;"&gt;,&lt;/span&gt; &lt;span style="color: fuchsia;"&gt;cast&lt;/span&gt;&lt;span style="color: gray;"&gt;((&lt;/span&gt;&lt;span style="color: fuchsia;"&gt;cast&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;@year &lt;span style="color: blue;"&gt;as&lt;/span&gt; &lt;span style="color: blue;"&gt;varchar&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;4&lt;span style="color: gray;"&gt;))&lt;/span&gt; &lt;span style="color: gray;"&gt;+&lt;/span&gt; &lt;span style="color: red;"&gt;'0228'&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;as&lt;/span&gt; &lt;span style="color: blue;"&gt;datetime&lt;/span&gt;&lt;span style="color: gray;"&gt;)))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;When&lt;/span&gt; 2 &lt;span style="color: blue;"&gt;Then&lt;/span&gt; 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;Else&lt;/span&gt; 0 &lt;span style="color: blue;"&gt;End&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span color:="" typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;END&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span color:="" typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt; &lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=183</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/13/default.aspx">Advanced SQL</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=183#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=183</guid>
      <pubDate>Mon, 20 Oct 2008 14:52:00 GMT</pubDate>
      <slash:comments>3</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=183</trackback:ping>
    </item>
    <item>
      <title>Instructional Blog and Videos: script SQL Objects with Powershell</title>
      <description>&lt;p&gt;OK, here is the site, blog &amp; post that has the instructions on how to script SQL Server Objects with powershell, first he SQLServerCentral post: &lt;a href="http://www.sqlservercentral.com/Forums/FindPost547249.aspx"&gt;http://www.sqlservercentral.com/Forums/FindPost547249.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Also the video Blog post:&lt;a href="http://midnightdba.itbookworm.com/PowershellScriptDBObjects/PowershellScriptDBObjects.html"&gt;midnightdba.itbookworm.com/PowershellScriptDBObjects/PowershellScriptDBObjects.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is from the Blog: &lt;a href="http://midnightdba.itbookworm.com/"&gt;midnightdba.itbookworm.com/&lt;/a&gt;&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=182</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/9/default.aspx">Powershell</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=182#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=182</guid>
      <pubDate>Mon, 20 Oct 2008 14:37:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=182</trackback:ping>
    </item>
    <item>
      <title>SQL Scripting Tables and other objects with Powershell (2008)</title>
      <description>&lt;p&gt;Here is a great Simple-Talk article that explains how to script SQL Server Objects with powershell in SQL Server 2008: &lt;a href="http://www.simple-talk.com/sql/sql-tools/using-powershell-to-generate-table-creation-scripts/"&gt;www.simple-talk.com/sql/sql-tools/using-powershell-to-generate-table-creation-scripts/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Thing is, I know that there is a shorter post a SQLServerCentral that explains how to do this also, but I cannot seem to find it now...&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=181</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/9/default.aspx">Powershell</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=181#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=181</guid>
      <pubDate>Mon, 20 Oct 2008 14:17:00 GMT</pubDate>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=181</trackback:ping>
    </item>
    <item>
      <title>Injection: Server &amp; Client</title>
      <description>&lt;p&gt;Recent conversation at SQLServerCentral.com:&lt;/p&gt;
&lt;p style="margin-bottom: 0.0001pt; line-height: normal;"&gt;Garadin Said:&lt;/p&gt;
&lt;p style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;
&lt;p style="margin: 0in 0in 0.0001pt 0.5in; line-height: normal;"&gt;&lt;em style=""&gt;In ASP for example, you can do:&lt;br /&gt;
&lt;br /&gt;
sql="SELECT * FROM TABLE WHERE Field ='" &amp; MyVariable &amp; "'"&lt;br /&gt;
rs.open sql conn2&lt;br /&gt;
&lt;br /&gt;
Instead of &lt;br /&gt;
&lt;br /&gt;
sql ="Exec dbo.MySP @Variable =" &amp; MyVariable&lt;br /&gt;
rs.open sql conn2&lt;o:p&gt;&lt;/o:p&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p style="margin: 0in 0in 0.0001pt 0.5in; line-height: normal;"&gt;&lt;em style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p style="margin: 0in 0in 0.0001pt 0.5in; line-height: normal;"&gt;&lt;em style=""&gt;That said, I see how the hard coded one has injection vulnerabilities, but how is the SP vulnerable if that variable is used within a structured select statement?&lt;/em&gt;&lt;/p&gt;
&lt;p style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;
&lt;p style="margin-bottom: 0.0001pt; line-height: normal;"&gt;My Response:&lt;/p&gt;
&lt;p style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span times="" new="" roman="" serif=""&gt;Well, let's say that MyVariable was set to " '; DROP TABLE USERS --", then the sql string in your client becomes:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span courier="" new=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span courier="" new=""&gt;SELECT * FROM TABLE WHERE Field =' '; DROP TABLE USERS --&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%;" times="" new="" roman="" serif=""&gt;&lt;br /&gt;
, which might be a problem .  Effecitvely, the injection happened in the client code, instead of in the SQL Server, but the result is the same.&lt;br /&gt;
&lt;br /&gt;
The question that has to be asked in cases like these is "Where is MyVariable coming from?"  If it is from a user who shouldn't be allowed to drop the Users table then you (both client &amp; server) should take steps to prevent this.  If on the other hand, it is coming from you or another DBA or Admin who could do this anyway, then you do not normally have to be concerned.  The threat with injection is that an unprivliged user can play "stupid string tricks" to hijack the SQL Server rights of the server process, either directly or indirectly (through the client).&lt;br /&gt;
&lt;br /&gt;
That's why protecting against injection is really a two tier defense;&lt;br /&gt;
&lt;br /&gt;
1) The client should never allow user-supplied text to become part of a SQL command that it executes, and...&lt;br /&gt;
&lt;br /&gt;
2) The server should never allow client-supplied text to become part of a SQL command that it executes&lt;br /&gt;
&lt;br /&gt;
#2 is most easily accomplished by forcing the client to use stored procedures and then in those stored procedures, either never use dynamic SQL or by being extremely careful in how you construct the dynamic sql, again, following the rule that client-supplied text (parameters) must never become part of the actual SQL command.  (additionally, you should use different users/schemas to firewall the access rights of each piece of the execution chain).&lt;br /&gt;
&lt;br /&gt;
If you do this, then #1 can be accomplished on the client by never trying to "compose" SQL commands (effectively, dynamic SQL) but rather always calling stored procedures and passing the user-supplied text as parameters.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=180</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/261/default.aspx">Dynamic SQL</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=180#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=180</guid>
      <pubDate>Mon, 20 Oct 2008 02:52:00 GMT</pubDate>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=180</trackback:ping>
    </item>
    <item>
      <title>Typical use of Dynamic SQL for Customizable Reports</title>
      <description>&lt;div class="Quote"&gt;
&lt;p&gt;&lt;em&gt;(paraphrased from a recent SqlServerCenterl reply I posted)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The procedure below:&lt;/p&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;meta name="ProgId" content="Word.Document" /&gt;
&lt;meta name="Generator" content="Microsoft Word 12" /&gt;
&lt;meta name="Originator" content="Microsoft Word 12" /&gt;
&lt;link rel="File-List" href="file:///C:\DOCUME~1\byoung\LOCALS~1\Temp\msohtmlclip1\01\clip_filelist.xml" /&gt;
&lt;link rel="themeData" href="file:///C:\DOCUME~1\byoung\LOCALS~1\Temp\msohtmlclip1\01\clip_themedata.thmx" /&gt;
&lt;link rel="colorSchemeMapping" href="file:///C:\DOCUME~1\byoung\LOCALS~1\Temp\msohtmlclip1\01\clip_colorschememapping.xml" /&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
&lt;w:WordDocument&gt;
&lt;w:View&gt;Normal&lt;/w:View&gt;
&lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
&lt;w:TrackMoves /&gt;
&lt;w:TrackFormatting /&gt;
&lt;w:PunctuationKerning /&gt;
&lt;w:ValidateAgainstSchemas /&gt;
&lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
&lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
&lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
&lt;w:DoNotPromoteQF /&gt;
&lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
&lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
&lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
&lt;w:Compatibility&gt;
&lt;w:BreakWrappedTables /&gt;
&lt;w:SnapToGridInCell /&gt;
&lt;w:WrapTextWithPunct /&gt;
&lt;w:UseAsianBreakRules /&gt;
&lt;w:DontGrowAutofit /&gt;
&lt;w:SplitPgBreakAndParaMark /&gt;
&lt;w:DontVertAlignCellWithSp /&gt;
&lt;w:DontBreakConstrainedForcedTables /&gt;
&lt;w:DontVertAlignInTxbx /&gt;
&lt;w:Word11KerningPairs /&gt;
&lt;w:CachedColBalance /&gt;
&lt;/w:Compatibility&gt;
&lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;
&lt;m:mathPr&gt;
&lt;m:mathFont m:val="Cambria Math" /&gt;
&lt;m:brkBin m:val="before" /&gt;
&lt;m:brkBinSub m:val="--" /&gt;
&lt;m:smallFrac m:val="off" /&gt;
&lt;m:dispDef /&gt;
&lt;m:lMargin m:val="0" /&gt;
&lt;m:rMargin m:val="0" /&gt;
&lt;m:defJc m:val="centerGroup" /&gt;
&lt;m:wrapIndent m:val="1440" /&gt;
&lt;m:intLim m:val="subSup" /&gt;
&lt;m:naryLim m:val="undOvr" /&gt;
&lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
&lt;w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267"&gt;
&lt;w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal" /&gt;
&lt;w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 1" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 2" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 3" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 4" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 5" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 6" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 7" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 8" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 9" /&gt;
&lt;w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /&gt;
&lt;w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title" /&gt;
&lt;w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /&gt;
&lt;w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /&gt;
&lt;w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong" /&gt;
&lt;w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid" /&gt;
&lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /&gt;
&lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /&gt;
&lt;w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /&gt;
&lt;w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote" /&gt;
&lt;w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /&gt;
&lt;w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /&gt;
&lt;w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title" /&gt;
&lt;w:LsdException Locked="false" Priority="37" Name="Bibliography" /&gt;
&lt;w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /&gt;
&lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style type="text/css"&gt;
&lt;!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:1;
mso-generic-font-family:roman;
mso-font-format:other;
mso-font-pitch:variable;
mso-font-signature:0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
{font-family:"Lucida Sans Typewriter";
panose-1:2 11 5 9 3 5 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:modern;
mso-font-pitch:fixed;
mso-font-signature:3 0 0 0 1 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin-top:0in;
margin-right:0in;
margin-bottom:10.0pt;
margin-left:0in;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
{mso-style-type:export-only;
margin-bottom:10.0pt;
line-height:115%;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
--&gt;
&lt;/style&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0in;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
&lt;/style&gt;
&lt;![endif]--&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span color:="" typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;CREATE&lt;/span&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;PROCEDURE&lt;/span&gt; FindUserDetails&lt;span style="color: gray;"&gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;&lt;span style=""&gt;      &lt;/span&gt;@SelectColumns &lt;span style="color: blue;"&gt;varchar&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;2000&lt;span style="color: gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;&lt;span style=""&gt;      &lt;/span&gt;@WhereClause &lt;span style="color: blue;"&gt;varchar&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;2000&lt;span style="color: gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;&lt;span style=""&gt;      &lt;/span&gt;@OrderByClause &lt;span style="color: blue;"&gt;varchar&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;50&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color:="" typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;AS&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span color:="" typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;Declare&lt;/span&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt; @SQL &lt;span style="color: blue;"&gt;varchar&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;2000&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span color:="" typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span color:="" typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;Set&lt;/span&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt; @SQL &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;'SELECT '&lt;/span&gt; &lt;span style="color: gray;"&gt;+&lt;/span&gt; @SelectColumns &lt;span style="color: gray;"&gt;+&lt;/span&gt; &lt;span style="color: red;"&gt;'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span color:="" typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;&lt;span style=""&gt; &lt;/span&gt;FROM CustomersDetails&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span color:="" typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;&lt;span style=""&gt;  &lt;/span&gt;JOIN CompanyDetails ON CompanyID = UserCompanyID&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span color:="" typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;'&lt;/span&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt; &lt;span style="color: gray;"&gt;+&lt;/span&gt; @WhereClause &lt;span style="color: gray;"&gt;+&lt;/span&gt; @OrderByClause&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span color:="" typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;EXEC&lt;/span&gt;&lt;span color:="" typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;(&lt;/span&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;@SQL&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span typewriter="" sans="" lucida="" style="font-size: 10pt;"&gt;GO&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;is pretty much exactly what the term "customizable report" means in any application feature list (not to be confused with "Ad-Hoc Reporting" which is a much more general thing).. &lt;/p&gt;
&lt;p&gt;To be clear: the SQL code above is a typical example of a &lt;em&gt;&lt;strong&gt;bad&lt;/strong&gt;&lt;/em&gt; use of dynamic SQL. &lt;wbr&gt;&lt;/wbr&gt; Not because Dynamic SQL is not needed here (it probably is to get decent performance) but because it is &lt;em&gt;extremely&lt;/em&gt; unsafe, and there is virtually nothing that can be done within the stored procedure to remedy that.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;Client-supplied text should never be allowed to become part of an executable SQL command.&lt;/em&gt;&lt;/strong&gt; &lt;wbr&gt;&lt;/wbr&gt; That is how SQL Injection happens and that is what "Safe" dynamic SQL must never allow. 				&lt;font size="1"&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=179</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/261/default.aspx">Dynamic SQL</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=179#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=179</guid>
      <pubDate>Thu, 16 Oct 2008 17:43:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=179</trackback:ping>
    </item>
    <item>
      <title>Retrieving the default system Trace file information</title>
      <description>&lt;p&gt;I saw this over a month ago and I can't beleive that I almost forgot to mention it...&lt;/p&gt;
&lt;p&gt;SQL Server 2005 has a system trace running by default.  Recently Jack Corbett showed me a way (&lt;a href="http://www.sqlservercentral.com/Forums/FindPost563852.aspx"&gt;here&lt;/a&gt;) to not only find where these default trace files are, but also how to query &amp; retrieve them into the running system!  For example, here is Jacks code that demonstrates how to find Logon events that used a Windows Group to Logon:&lt;/p&gt;
&lt;pre&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;font color="blue"&gt;SELECT DISTINCT&lt;br /&gt;   &lt;/font&gt;&lt;font color="black"&gt;I.NTUserName&lt;/font&gt;&lt;font color="gray"&gt;,&lt;br /&gt;   &lt;/font&gt;&lt;font color="black"&gt;I.loginname&lt;/font&gt;&lt;font color="gray"&gt;,&lt;br /&gt;   &lt;/font&gt;&lt;font color="black"&gt;I.SessionLoginName&lt;/font&gt;&lt;font color="gray"&gt;,&lt;br /&gt;   &lt;/font&gt;&lt;font color="black"&gt;I.databasename&lt;/font&gt;&lt;font color="gray"&gt;,&lt;br /&gt;   &lt;/font&gt;&lt;font color="black"&gt;S.&lt;/font&gt;&lt;font color="gray"&gt;*&lt;br /&gt;&lt;/font&gt;&lt;font color="blue"&gt;FROM&lt;br /&gt;   &lt;/font&gt;&lt;font color="black"&gt;sys.traces T &lt;/font&gt;&lt;font color="gray"&gt;CROSS &lt;/font&gt;&lt;font color="black"&gt;Apply&lt;br /&gt;   &lt;/font&gt;&lt;font color="gray"&gt;::&lt;/font&gt;&lt;font color="darkred"&gt;fn_trace_gettable&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;T.path&lt;/font&gt;&lt;font color="gray"&gt;, &lt;/font&gt;&lt;font color="black"&gt;5&lt;/font&gt;&lt;font color="gray"&gt;) &lt;/font&gt;&lt;font color="black"&gt;I &lt;/font&gt;&lt;font color="magenta"&gt;LEFT &lt;/font&gt;&lt;font color="blue"&gt;JOIN&lt;br /&gt;   &lt;/font&gt;&lt;font color="black"&gt;sys.syslogins S &lt;/font&gt;&lt;font color="blue"&gt;ON&lt;br /&gt;       &lt;/font&gt;&lt;font color="magenta"&gt;CONVERT&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="blue"&gt;VARBINARY&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="magenta"&gt;MAX&lt;/font&gt;&lt;font color="gray"&gt;), &lt;/font&gt;&lt;font color="black"&gt;I.loginsid&lt;/font&gt;&lt;font color="gray"&gt;) &lt;/font&gt;&lt;font color="blue"&gt;= &lt;/font&gt;&lt;font color="black"&gt;S.sid    &lt;br /&gt;&lt;/font&gt;&lt;font color="blue"&gt;WHERE&lt;br /&gt;   &lt;/font&gt;&lt;font color="black"&gt;S.sid &lt;/font&gt;&lt;font color="blue"&gt;IS &lt;/font&gt;&lt;font color="gray"&gt;NULL &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;Obviously, this gets reset after every reboot.  Is this seriously cool or what?!?&lt;/p&gt;</description>
      <link>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=178</link>
      <category domain="http://movingsql.com/dnn/home/tabid/125/blogid/259/default.aspx">Performance Management</category>
      <comments>http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=178#Comments</comments>
      <guid isPermaLink="true">http://www.movingsql.com/dnn/Default.aspx?tabid=125&amp;EntryID=178</guid>
      <pubDate>Wed, 15 Oct 2008 15:48:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://movingsql.com/dnn/DesktopModules/Blog/Trackback.aspx?id=178</trackback:ping>
    </item>
  </channel>
</rss>