<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>SimonS Blog on SQL Server Stuff</title><link>http://sqlblogcasts.com/blogs/simons/default.aspx</link><description>Ramblings on all things SQL Server, Integration Services, Service Broker &lt;br /&gt;
Reporting Services, TSQL, Replicaton, Full Text Search&lt;br /&gt;
Spatial data and more&lt;br /&gt;
by Simon Sabin : UK Microsoft MVP - SQL Server&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;If you have any questions please feel free to &lt;a href="http://sqlblogcasts.com/blogs/simons/contact.aspx"&gt;contact me&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/SimonsSqlServerStuff" type="application/rss+xml" /><item><title>Cambridge usergroup meeting on Monday 6th - SQL 2008</title><link>http://feedproxy.google.com/~r/SimonsSqlServerStuff/~3/c35qlx74KP4/Cambridge-usergroup-meeting-on-Monday-6th---SQL-2008.aspx</link><pubDate>Tue, 30 Jun 2009 13:19:11 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:11930</guid><dc:creator>simonsabin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=11930</wfw:commentRss><wfw:comment>http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=11930</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2009/06/30/Cambridge-usergroup-meeting-on-Monday-6th---SQL-2008.aspx#comments</comments><description>&lt;p&gt;Don&amp;#39;t forget if you are in the Cambridge area on Monday 
(6th July 2009) we are doing another usergroup meeting.&lt;/p&gt;
&lt;p&gt;This one is going to be on SQL Server 2008 features. &lt;/p&gt;
&lt;p&gt;We are holding this at the head quarters of Redgate software who are kindly 
sponsoring the event.&lt;/p&gt;
&lt;p&gt;To register go to &lt;a href="http://sqlserverfaq.com/events/183/SQL-Server-User-Group-Cambridge-SQL-Server-2008.aspx"&gt;http://sqlserverfaq.com/events/183/SQL-Server-User-Group-Cambridge-SQL-Server-2008.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I look forward to seeing you there.&lt;/p&gt;
&lt;hr /&gt;
-

&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=11930" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/SimonsSqlServerStuff/~4/c35qlx74KP4" height="1" width="1"/&gt;</description><feedburner:origLink>http://sqlblogcasts.com/blogs/simons/archive/2009/06/30/Cambridge-usergroup-meeting-on-Monday-6th---SQL-2008.aspx</feedburner:origLink></item><item><title>Don't destory your certificate if you dabble with SQL 2008 Encryption</title><link>http://feedproxy.google.com/~r/SimonsSqlServerStuff/~3/Ws61GzNi9XI/Don-t-destory-your-certificate-if-you-dabble-with-SQL-2008-Encryption.aspx</link><pubDate>Tue, 30 Jun 2009 13:11:37 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:11928</guid><dc:creator>simonsabin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=11928</wfw:commentRss><wfw:comment>http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=11928</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2009/06/30/Don-t-destory-your-certificate-if-you-dabble-with-SQL-2008-Encryption.aspx#comments</comments><description>&lt;p&gt;Martin is continuing to post some great new posts on his 
blog. I thought the last one is a real nasty one.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://sqlblogcasts.com/blogs/martinbell/archive/2009/06/29/After-disabling-tde-you-still-requires-certificates-to-restore-the-database.aspx"&gt;http://sqlblogcasts.com/blogs/martinbell/archive/2009/06/29/After-disabling-tde-you-still-requires-certificates-to-restore-the-database.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you have enabled TDE on a database and encrypted some data then remove the 
TDE and backup, you may not be able to restore that backup if you don&amp;#39;t have the 
certificate. &lt;/p&gt;
&lt;p&gt;I am guessing that this is to do with the encryption when you turn TDE on 
being a background task, I expect the same is true in reverse, i.e. pages stay 
encrypted until a background process decrypts them.&lt;/p&gt;
&lt;p&gt;I wonder if the database ever gets back to a totally unencrypted 
version&lt;/p&gt;
&lt;hr /&gt;
-

&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=11928" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/SimonsSqlServerStuff/~4/Ws61GzNi9XI" height="1" width="1"/&gt;</description><feedburner:origLink>http://sqlblogcasts.com/blogs/simons/archive/2009/06/30/Don-t-destory-your-certificate-if-you-dabble-with-SQL-2008-Encryption.aspx</feedburner:origLink></item><item><title>How to stop that annoying beep on your server</title><link>http://feedproxy.google.com/~r/SimonsSqlServerStuff/~3/pxRTrm_ypJs/How-to-stop-that-annoying-beep-on-your-server.aspx</link><pubDate>Tue, 30 Jun 2009 09:45:37 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:11925</guid><dc:creator>simonsabin</dc:creator><slash:comments>3</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=11925</wfw:commentRss><wfw:comment>http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=11925</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2009/06/30/How-to-stop-that-annoying-beep-on-your-server.aspx#comments</comments><description>&lt;p&gt;Many years ago&amp;nbsp;I was working on a project that had 
some large batch processing in it. To do this processing we had some dedicated 
servers, one of which sat under the desk next to me.&lt;/p&gt;
&lt;p&gt;Apart from the noise of the fan soudning like we had actually bought a jet 
fighter the most annoying thing about this processing was that it resulted 
caused the servers beep to continually sound. Something in the code caused it to 
fire. &lt;/p&gt;
&lt;p&gt;Boy it was annoying.&lt;/p&gt;
&lt;p&gt;We were never able to find out how to stop it, I think in the end we 
disconnected it. Well last week I found out and it was so annoyingly simple. 
&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;net stop beep&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Yep thats it, thanks to the trainer that pointed this out last week. As you 
can imagine, having 12 training machines all beeping is not something you really 
want&lt;/p&gt;
&lt;p&gt;To permanently stop it you have to disable the service using &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;sc config beep start= disabled&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Whats really odd is that beep doesn&amp;#39;t appear in the list of 
services&lt;/p&gt;
&lt;hr /&gt;
-

&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=11925" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/SimonsSqlServerStuff/~4/pxRTrm_ypJs" height="1" width="1"/&gt;</description><feedburner:origLink>http://sqlblogcasts.com/blogs/simons/archive/2009/06/30/How-to-stop-that-annoying-beep-on-your-server.aspx</feedburner:origLink></item><item><title>Hyperlinks in custom reports</title><link>http://feedproxy.google.com/~r/SimonsSqlServerStuff/~3/2JQw7PHqrd8/Hyperlinks-in-custom-reports.aspx</link><pubDate>Mon, 29 Jun 2009 07:31:50 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:11918</guid><dc:creator>simonsabin</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=11918</wfw:commentRss><wfw:comment>http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=11918</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2009/06/29/Hyperlinks-in-custom-reports.aspx#comments</comments><description>&lt;p&gt;One feature introduced in SQL Server 2005 is reporting in management studio. 
You have a set of standard reports that allow you to see in a nice report format 
output from dmvs and the default system background trace. Whats neat is that you 
can write your own custom reports. For those that long after the taskpad view of 
a database from SQL 2000 Enterprise manager with the help from Jasper 
Smith&amp;nbsp;I created this &lt;a href="http://sqlblogcasts.com/blogs/simons/archive/2007/03/28/Update-to-the-taskpad-custom-report.aspx"&gt;http://sqlblogcasts.com/blogs/simons/archive/2007/03/28/Update-to-the-taskpad-custom-report.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The custom report feature is almost fantastic, there are 3 main features I 
think make them awkward to use. &lt;/p&gt;
&lt;p&gt;1. You can select text from the report and copy it&lt;br /&gt;2. You can&amp;#39;t add 
additional parameters to allow additional filtering, i.e. filter audit changes 
for today.&lt;br /&gt;3. You can&amp;#39;t have hyperlinks.&lt;/p&gt;
&lt;p&gt;The last one I raised a connect item for &lt;span style="FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;FONT-SIZE:11pt;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-GB;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;&lt;a href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=240407"&gt;https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=240407&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;FONT-SIZE:11pt;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-GB;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;If 
we had this you could write reports that had links to KB articles, blog posts, 
or internal KB systems. Similar to what most monitoring systems 
provide.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;FONT-SIZE:11pt;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-GB;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;If 
you think this is a good idea then please vote on the connect item. I&amp;#39;ve been 
asked by the tools team to see if it is something people want.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;FONT-SIZE:11pt;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-GB;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;Some 
other connect items that you might be interested in supporting if you think they 
are worthwhile.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;FONT-SIZE:11pt;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-GB;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;Use 
expressions for data sources - &lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;FONT-SIZE:11pt;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-GB;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;&lt;a href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=238233"&gt;https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=238233&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;FONT-SIZE:11pt;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-GB;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;Be 
able to combine data from different data sources - &lt;a href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=240268"&gt;https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=240268&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;FONT-SIZE:11pt;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-GB;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;Be 
able to run reports against SQL 2000 database - &lt;a href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=240476"&gt;https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=240476&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;FONT-SIZE:11pt;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-GB;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;hr /&gt;
-

&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=11918" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/SimonsSqlServerStuff/~4/2JQw7PHqrd8" height="1" width="1"/&gt;</description><feedburner:origLink>http://sqlblogcasts.com/blogs/simons/archive/2009/06/29/Hyperlinks-in-custom-reports.aspx</feedburner:origLink></item><item><title>Cambridge user group correction</title><link>http://feedproxy.google.com/~r/SimonsSqlServerStuff/~3/HhjXrOqtxkg/cambridge-user-group-correction.aspx</link><pubDate>Tue, 23 Jun 2009 09:48:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:11895</guid><dc:creator>simonsabin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=11895</wfw:commentRss><wfw:comment>http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=11895</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2009/06/23/cambridge-user-group-correction.aspx#comments</comments><description>I incorrectly said in my last blog post http://sqlblogcasts.com/blogs/simons/archive/2009/06/23/Cambridge-SQL-Server-Usegroup---SQL-2008.aspx that the usergroup was on the 6th June. That would be going some, whilst SQL is good it doesn&amp;#39;t yet do time...(&lt;a href="http://sqlblogcasts.com/blogs/simons/archive/2009/06/23/cambridge-user-group-correction.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=11895" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/SimonsSqlServerStuff/~4/HhjXrOqtxkg" height="1" width="1"/&gt;</description><feedburner:origLink>http://sqlblogcasts.com/blogs/simons/archive/2009/06/23/cambridge-user-group-correction.aspx</feedburner:origLink></item><item><title>Cambridge SQL Server Usegroup - SQL 2008</title><link>http://feedproxy.google.com/~r/SimonsSqlServerStuff/~3/b1DZxetgTeg/Cambridge-SQL-Server-Usegroup---SQL-2008.aspx</link><pubDate>Mon, 22 Jun 2009 23:46:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:11894</guid><dc:creator>simonsabin</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=11894</wfw:commentRss><wfw:comment>http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=11894</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2009/06/23/Cambridge-SQL-Server-Usegroup---SQL-2008.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;ve just updated the agenda for the Cambridge usergroup meeting on the 6th July.[This is now the correct date SS 23/6/08]&lt;/p&gt;
&lt;p&gt;If you plan to attend make sure you register &lt;a href="http://sqlserverfaq.com/events/183/SQL-Server-User-Group-Cambridge-SQL-Server-2008.aspx"&gt;http://sqlserverfaq.com/events/183/SQL-Server-User-Group-Cambridge-SQL-Server-2008.aspx&lt;/a&gt; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;We are holding the meeting at Redgates offices (&lt;a href="http://www.red-gate.com/about/Map_colour.pdf"&gt;http://www.red-gate.com/about/Map_colour.pdf&lt;/a&gt; which are very nice)&lt;/p&gt;
&lt;p&gt;The topic for the evening is all things SQL Server 2008. &lt;/p&gt;
&lt;p&gt;We will be trying live meeting again to view go to &lt;a href="https://www.livemeeting.com/cc/usergroups/join?id=HWJRB6&amp;amp;role=attend&amp;amp;pw=R7R4N%217pq"&gt;https://www.livemeeting.com/cc/usergroups/join?id=HWJRB6&amp;amp;role=attend&amp;amp;pw=R7R4N%217pq&lt;/a&gt; This will be open just before the meeting starts.&lt;/p&gt;
&lt;p&gt;I look forward to seeing you there.&lt;/p&gt;
&lt;p&gt;In the immortal words of Alan Rickman&lt;/p&gt;
&lt;p&gt;&amp;quot;&amp;#39;you, redgate offices, 6:00 , you, 6:45.... bring a friend&amp;#39;&lt;/p&gt;
&lt;p&gt;If you plan to attend make sure you register &lt;a href="http://sqlserverfaq.com/events/183/SQL-Server-User-Group-Cambridge-SQL-Server-2008.aspx"&gt;http://sqlserverfaq.com/events/183/SQL-Server-User-Group-Cambridge-SQL-Server-2008.aspx&lt;/a&gt; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;
&lt;hr /&gt;
-
&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=11894" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/SimonsSqlServerStuff/~4/b1DZxetgTeg" height="1" width="1"/&gt;</description><feedburner:origLink>http://sqlblogcasts.com/blogs/simons/archive/2009/06/23/Cambridge-SQL-Server-Usegroup---SQL-2008.aspx</feedburner:origLink></item><item><title>Exporting XML data from SSIS - nugget</title><link>http://feedproxy.google.com/~r/SimonsSqlServerStuff/~3/LpNIumG4oBs/Exporting-XML-data-from-SSIS---nugget.aspx</link><pubDate>Mon, 22 Jun 2009 23:10:35 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:11893</guid><dc:creator>simonsabin</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=11893</wfw:commentRss><wfw:comment>http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=11893</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2009/06/23/Exporting-XML-data-from-SSIS---nugget.aspx#comments</comments><description>&lt;p&gt; James Rowland-Jones asked me this evening how to export 
XML data from SSIS. I&amp;#39;ve done this before but always used the Script component 
and I wondered if there was another way.&lt;/p&gt;
&lt;p&gt;I tried to think of a component that saves data to a file. Oddly there isn&amp;#39;t 
a control flow task that does that. The nearest I came to was the &amp;quot;export 
column&amp;quot; transform, this is a hardly known transform. It was a very specific 
function that most people don&amp;#39;t need. For each row of data going through it, it 
exports the contents of a column to a file with a filename specified in another 
column.&lt;/p&gt;
&lt;p&gt;Thinking of this I generated an example query that returns a rowset with a 
filename column and our XML column (data). &lt;/p&gt;
&lt;p style="MARGIN:0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="FONT-SIZE:9pt;mso-bidi-font-size:11.0pt;"&gt;&lt;font face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;mso-bidi-font-size:14.0pt;mso-no-proof:yes;"&gt;select&lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-bidi-font-size:14.0pt;mso-no-proof:yes;"&gt; 
&lt;span style="COLOR:red;"&gt;&amp;#39;c:\test.xml&amp;#39;&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;filename&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-bidi-font-size:14.0pt;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:blue;"&gt; &lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;select&lt;/span&gt; name&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:blue;"&gt; &lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;select&lt;/span&gt; name 
&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-bidi-font-size:14.0pt;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&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;columns&lt;/span&gt; c &lt;span style="COLOR:blue;"&gt;where&lt;/span&gt; 
c&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;&lt;span style="COLOR:fuchsia;"&gt;object_id&lt;/span&gt; 
&lt;span style="COLOR:gray;"&gt;=&lt;/span&gt; o&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;&lt;span style="COLOR:fuchsia;"&gt;object_id&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-bidi-font-size:14.0pt;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&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;&amp;#39;column&amp;#39;&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; &lt;span style="COLOR:green;"&gt;columns&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-bidi-font-size:14.0pt;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &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;objects&lt;/span&gt; 
o&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-bidi-font-size:14.0pt;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &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;&amp;#39;object&amp;#39;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;),&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;root&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;schema&amp;#39;&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; 
data&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-bidi-font-size:14.0pt;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:9pt;mso-bidi-font-size:11.0pt;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This can then be plugged into an OLEDB source, connected 
to an Export Column transform configure the data column, filename and whether to 
append or truncate and away you go. You can get the video here &lt;a href="http://media.sqlknowhow.com/nuggets/Exporting%20XML%20data%20from%20SSIS.wmv"&gt;http://media.sqlknowhow.com/nuggets/Exporting%20XML%20data%20from%20SSIS.wmv&lt;/a&gt;              
            
&amp;nbsp;or watch it below.&lt;/p&gt;
&lt;p&gt;&lt;iframe style="WIDTH:660px;HEIGHT:580px;" src="http://media.sqlknowhow.com/nuggets/Exporting%20XML%20data%20from%20SSIS.html" frameborder="0"&gt;&lt;/iframe&gt;&lt;/p&gt;&lt;hr /&gt;
-

&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=11893" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/SimonsSqlServerStuff/~4/LpNIumG4oBs" height="1" width="1"/&gt;</description><feedburner:origLink>http://sqlblogcasts.com/blogs/simons/archive/2009/06/23/Exporting-XML-data-from-SSIS---nugget.aspx</feedburner:origLink></item><item><title>Do you live at WC1X 8TG</title><link>http://feedproxy.google.com/~r/SimonsSqlServerStuff/~3/_sTcWD2tRaY/Do-you-live-at-WC1X-8TG.aspx</link><pubDate>Sat, 20 Jun 2009 20:48:34 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:11883</guid><dc:creator>simonsabin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=11883</wfw:commentRss><wfw:comment>http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=11883</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2009/06/20/Do-you-live-at-WC1X-8TG.aspx#comments</comments><description>&lt;p&gt;If you came to the usergroup meeting and completed the 
survey today and said your postcode was WC1X 8TG can you please ocntact me so we 
can discuss what nugget/session you would be inetersted in doing, as you forgot 
to put your name on the survey.&lt;/p&gt;
&lt;p&gt;You can use the contact line on the right hand side of this blog.&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;
&lt;hr /&gt;
-

&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=11883" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/SimonsSqlServerStuff/~4/_sTcWD2tRaY" height="1" width="1"/&gt;</description><feedburner:origLink>http://sqlblogcasts.com/blogs/simons/archive/2009/06/20/Do-you-live-at-WC1X-8TG.aspx</feedburner:origLink></item><item><title>Usergroup meeting on Performance tuning and replaying profiler</title><link>http://feedproxy.google.com/~r/SimonsSqlServerStuff/~3/2HNv3rWl6G4/usergroup-meeting-on-performance-tuning-and-replaying-profiler.aspx</link><pubDate>Thu, 18 Jun 2009 18:13:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:11874</guid><dc:creator>simonsabin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=11874</wfw:commentRss><wfw:comment>http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=11874</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2009/06/18/usergroup-meeting-on-performance-tuning-and-replaying-profiler.aspx#comments</comments><description>The live meeting on performance tuning and profiler has started. To attend go to https://www.livemeeting.com/cc/usergroups/join?id=JK8HND&amp;amp;role=attend&amp;amp;pw=Wbg%5CM4%3FfR Hope to see you there...(&lt;a href="http://sqlblogcasts.com/blogs/simons/archive/2009/06/18/usergroup-meeting-on-performance-tuning-and-replaying-profiler.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=11874" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/SimonsSqlServerStuff/~4/2HNv3rWl6G4" height="1" width="1"/&gt;</description><feedburner:origLink>http://sqlblogcasts.com/blogs/simons/archive/2009/06/18/usergroup-meeting-on-performance-tuning-and-replaying-profiler.aspx</feedburner:origLink></item><item><title>Intellisense and objects created on the fly</title><link>http://feedproxy.google.com/~r/SimonsSqlServerStuff/~3/SC3vmDS7YA0/Intellisense-and-objects-created-on-the-fly.aspx</link><pubDate>Thu, 18 Jun 2009 09:03:14 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:11870</guid><dc:creator>simonsabin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=11870</wfw:commentRss><wfw:comment>http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=11870</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2009/06/18/Intellisense-and-objects-created-on-the-fly.aspx#comments</comments><description>&lt;p&gt;I had an email from one the people that attends the 
usergroup I help run in London. She was suprised that when she had a create 
table statement intellisense is able to understand that this table is 
being&amp;nbsp;created and provide intellisense on that table. This is just like any 
other object in your script, i.e. if you declare a variable then intellisense 
can provide that variable&amp;nbsp;in a list&amp;nbsp;for you. I guess tables are more 
complex than variables, but if with other languages like C# the intellisense is 
able to parse objects methods and even comments to provide information about 
those objects and methods without even compiling your code.&lt;/p&gt;
&lt;p&gt;For a demo of this feature have a look at this nugget &lt;a href="http://media.sqlknowhow.com/nuggets/Intellisense%20and%20objects%20created%20in%20scripts.wmv"&gt;http://media.sqlknowhow.com/nuggets/Intellisense%20and%20objects%20created%20in%20scripts.wmv&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;iframe src="http://media.sqlknowhow.com/nuggets/Intellisense%20and%20objects%20created%20in%20scripts.html" style="WIDTH:660px;HEIGHT:580px;" frameborder="0"&gt;&lt;/iframe&gt;&lt;hr /&gt;
-

&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=11870" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/SimonsSqlServerStuff/~4/SC3vmDS7YA0" height="1" width="1"/&gt;</description><feedburner:origLink>http://sqlblogcasts.com/blogs/simons/archive/2009/06/18/Intellisense-and-objects-created-on-the-fly.aspx</feedburner:origLink></item><item><title>When a query plan goes wrong</title><link>http://feedproxy.google.com/~r/SimonsSqlServerStuff/~3/Qcthsvkzkk4/When-a-query-plan-goes-wrong.aspx</link><pubDate>Wed, 17 Jun 2009 14:22:45 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:11867</guid><dc:creator>simonsabin</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=11867</wfw:commentRss><wfw:comment>http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=11867</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2009/06/17/When-a-query-plan-goes-wrong.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;m working&amp;nbsp;on a whitepaper on when query plans go 
wrong, and I&amp;#39;m amazed at the number of scenarios that they can go wrong.&lt;/p&gt;
&lt;p&gt;A recent one I just came across was related to SSIS. If you use the table or 
view option for OLEDB sources you can get really bad plans. Piers did some 
digging and found that to get the meta data for the query it issues a set 
rowcount 1. He found this resulted in a plan being cached that when used without 
the set rowcount was awful for performance. &lt;a href="http://piers7.blogspot.com/2009/06/nasty-ssis-2008-issue-with-table-or.html"&gt;http://piers7.blogspot.com/2009/06/nasty-ssis-2008-issue-with-table-or.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Below is a repro and highlight a typical bad plan situation. A plan is built 
on the assumption of processing a very small number of rows and so chooses a 
nested loop join. Nested loop joins dont&amp;#39; perform if you are processing large 
numbers of rows, do to the lookup nature.&lt;/p&gt;
&lt;p&gt;In this repro you will see that we exceute the same logical query three 
times. The first and second queries are identical and so will reuse the same 
query plan, that is cached by the first one being executed, but due to the 
comments the third one will generate a new plan. Because the third one is not 
limited to 1 row it generates the best plan for readding all the data (should be 
a MERGE join in this case). &lt;/p&gt;
&lt;p&gt;So the lesson here is be very careful when using rowcount to look at a query 
if you are going to be executing the same query to get all the data.&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;set&lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:14pt;mso-no-proof:yes;"&gt; &lt;span style="COLOR:blue;"&gt;rowcount&lt;/span&gt; 1&lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;go&lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;select&lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:14pt;mso-no-proof:yes;"&gt; H&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderID&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt; 
H&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderNumber &lt;span style="COLOR:gray;"&gt;,&lt;/span&gt; O&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;ProductID &lt;span style="COLOR:gray;"&gt;,&lt;/span&gt; O&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;UnitPrice 
&lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;from&lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:14pt;mso-no-proof:yes;"&gt; 
AdventureWorks2008&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;Sales&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderHeader H&lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:gray;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;join&lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:14pt;mso-no-proof:yes;"&gt; 
AdventureWorks2008&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;Sales&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderDetail O &lt;span style="COLOR:blue;"&gt;on&lt;/span&gt; H&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderID 
&lt;span style="COLOR:gray;"&gt;=&lt;/span&gt; O&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderID &lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;go&lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;set&lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:14pt;mso-no-proof:yes;"&gt; &lt;span style="COLOR:blue;"&gt;rowcount&lt;/span&gt; 0&lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;go&lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;select&lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:14pt;mso-no-proof:yes;"&gt; H&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderID&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt; 
H&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderNumber &lt;span style="COLOR:gray;"&gt;,&lt;/span&gt; O&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;ProductID &lt;span style="COLOR:gray;"&gt;,&lt;/span&gt; O&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;UnitPrice 
&lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;from&lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:14pt;mso-no-proof:yes;"&gt; 
AdventureWorks2008&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;Sales&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderHeader H&lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:gray;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;join&lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:14pt;mso-no-proof:yes;"&gt; 
AdventureWorks2008&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;Sales&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderDetail O &lt;span style="COLOR:blue;"&gt;on&lt;/span&gt; H&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderID 
&lt;span style="COLOR:gray;"&gt;=&lt;/span&gt; O&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderID &lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;go&lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:green;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;--Use 
some text to change the query to get a new plan&lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;select&lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:14pt;mso-no-proof:yes;"&gt; H&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderID&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt; 
H&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderNumber &lt;span style="COLOR:gray;"&gt;,&lt;/span&gt; O&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;ProductID &lt;span style="COLOR:gray;"&gt;,&lt;/span&gt; O&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;UnitPrice 
&lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;from&lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:14pt;mso-no-proof:yes;"&gt; 
AdventureWorks2008&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;Sales&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderHeader H&lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:gray;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;join&lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:14pt;mso-no-proof:yes;"&gt; 
AdventureWorks2008&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;Sales&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderDetail O &lt;span style="COLOR:blue;"&gt;on&lt;/span&gt; H&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderID 
&lt;span style="COLOR:gray;"&gt;=&lt;/span&gt; O&lt;span style="COLOR:gray;"&gt;.&lt;/span&gt;SalesOrderID &lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0cm 0cm 10pt;" class="MsoNormal"&gt;&lt;span style="LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:14pt;mso-no-proof:yes;"&gt;go&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr /&gt;
-

&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=11867" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/SimonsSqlServerStuff/~4/Qcthsvkzkk4" height="1" width="1"/&gt;</description><feedburner:origLink>http://sqlblogcasts.com/blogs/simons/archive/2009/06/17/When-a-query-plan-goes-wrong.aspx</feedburner:origLink></item><item><title>When does 1+1 = 3</title><link>http://feedproxy.google.com/~r/SimonsSqlServerStuff/~3/p1VevxjM8gQ/When-does-1-1---3.aspx</link><pubDate>Mon, 01 Jun 2009 15:31:16 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:11787</guid><dc:creator>simonsabin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=11787</wfw:commentRss><wfw:comment>http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=11787</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2009/06/01/When-does-1-1---3.aspx#comments</comments><description>&lt;p&gt;There are sometimes when you are looking at somethin and 
the only possibly solution you can come up with is that there is a bug.&lt;/p&gt;
&lt;p&gt;Imagine you have a calculation that is showing 1+1= 3, everything about 
everything you&amp;#39;ve ever learnt says there it just can&amp;#39;t be so.&lt;/p&gt;
&lt;p&gt;Thats what James (@jrowlandjones) faced the other day when loading in 
millions of rows of data. &lt;/p&gt;
&lt;p&gt;His data sets where for multually exclusive ranegs of index keys and yet he 
was getting a deadlock. A deadlock can only occur when two processes require the 
same resources. The resource in question was a key, how could that be, how can 
to loads be trying to lock the same key when the keys they contain are don&amp;#39;t 
overlap at all.&lt;/p&gt;
&lt;p&gt;Read James&amp;#39;s great blog post on how we diagnosed the issue and the solutions 
available to you.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.conchango.com/jamesrowlandjones/archive/2009/05/28/the-curious-case-of-the-dubious-deadlock-and-the-not-so-logical-lock.aspx?CommentPosted=true#commentmessage"&gt;http://blogs.conchango.com/jamesrowlandjones/archive/2009/05/28/the-curious-case-of-the-dubious-deadlock-and-the-not-so-logical-lock.aspx?CommentPosted=true#commentmessage&lt;/a&gt;&lt;/p&gt;
&lt;hr /&gt;
-

&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=11787" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/SimonsSqlServerStuff/~4/p1VevxjM8gQ" height="1" width="1"/&gt;</description><feedburner:origLink>http://sqlblogcasts.com/blogs/simons/archive/2009/06/01/When-does-1-1---3.aspx</feedburner:origLink></item><item><title>Whats the most important thing when performance tuning?</title><link>http://feedproxy.google.com/~r/SimonsSqlServerStuff/~3/qNS9UEZaVJQ/Whats-the-most-important-thing-when-performance-tuning-.aspx</link><pubDate>Sun, 31 May 2009 11:45:01 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:11781</guid><dc:creator>simonsabin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=11781</wfw:commentRss><wfw:comment>http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=11781</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2009/05/31/Whats-the-most-important-thing-when-performance-tuning-.aspx#comments</comments><description>&lt;p&gt;Paul Randal has a great survey this week. You have to 
decide on the ONE thing that is important when performance tuning.&lt;/p&gt;
&lt;p&gt;It would have been good to have a second question to ask what your job role 
is. I would expect a correlation between job role and the answer.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.sqlskills.com/BLOGS/PAUL/post/Weekly-survey-whats-the-most-important-thing-when-performance-tuning.aspx"&gt;http://www.sqlskills.com/BLOGS/PAUL/post/Weekly-survey-whats-the-most-important-thing-when-performance-tuning.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I won&amp;#39;t say what I decided, I was torn. I think indexing is essential as you 
can index out of many poor written queries but then again application code is 
also important. As they say &amp;quot;you can&amp;#39;t polish a turd&amp;quot;, but if you don&amp;#39;t have 
enough memory then your performance won&amp;#39;t be great either.&lt;/p&gt;
&lt;p&gt;So which will you choose&lt;/p&gt;
&lt;hr /&gt;
-

&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=11781" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/SimonsSqlServerStuff/~4/qNS9UEZaVJQ" height="1" width="1"/&gt;</description><feedburner:origLink>http://sqlblogcasts.com/blogs/simons/archive/2009/05/31/Whats-the-most-important-thing-when-performance-tuning-.aspx</feedburner:origLink></item><item><title>Myth : I don't need point in time recovery so I don't need the transaction log </title><link>http://feedproxy.google.com/~r/SimonsSqlServerStuff/~3/o2v5UlcJqxM/Myth---I-don-t-need-point-in-time-recovery-so-I-don-t-need-the-transaction-log-.aspx</link><pubDate>Wed, 27 May 2009 22:38:38 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:11767</guid><dc:creator>simonsabin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=11767</wfw:commentRss><wfw:comment>http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=11767</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2009/05/27/Myth---I-don-t-need-point-in-time-recovery-so-I-don-t-need-the-transaction-log-.aspx#comments</comments><description>&lt;p&gt;Wrong, wrong, wrong.&lt;/p&gt;
&lt;p&gt;This post was in response to a post in the forums &amp;quot;&lt;span&gt;How 
do I delete the log file?&amp;quot;&lt;/span&gt;&amp;nbsp;&lt;a href="http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/69c8ecc6-6414-43b1-8c08-21fdf2ca9c54"&gt;http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/69c8ecc6-6414-43b1-8c08-21fdf2ca9c54&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The transaction log for a SQL Server database is not a log like the ones many 
applications produce that is just history of the stuff you&amp;#39;ve done in the 
application, say for debugging. Whilst it is a record of the changes you make to 
your data it is a critical element in how data is kept consistent in your 
database database, i.e. not corrupt.&lt;/p&gt;
&lt;p&gt;Lets start by going over a few basics. A&amp;nbsp;SQL Server is made of tables, 
the data for a table is stored on a page. These pages are stored in the data 
files (mdf/ndf ).&lt;/p&gt;
&lt;p&gt;When you make changes to rows in a table, the pages containing those rows are 
read from disk and put into memory.&amp;nbsp;The changes are recorded in the 
transaction log and are then the pages changed to reflect the chanegs you&amp;#39;ve 
made. The pages are only change IN MEMORY, not in the data files. If at this 
point your server dies, your changes that are currently only in memory and not 
in the data files will have been lost. However they are in the transaction log. 
So when SQL Server starts a recovery process is run. This can be seen in the 
errorlog. This process looks for transactions that are in the transaction log 
that didn&amp;#39;t get harded to the data file and it makes the changes to the data 
file. So you don&amp;#39;t loose your data.&lt;/p&gt;
&lt;p&gt;There is an additional process that runs called the lazy writer, what this 
does is free pages from cache when under memory pressure. This means that the 
changes you have made to pages in memory may be hardened to the data files. 
Great you might think thats what I want. However this can also happen in the 
MIDDLE of a transaction. This means that you could have changes in your data 
files that have yet to be committed. In this case if SQL Server crashes mid 
transaction, when the recovery process runs it looks for changes that were made 
and recorded in the transaction log and hardened to disk but for which the 
transaction never completed. These changes are then rolled back thus leaving 
your data files in a consistent state.&lt;/p&gt;
&lt;p style="MARGIN:0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="FONT-SIZE:20pt;mso-bidi-font-size:11.0pt;"&gt;&lt;font face="Calibri"&gt;So even 
if you don&amp;#39;t need point in time recovery you still need your transaction 
log.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The key thing is that if you don&amp;#39;t need point in time recovery then you 
should set your recovery model to simple. What this does is frees the space in 
the transaction log of committed transactions and so your transaction log 
shouldn&amp;#39;t grow. &lt;/p&gt;
&lt;p&gt;One note: If you have a single transaction that requires 10Gb of transaction 
log space then using simple recovery won&amp;#39;t help. For example, updating every row 
in a very large table in one statement, this is one transaction and so the 
transaction log needs to be big enough to hold the changes. If space on the 
drive for the transaction log space is problem then you need to look at batching 
up your changes into smaller transactions, that once committed can be truncated 
from the transaction log. See my posts about DELETE and UPDATE with TOP &lt;a href="http://sqlblogcasts.com/blogs/simons/archive/2009/05/22/UPDATE-and-DELETE-TOP-and-ORDER-BY---Part2.aspx"&gt;http://sqlblogcasts.com/blogs/simons/archive/2009/05/22/UPDATE-and-DELETE-TOP-and-ORDER-BY---Part2.aspx&lt;/a&gt;&lt;/p&gt;
&lt;hr /&gt;
-

&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=11767" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/SimonsSqlServerStuff/~4/o2v5UlcJqxM" height="1" width="1"/&gt;</description><feedburner:origLink>http://sqlblogcasts.com/blogs/simons/archive/2009/05/27/Myth---I-don-t-need-point-in-time-recovery-so-I-don-t-need-the-transaction-log-.aspx</feedburner:origLink></item><item><title>When a decimal isn't a decimal - beware</title><link>http://feedproxy.google.com/~r/SimonsSqlServerStuff/~3/57FD1oS8zN4/When-a-decimal-isn-t-a-decimal---beware.aspx</link><pubDate>Tue, 26 May 2009 13:07:10 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:11757</guid><dc:creator>simonsabin</dc:creator><slash:comments>9</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=11757</wfw:commentRss><wfw:comment>http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=11757</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2009/05/26/When-a-decimal-isn-t-a-decimal---beware.aspx#comments</comments><description>&lt;p&gt;To say the type system in SQL is lax is an not quite 
correct, its actually lax, in consistent and very annoying.&lt;/p&gt;
&lt;p&gt;The most common feature I come across is that of integers and decimals.&lt;/p&gt;
&lt;p&gt;If I declare a variable as decimal(10,4) and assign it the value 10/4 you 
could expect a number of things to happen&lt;/p&gt;
&lt;p&gt;1. The code doesn&amp;#39;t run because you are casting an integer to a decimal&lt;/p&gt;
&lt;p&gt;2. The code runs and stores 2.5 in the variable&lt;/p&gt;
&lt;p&gt;3. The code runs and does the calculation based on integers 10/4&amp;nbsp;and 
realises truncation will occur (as the destination type is decimal) and raise a 
warning&lt;/p&gt;
&lt;p&gt;4. The code calculates the 10/4 as integers so results in an integer of 2 and 
sticks it in the variable.&lt;/p&gt;
&lt;p&gt;In a nice type safe system, i.e. c# one would get 1. The result of an 
integer/integer is an integer and you can&amp;#39;t store an integer in a decimal. This 
is nice because to get the value stored you have to explicitly do a cast. This 
makes you think and realise that you probably have to cast the 10 or the 4 to 
get the required decimal value of 2.5 returned.&lt;/p&gt;
&lt;p&gt;In TSQL however you get 4. &lt;/p&gt;
&lt;p&gt;If you want to look at inconsistencies then look at ISNULL and COALESCE. 
ISNULL returns the same type as the first parameter and COALESCE&amp;nbsp;returns 
the data type based&amp;nbsp;on evaluating&amp;nbsp;all the data types&amp;nbsp;passed to 
the function and evaluating the top datatype &lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:10pt;mso-no-proof:yes;"&gt;declare&lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:10pt;mso-no-proof:yes;"&gt; @i &lt;span style="COLOR:blue;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:10pt;mso-no-proof:yes;"&gt;declare&lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:10pt;mso-no-proof:yes;"&gt; @s &lt;span style="COLOR:blue;"&gt;varchar&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;100&lt;span style="COLOR:gray;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:10pt;mso-no-proof:yes;"&gt;select&lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:10pt;mso-no-proof:yes;"&gt; &lt;span style="COLOR:fuchsia;"&gt;ISNULL&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;@s&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;100&amp;#39;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;)&lt;/span&gt; &lt;span style="COLOR:gray;"&gt;+&lt;/span&gt; &lt;span style="COLOR:red;"&gt;&amp;#39;100&amp;#39;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt; &lt;span style="COLOR:fuchsia;"&gt;ISNULL&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;@s&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt; 100&lt;span style="COLOR:gray;"&gt;)&lt;/span&gt; &lt;span style="COLOR:gray;"&gt;+&lt;/span&gt; &lt;span style="COLOR:red;"&gt;&amp;#39;100&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="LINE-HEIGHT:normal;MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:10pt;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:fuchsia;"&gt;COALESCE&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;@s&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;100&amp;#39;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;)&lt;/span&gt; &lt;span style="COLOR:gray;"&gt;+&lt;/span&gt; &lt;span style="COLOR:red;"&gt;&amp;#39;100&amp;#39;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt; &lt;span style="COLOR:fuchsia;"&gt;COALESCE&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;@s&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt; 100&lt;span style="COLOR:gray;"&gt;)&lt;/span&gt; &lt;span style="COLOR:gray;"&gt;+&lt;/span&gt; &lt;span style="COLOR:red;"&gt;&amp;#39;100&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This is sort of where I got stuck today, I was using the Radians function to 
use in a conversion from longitude and latitude to OS grid reference. This is a 
shocking formula and one that I have javascript and C# versions but not a TSQL 
one. I couldn&amp;#39;t for the life of me figure out why the TSQL result was vastly 
different.&lt;/p&gt;
&lt;p&gt;So I debugged the code, thank you SQL 2008 (although I did find a nice 
feature I will blog about later).&lt;/p&gt;
&lt;p&gt;What I found was this line wasn&amp;#39;t returning the same value in TSQL as in C#, 
it was returning 0 in TSQL, and even I know 49 degrees isn&amp;#39;t 0 radians&lt;/p&gt;
&lt;p style="MARGIN:0cm 0cm 10pt;" class="MsoNormal"&gt;&lt;span style="LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:10pt;mso-no-proof:yes;"&gt;declare&lt;/span&gt;&lt;span style="LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:10pt;mso-no-proof:yes;"&gt; 
@lat0 &lt;span style="COLOR:blue;"&gt;numeric&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;29&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;15&lt;span style="COLOR:gray;"&gt;)=&lt;/span&gt; &lt;span style="COLOR:fuchsia;"&gt;radians&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;49&lt;span style="COLOR:gray;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Gosh I thought I had found bug in TSQL. Then I had a euraka moment, you&amp;#39;re 
probably already there. I changed the code to &lt;/p&gt;
&lt;p style="MARGIN:0cm 0cm 10pt;" class="MsoNormal"&gt;&lt;span style="LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:10pt;mso-no-proof:yes;"&gt;declare&lt;/span&gt;&lt;span style="LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:10pt;mso-no-proof:yes;"&gt; 
@lat0 &lt;span style="COLOR:blue;"&gt;numeric&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;29&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;15&lt;span style="COLOR:gray;"&gt;)=&lt;/span&gt; &lt;span style="COLOR:fuchsia;"&gt;radians&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;49.0&lt;span style="COLOR:gray;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;and it returned the correct value. On looking at BOL it does say that radians 
returns the same data type as the value passed. Which to me sounds mad because 
the most even for a value of 360 degrees the radians value is only 6 and so the 
decimal places are very very important. Whats more&amp;nbsp; any value of degrees 
between 0 and&amp;nbsp;90 is &amp;lt; 1 and so if you only specify an integer for the 
degrees, as in my case above, you will get 0.&lt;/p&gt;
&lt;p&gt;Anyway lesson learnt. So from now on as well as always changing 10/2 to 
10.0/2 I will be making sure any literals passed to functions like this will 
also have .0 tagged on the end.&lt;/p&gt;
&lt;hr /&gt;
-

&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=11757" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/SimonsSqlServerStuff/~4/57FD1oS8zN4" height="1" width="1"/&gt;</description><feedburner:origLink>http://sqlblogcasts.com/blogs/simons/archive/2009/05/26/When-a-decimal-isn-t-a-decimal---beware.aspx</feedburner:origLink></item></channel></rss>
