<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>sql-server-2008 &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/sql-server-2008/</link>
	<description>Feed of posts on WordPress.com tagged "sql-server-2008"</description>
	<pubDate>Sun, 29 Nov 2009 20:29:33 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Using SSIS to Export a Fixed Width Flat File]]></title>
<link>http://ctrlshiftb.wordpress.com/2009/11/27/using-ssis-to-export-a-fixed-width-flat-file/</link>
<pubDate>Fri, 27 Nov 2009 23:51:45 +0000</pubDate>
<dc:creator>Ron</dc:creator>
<guid>http://ctrlshiftb.wordpress.com/2009/11/27/using-ssis-to-export-a-fixed-width-flat-file/</guid>
<description><![CDATA[To begin, open Business Intelligence Development Studio (or Visual Studio, if you have that installe]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><div class="mceTemp">To begin, open Business Intelligence Development Studio (or Visual Studio, if you have that installed) and under Business Intelligence projects, create a new Integration Services Package. You will also need a directory at c:\export to contain the output flat file.</div>
<div class="mceTemp">Start by adding a new database connection on the Connection Manager tab (this is usually at the bottom of the SSIS Package Designed). For the purposes of this tutorial I will be using the AdventureWorks database my local machine. This connection will be the source of the data for the flat file.</div>
<div id="attachment_296" class="wp-caption alignnone" style="width: 304px"><a href="http://ctrlshiftb.wordpress.com/files/2009/11/capture-200911271715031.jpg"><img class="size-medium wp-image-296" title="Database Connection" src="http://ctrlshiftb.wordpress.com/files/2009/11/capture-200911271715031.jpg?w=294" alt="Database Connection" width="294" height="300" /></a><p class="wp-caption-text">Database Connection</p></div>
<p>After you create the database connection, go ahead and create the flat file destination connection. I used the c:\export directory and named my export file Export.txt, but anything will work. On the format drop down, select &#8220;Fixed width.&#8221;</p>
<div id="attachment_297" class="wp-caption alignnone" style="width: 310px"><a href="http://ctrlshiftb.wordpress.com/files/2009/11/capture-20091127171531.jpg"><img class="size-medium wp-image-297" title="Data Destination" src="http://ctrlshiftb.wordpress.com/files/2009/11/capture-20091127171531.jpg?w=300" alt="Data Destination" width="300" height="269" /></a><p class="wp-caption-text">Data Destination</p></div>
<p>Please ignore the &#8220;Column&#8221; sub-menu on the right for now. Select &#8220;Advanced&#8221; from the sub-menu on the right. Now we will create all of our columns. For this tutorial I created a mail merge type export using First Name, Last Name, Address, City, State and Zip. Add one column to handle the line feed/carriage return. Without this column the package output will concatenated into on one row.</p>
<div id="attachment_298" class="wp-caption alignnone" style="width: 310px"><a href="http://ctrlshiftb.wordpress.com/files/2009/11/capture-20091127171543.jpg"><img class="size-medium wp-image-298" title="Data Destination Columns" src="http://ctrlshiftb.wordpress.com/files/2009/11/capture-20091127171543.jpg?w=300" alt="Data Destination Columns" width="300" height="269" /></a><p class="wp-caption-text">Data Destination Columns</p></div>
<p>On the Control Flow tab of the SSIS Package, add a data flow task. After adding the task, select the Data Flow tab. Add an OLE DB Source. On the OLE DB Connection Manager, the database connection we created earlier should already be selected. If it is not, select the connection we created at the beginning of the tutorial. The T-SQL used to select the data is below. Please note that there is no data formatting in the T-SQL, only the inclusion the column to handle the line feed/carriage return.</p>
<p>ANSI decimal character 10 is line feed, CHAR(10) in T-SQL, and ANSI decimal character 13 is a carriage return, CHAR(13) in T-SQL. Sometimes these characters are used in conjunction, depending on the format, but for our purposes we must use only one or the other.</p>
<pre class="brush: sql;">
SELECT
    pc.LastName,
    pc.FirstName,
    pa.AddressLine1,
    pa.City,
    psp.StateProvinceCode,
    pa.PostalCode,
    CHAR(10) CRLF
FROM
    Person.Contact pc
INNER JOIN HumanResources.Employee hre
    ON pc.ContactID = hre.ContactID
INNER JOIN HumanResources.EmployeeAddress hrea
    ON hre.EmployeeID = hrea.EmployeeID
INNER JOIN Person.Address pa
    ON hrea.AddressID = pa.AddressID
INNER JOIN Person.StateProvince psp
    ON pa.StateProvinceID = psp.StateProvinceID
WHERE
    psp.CountryRegionCode = 'US' ;
</pre>
<div id="attachment_299" class="wp-caption alignnone" style="width: 310px"><a href="http://ctrlshiftb.wordpress.com/files/2009/11/capture-20091127171555.jpg"><img class="size-medium wp-image-299" title="Data Source" src="http://ctrlshiftb.wordpress.com/files/2009/11/capture-20091127171555.jpg?w=300" alt="Data Source" width="300" height="258" /></a><p class="wp-caption-text">Data Source</p></div>
<p>One of the issues that you will face with any fixed width export are columns whose width is greater than the fixed width destination. We are going to handle this with a Data Conversion task. Be sure to give the converted column a friendly name, other than &#8220;Copy of &#8221; and the column and set the length of the converted field to the same length of the destination fixed width column.</p>
<div id="attachment_300" class="wp-caption alignnone" style="width: 310px"><a href="http://ctrlshiftb.wordpress.com/files/2009/11/capture-20091127171606.jpg"><img class="size-medium wp-image-300" title="Data Conversion" src="http://ctrlshiftb.wordpress.com/files/2009/11/capture-20091127171606.jpg?w=300" alt="Data Conversion" width="300" height="258" /></a><p class="wp-caption-text">Data Conversion</p></div>
<p>To make sure that the package succeeds if the width of the origin column is greater than the destination column, we will set the conversion to ignore all truncation errors. For these purposes it is important not to confuse width and length. A column with a data type of nchar(4) has a width of 4 but may have a length of 0 to 4. The data length may be less than or equal to destination, but if the width is greater it may prove problematic.</p>
<div id="attachment_301" class="wp-caption alignnone" style="width: 310px"><a href="http://ctrlshiftb.wordpress.com/files/2009/11/capture-20091127171612.jpg"><img class="size-medium wp-image-301" title="Error Handling" src="http://ctrlshiftb.wordpress.com/files/2009/11/capture-20091127171612.jpg?w=300" alt="Error Handling" width="300" height="244" /></a><p class="wp-caption-text">Error Handling</p></div>
<p>After adding the data conversions and error handling, let&#8217;s map the converted columns to our flat file destination columns.</p>
<div id="attachment_302" class="wp-caption alignnone" style="width: 310px"><a href="http://ctrlshiftb.wordpress.com/files/2009/11/capture-20091127171627.jpg"><img class="size-medium wp-image-302" title="Flat File Mapping" src="http://ctrlshiftb.wordpress.com/files/2009/11/capture-20091127171627.jpg?w=300" alt="Flat File Mapping" width="300" height="258" /></a><p class="wp-caption-text">Flat File Mapping</p></div>
<p>That&#8217;s it. Run the package and you will see the fruits of your labor.<br />
<strong>~Ron</strong></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Soporte de failover clustering de SQLServer sobre virtualización con Hyper-V]]></title>
<link>http://margotu.wordpress.com/2009/11/27/soporte-de-failover-clustering-de-sql-server-sobre-virtualizacion-con-hyper-v/</link>
<pubDate>Fri, 27 Nov 2009 08:08:01 +0000</pubDate>
<dc:creator>Javier Aparicio</dc:creator>
<guid>http://margotu.wordpress.com/2009/11/27/soporte-de-failover-clustering-de-sql-server-sobre-virtualizacion-con-hyper-v/</guid>
<description><![CDATA[Ya está disponible el soporte de las arquitecturas de fileover cluster de SQL Server en un entorno d]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Ya está disponible el soporte de las arquitecturas de fileover cluster de SQL Server en un entorno de virtualización. Esto significa que ahora existe soporte cuando se crea los nodos del clúster de SQL Server corriendo como máquinas virtuales.</p>
<p><!--more--></p>
<p>De esta manera se puede lograr alta disponibilidad del SQL Server cuando se ejecuta en un entorno virtualizado con los beneficios de ambos, la virtualización y la alta disponibilidad del fileover cluster.</p>
<p>El cluster esta soportado para SQL Server 2005 y SQL Server 2008 en una máquina virtual Windows Server 2008 con Hyper-V, Microsoft Hyper-V Server 2008 y configuraciones certificadas por el Server Virtualization Validation Program (SVVP) siempre se cumplen los siguientes requisitos:</p>
<p>El sistema operativo corriendo en la máquina virtual es Windows Server 2008 o superior</p>
<p>El entorno de virtualización cumple con los requisitos tal como se documenta en “La Política de soporte técnico de Microsoft para Windows Server 2008 Failover Clusters”.</p>
<p>Mas detalles en:</p>
<p><a title="Support policy for Microsoft SQL Server products that are running in a hardware virtualization environment" rel="nofollow" href="http://support.microsoft.com/?id=956893" target="_blank">Support policy for Microsoft SQL Server products that are running in a hardware virtualization environment</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Roles y responsabilidades en SQL Azure]]></title>
<link>http://todosobresqlserver.wordpress.com/2009/11/26/roles-y-responsabilidades-en-sql-azure/</link>
<pubDate>Thu, 26 Nov 2009 22:01:04 +0000</pubDate>
<dc:creator>ecastrom</dc:creator>
<guid>http://todosobresqlserver.wordpress.com/2009/11/26/roles-y-responsabilidades-en-sql-azure/</guid>
<description><![CDATA[En la siguiente presentación analizamos los roles y responsabilidades en la administración de una in]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>En la siguiente presentación analizamos los roles y responsabilidades en la administración de una infraestructura con SQL Azure.</p>
<p>&#160;</p>
<div style="text-align:left;width:425px;" id="__ss_2592801"><a style="display:block;font:14px helvetica,arial,sans-serif;text-decoration:underline;margin:12px 0 3px;" title="Roles y Responsabilidades en SQL Azure" href="http://www.slideshare.net/ecastrom/roles-y-responsabilidades-en-sql-azure">Roles y Responsabilidades en SQL Azure</a>
<div style="font-family:tahoma,arial;height:26px;font-size:11px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/ecastrom">Eduardo Castro</a>.</div>
</p></div>
<p>Saludos, </p>
<p>Eduardo Castro Martinez – Microsoft SQL Server MVP </p>
<p><a href="http://mswindowscr.org">http://mswindowscr.org</a></p>
<p><a href="http://comunidadwindows.org">http://comunidadwindows.org</a></p>
<p>Costa Rica </p>
<p>Technorati Tags: <a href="http://technorati.com/tags/SQL+Server">SQL Server</a></p>
<p>LiveJournal Tags: <a href="http://www.livejournal.com/interests.bml?int=SQL+Server">SQL Server</a></p>
<p>del.icio.us Tags: <a href="http://del.icio.us/popular/SQL+Server">SQL Server</a></p>
<p><a href="http://ecastrom.blogspot.com">http://ecastrom.blogspot.com</a></p>
<p><a href="http://ecastrom.wordpress.com">http://ecastrom.wordpress.com</a></p>
<p><a href="http://ecastrom.spaces.live.com">http://ecastrom.spaces.live.com</a></p>
<p><a href="http://universosql.blogspot.com">http://universosql.blogspot.com</a></p>
<p><a href="http://todosobresql.blogspot.com">http://todosobresql.blogspot.com</a></p>
<p><a href="http://todosobresqlserver.wordpress.com">http://todosobresqlserver.wordpress.com</a></p>
<p><a href="http://mswindowscr.org/blogs/sql/default.aspx">http://mswindowscr.org/blogs/sql/default.aspx</a></p>
<p><a href="http://citicr.org/blogs/noticias/default.aspx">http://citicr.org/blogs/noticias/default.aspx</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Webcast Microsoft: Auditoria de Dados no SQL Server 2008]]></title>
<link>http://microsoftsqlserver.wordpress.com/2009/11/26/webcast-microsoft-auditoria-de-dados-no-sql-server-2008/</link>
<pubDate>Thu, 26 Nov 2009 12:51:45 +0000</pubDate>
<dc:creator>dbaoracleinfnet</dc:creator>
<guid>http://microsoftsqlserver.wordpress.com/2009/11/26/webcast-microsoft-auditoria-de-dados-no-sql-server-2008/</guid>
<description><![CDATA[No dia 15 de Dezembro a Microsoft estará realizando o Webcast sobre Auditoria de Dados no SQL Server]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>No dia 15 de Dezembro a Microsoft estará realizando o Webcast sobre Auditoria de Dados no <strong>SQL Server 2008</strong>.</p>
<p>É um Webcast em português voltado para o público de <strong>TI </strong>com uma duração aproximada de 60 minutos onde será abordada a nova funcionalidade  para auditoria de dados no <strong>SQL Server 2008</strong>, o <strong>Data Auditing</strong>.</p>
<p>O palestrante será o Alexandre Lopes que atua como Database Specialist implementando soluções na plataforma Microsoft SQL Server. Possui sólida experiência na área de TI sendo certificado Microsoft com os títulos MCITP, MCTS, MCDBA, MCSE e MCT.</p>
<p>Horário: 20 horas</p>
<p>Link de Inscrição: <a href="https://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032435885&#38;EventCategory=4&#38;culture=pt-BR&#38;CountryCode=BR">https://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032435885&#38;EventCategory=4&#38;culture=pt-BR&#38;CountryCode=BR</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[SSIS Deployment Utility]]></title>
<link>http://businessintelligence101.wordpress.com/2009/11/20/ssis-deployment-utility/</link>
<pubDate>Fri, 20 Nov 2009 22:02:01 +0000</pubDate>
<dc:creator>Satheesh Kumar</dc:creator>
<guid>http://businessintelligence101.wordpress.com/2009/11/20/ssis-deployment-utility/</guid>
<description><![CDATA[Just created an utility SSIS Solution to export all the SSIS packages from SQL Server Integration Se]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Just created an utility SSIS Solution to export all the SSIS packages from SQL Server Integration Services msdb to file based location and to import all the file based packages to msdb.</p>
<ul>
<li>It can be used to port packages from one server to another.</li>
<li>It includes the packages organized in folder structures.</li>
</ul>
<p>Is Microsoft coming up with its own utility to deploy multiple packages? Anything available on Microsoft SQL Server 2008?</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[SQL Academic Day]]></title>
<link>http://sql4all.wordpress.com/2009/11/21/sql-academic-day/</link>
<pubDate>Fri, 20 Nov 2009 22:01:28 +0000</pubDate>
<dc:creator>Michał Pośnik</dc:creator>
<guid>http://sql4all.wordpress.com/2009/11/21/sql-academic-day/</guid>
<description><![CDATA[Niedługo, bo już 10.12.2009, odbędzie się SQL Academic Day! Będzie to szereg wykładów przeprowadzony]]></description>
<content:encoded><![CDATA[Niedługo, bo już 10.12.2009, odbędzie się SQL Academic Day! Będzie to szereg wykładów przeprowadzony]]></content:encoded>
</item>
<item>
<title><![CDATA[41. Spotkanie PLSSUG Warszawa]]></title>
<link>http://sql4all.wordpress.com/2009/11/20/41-spotkanie-plssug-warszawa/</link>
<pubDate>Fri, 20 Nov 2009 21:47:25 +0000</pubDate>
<dc:creator>Michał Pośnik</dc:creator>
<guid>http://sql4all.wordpress.com/2009/11/20/41-spotkanie-plssug-warszawa/</guid>
<description><![CDATA[A więc tak jak już wspominałem wcześniej, za dwa tygodnie (3.12.2009) odbędzie się kolejne spotkanie]]></description>
<content:encoded><![CDATA[A więc tak jak już wspominałem wcześniej, za dwa tygodnie (3.12.2009) odbędzie się kolejne spotkanie]]></content:encoded>
</item>
<item>
<title><![CDATA[Introducing Microsoft PowerPivot]]></title>
<link>http://arcanecode.com/2009/11/20/introducing-microsoft-powerpivot/</link>
<pubDate>Fri, 20 Nov 2009 18:27:44 +0000</pubDate>
<dc:creator>arcanecode</dc:creator>
<guid>http://arcanecode.com/2009/11/20/introducing-microsoft-powerpivot/</guid>
<description><![CDATA[What is PowerPivot? Well according to Microsoft: “PowerPivot is Microsoft Self-Service Business Inte]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>What is PowerPivot? Well according to Microsoft:</p>
<p><i><font size="4">“PowerPivot is Microsoft Self-Service Business Intelligence”</font></i></p>
<p>I can see from the glazed looks you are giving your monitor that was clear as mud. So let’s step back a bit and first define what exactly is <i>Business Intelligence</i>.</p>
<p><b>Business Intelligence</b></p>
<p>Business Intelligence, often referred to as simply “BI”, is all about taking data you already have and making sense of it. Being able to take that information and turn it from a raw jumble of individual facts and transform it into knowledge that you can take informed actions on. </p>
<p>In every organization there is already someone who is doing BI, although they may not realize it. Microsoft (and many IT departments) refer to this person as “<i>that guy</i>”. A power user, who grabs data from anyplace he (or she) can get it, then uses tools like Excel or Access to slice it, dice it, and analyze it. This person might be an actual Business Analyst, but more often it’s someone for who BI is not their main job. Some common examples of people doing their own BI today are production managers, accountants, engineers, or sales managers, all who need information to better do their job. Let’s look at an illustration that will make it a bit clearer.</p>
<p>In this example, put yourself in the role of a sales manager. You have gotten IT to extract all of your sales orders for the last several years into an Excel spreadsheet. In order to determine how well your sales people are doing, you need to measure their performance. You’ve decided that the amount sold will be a good measure, and use Excel to give you totals. </p>
<p><a href="http://arcanecode.files.wordpress.com/2009/11/introex01.jpg"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="IntroEx01" border="0" alt="IntroEx01" src="http://arcanecode.files.wordpress.com/2009/11/introex01_thumb.jpg?w=284&#038;h=104" width="284" height="104" /></a> </p>
<p>In BI terms, the column “Total Sales” is known as a <i>measure</i>, or sometimes a <i>fact</i>, as it measures something, in this case the sales amount. The grand total sales amount is often called an <i>aggregation</i>, as it totals up the individual rows of data that IT gave us. But now you might be wondering why Andy’s sales are so low? Well, now you want to dig deeper and look at sales by year. </p>
<p><a href="http://arcanecode.files.wordpress.com/2009/11/introex02.jpg"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="IntroEx02" border="0" alt="IntroEx02" src="http://arcanecode.files.wordpress.com/2009/11/introex02_thumb.jpg?w=419&#038;h=106" width="419" height="106" /></a> </p>
<p>In BI terms, the names of the sales people are a <i>dimension</i>. Dimensions are often either a “who” (who sold stuff) or a “what” (what stuff did we sell). Places (where was it sold) and dates (when was it sold) are also common dimensions. In this case the sales dates across the top (2007, 2008, 2009) are a date dimension. When we use two or more dimensions to look at our measures, we have a <i>pivot table</i>. </p>
<p>Now we can see a picture emerging. It’s obvious that Andy must have been hired as a new salesperson in late 2008, since he shows no sales for 2007 and very small amount in 2008. But for Paul and Kimberly we can look at something called <i>trends</i> in the BI world. Kimberly shows a nice even trend, rising slowly over the last three years and earns a gold star as our top performer. </p>
<p>By being able to drill down into our data, we spot another trend that was not readily obvious when just looking at the grand totals. Paul has been trending downward so fast the speed of light looks slow. Clearly then we now have information to take action on, commonly known as <i>actionable intelligence</i>.</p>
<p><b>So remind me, why do we need PowerPivot?</b></p>
<p>As you can see in the above example, “that guy” in your company clearly has a need to look at this data in order to do his job. Not only does he need to review it, he also has the issue of how to share this information with his co-workers. Unfortunately in the past the tools available to “that guy” have had some drawbacks. The two main tools used by our analyst have been either Excel, or a complete BI solution involving a data warehouse and SQL Server Analysis Services.</p>
<p>Excel’s main limitations center around the volume of data needed to do good analysis. Excel has limits to the number of rows it can store, and for large datasets a spreadsheet can consume equally large amounts of disk space. This makes the spreadsheet difficult to share with coworkers. In addition mathematical functions like aggregations could be slow. On the good side, Excel is readily available to most workers, and a solution can be put together fairly quickly. </p>
<p>A full blown BI solution has some major benefits over the Excel solution. A data warehouse is created, and then SQL Server Analysis Services (often abbreviated as SSAS) is used to precalculate aggregations for every possible way an analyst might wish to look at them. The data is then very easy to share via tools like Excel and SQL Server Reporting Services. While very robust and powerful solution, it does have some drawbacks. It can take quite a bit of time to design, code, and implement both the data warehouse and the analysis services pieces of the solution. In addition it can also be expensive for IT to implement such a system.</p>
<p><b>Faster than a speeding bullet, more powerful than a locomotive, it’s PowerPivot!</b></p>
<p>PowerPivot combines the best of both worlds. In fact, it’s not one tool but two: PowerPivot for Microsoft Excel 2010, and PowerPivot for SharePoint 2010. What’s the difference you ask? Good question. </p>
<p><b>PowerPivot for Microsoft Excel 2010</b></p>
<p>PowerPivot acts as an Add-on for Excel 2010, and in many ways is quite revolutionary. First, it brings the full power of SQL Server Analysis Services right into Excel. All of the speed and power of SSAS is available right on your desktop. Second, it uses a compression technology that allows vast amounts of data to be saved in a minimal amount of space. Millions of rows of data can now be stored, sorted, and aggregated in a reasonable amount of disk space with great speed. </p>
<p>PowerPivot can draw its data from a wide variety of sources. As you might expect, it can pull from almost any database. Additionally it can draw data from news feeds, SQL Server Reporting Services, other Excel sheets, it can even be typed in manually if need be. </p>
<p>Another issue that often faces the business analyst is the freshness of the data. The information is only as good as the date it was last imported into Excel. Traditionally “that guy” only got extracts of the database as IT had time, since it was often a time consuming process. PowerPivot addresses this through its <i>linked tables</i> feature. PowerPivot will remember where your data came from, and with one simple button click can refresh the spreadsheet with the latest information.</p>
<p>Because PowerPivot sits inside Microsoft Excel, it not only can create basic pivot tables but has all the full featured functionality of Excel at its disposal. It can format pivot tables in a wide array of styles, create pivot charts and graphs, and combine these together into useful dashboards. Additionally PowerPivot has a rich set of mathematical functionally, combining the existing functions already in Excel with an additional set of functions called Data Analysis eXpressions or DAX. </p>
<p><b>PowerPivot for SharePoint 2010</b></p>
<p>PowerPivot for Excel 2010 clearly solves several issues around the issue of analysis. It allows users to quickly create spreadsheets, pivot tables, charts, and more in a compact amount of space. If you recall though, creation was only half of “that guys” problem. The other half was sharing his analysis with the rest of his organization. That’s where PowerPivot for SharePoint 2010 comes into play.</p>
<p>Placing a PowerPivot Excel workbook in SharePoint 2010 not only enables traditional file sharing, but also activates several additional features. First, the spreadsheet is hosted right in the web browser. Thus users who might not have made the transition to Excel 2010 can still use the PowerPivot created workbook, slicing and filtering the data to get the information they require. </p>
<p>Data can also be refreshed on an automated, scheduled basis. This ensures the data is always up to date when doing analysis. Dashboards can also be created from the contents of a worksheet and displayed in SharePoint. Finally these PowerPivot created worksheets can be used as data sources for such tools as SQL Server Reporting Services. </p>
<p><b>Limitations</b></p>
<p>First, let me preface this by saying as of this writing all of the components are either in CTP (Community Technology Preview, a pre-beta) or Beta state. Thus there could be some changes between now and their final release next year. </p>
<p>To use the PowerPivot for Excel 2010 components, all you have to have is Excel 2010 and the PowerPivot add-in. If you want to share the workbook and get all the rich functionality SharePoint has to offer, you’ll have to have SharePoint 2010, running Excel Services and PowerPivot 2010 Services. You’ll also have to have SQL Server 2008 R2 Analysis Services running on the SharePoint 2010 box. Since you’ll have to have a SQL Server instance installed to support SharePoint this is not a huge limitation, especially since SSAS comes with SQL Server at no extra cost. </p>
<p>One thing I wish to make clear, SharePoint 2010 itself can run using any version of SQL Server from SQL Server 2005 on. It is the PowerPivot service that requires 2008 R2 Analysis Services. </p>
<p>One other important item to note: at some point the load upon the SharePoint 2010 server may grow too large if especially complex analysis is being done. Fortunately SharePoint 2010 ships with several tools that allow administrators to monitor the load and plan accordingly. At the point where the load is too big, it is a clear indication it’s time to transition from a PowerPivot solution to a full BI solution using a data warehouse and SQL Server Analysis Services. </p>
<p><b>What does PowerPivot mean for business users?</b></p>
<p>For business users, and especially “that guy”, it means complex analysis tools can be created in a short amount of time. Rich functionality makes it easier to spot trends and produce meaningful charts and graphs. It also means this information can be shared with others in the organization easily, without imposing large burdens on the corporate e-mail system or local file sharing mechanisms. </p>
<p>No longer will users be dependent on IT for their analysis, they will have the power to create everything they need on their own, truly bringing “self service BI” to fruition.</p>
<p><b>What does PowerPivot mean for Business Intelligence IT Pros?</b></p>
<p>The first reaction many BI developers have when hearing about PowerPivot is “oh no, this is going to put me out of a job!” Far from it, I firmly believe PowerPivot will create even more work for BI Professionals like myself. </p>
<p>As upper management grows to rely on the information provided by PowerPivot, they will also begin to understand the true value BI can bring to an organization. Selling a new BI solution into an organization where none currently exists can be difficult, as it can be hard to visualize how such a solution would work and the value it brings. PowerPivot allows BI functionality to be brought into an organization at a low development cost, proving the value of BI with minimal investment. Thus when there is a need to implement a larger, traditional BI project those same managers will be more forthcoming with the dollars.</p>
<p>Second, as users pull more and more data, they are going to want that data better organized than they will find in their current transactional business systems. This will in turn spur the need to create many new data warehouses. Likewise the IT department will also want data warehouses created, to reduce the load placed on those same transactional business systems. </p>
<p>I also foresee PowerPivot being used by BI Pros themselves to create solutions. The database structure of many transactional database systems can be difficult to understand even for experienced IT people, much less users. BI Pros can use PowerPivot to add a layer of abstraction between the database and the users, allowing business analysts to do their job without having to learn the complexity of a database system.</p>
<p>BI Pros can also use PowerPivot to implement quick turnaround solutions for customers, bringing more value for the customer’s dollar. When a BI Pro can prove him (or her) self by providing rich functionality in a short time frame it’s almost always the case they are brought back in for multiple engagements. </p>
<p>PowerPivot also provides great value to BI Pros who are employed full time in an enterprise organization. They can create solutions much quicker than before, freeing them up to do other valuable tasks. In addition PowerPivot solutions can provide a “stop gap” solution, pushing the date at which the organization needs to spend the dollars for a full blown BI solution and allowing IT to plan better. </p>
<p>Finally I see great value in PowerPivot as a prototyping tool for larger BI projects. Now users can see their data, interact with it, analyze it, and ensure the required measures and dimensions are present before proceeding with the larger project. </p>
<p>I’ll reiterate, if anything I believe PowerPivot will create an explosion of work for the Business Intelligence Professional.</p>
<p><b>Where can I learn more?</b></p>
<p>Well right here for one. I have become quite interested in PowerPivot since seeing it at the SQL PASS 2009 Summit. I think it will be a valuable tool for both myself and my customers. This will be the first of many blog posts to come on PowerPivot. I am also beginning a series of presentations on PowerPivot for local user groups and code camp events. The first will be Saturday, November 21<sup>st</sup> 2009 at the <a href="http://www.sharepointsaturday.org/birmingham/default.aspx">SharePoint Saturday in Birmingham Alabama</a>, but there will be many more to come. (If you’d like me to come speak at your group just shoot me an <a href="mailto:arcanecode@gmail.com?subject=PowerPivot%20Presentation">e-mail</a> and we’ll see what we can arrange.)</p>
<p>There’s also the PowerPivot site itself:</p>
<ul>
<li><a href="http://powerpivot.com/">http://powerpivot.com/</a></li>
</ul>
<p>I’ve also found a small handful of blogs on PowerPivot, listed in no particular order:</p>
<ul>
<li><a href="http://powerpivotpro.com/">http://powerpivotpro.com/</a></li>
<li><a href="http://powerpivotgeek.com/">http://powerpivotgeek.com/</a></li>
<li><a href="http://powerpivottwins.com/">http://powerpivottwins.com/</a></li>
<li><a href="http://powerpivot-info.com/">http://powerpivot-info.com/</a></li>
</ul>
<p><b>Summary</b></p>
<p>Thanks for sticking with me, I know this was a rather long blog post but PowerPivot has a lot of rich functionality to offer. While PowerPivot is still in the CTP/Beta stage as of this writing, I see more and more interest in the community, which will continue to grow as PowerPivot moves closer to release. I hope this post has set you off on the right step and you’ll continue to come back for more information. </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Langkah-langkah Instalasi SQL Server 2008 Enterprise]]></title>
<link>http://azerdark.wordpress.com/2009/11/21/langkah-langkah-instalasi-sql-server-2008-enterprise/</link>
<pubDate>Fri, 20 Nov 2009 17:40:42 +0000</pubDate>
<dc:creator>azer89</dc:creator>
<guid>http://azerdark.wordpress.com/2009/11/21/langkah-langkah-instalasi-sql-server-2008-enterprise/</guid>
<description><![CDATA[Berikut ini file tutorial instalasi SQL Server 2008 Enterprise yang saya buat dalam bentuk file *.do]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://azerdark.wordpress.com/files/2009/11/sql_server_2008_logo.png"><img class="aligncenter size-medium wp-image-973" title="sql_server_2008_logo" src="http://azerdark.wordpress.com/files/2009/11/sql_server_2008_logo.png?w=300" alt="" width="244" height="152" /></a></p>
<p style="text-align:center;">Berikut ini file tutorial instalasi SQL Server 2008 Enterprise yang saya buat dalam bentuk file *.doc :</p>
<p style="text-align:center;">
<p style="text-align:center;"><a href="http://www.2shared.com/file/9302131/cf05c9b3/sql_server_2008_installation.html">&#60; DONWLOAD TUTORIAL &#62;</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[SQL Server 2008 Experience]]></title>
<link>http://microsoftsqlserver.wordpress.com/2009/11/19/sql-server-2008-experience/</link>
<pubDate>Thu, 19 Nov 2009 12:38:46 +0000</pubDate>
<dc:creator>dbaoracleinfnet</dc:creator>
<guid>http://microsoftsqlserver.wordpress.com/2009/11/19/sql-server-2008-experience/</guid>
<description><![CDATA[O SQL Server 2008 Experience é um site da Microsoft voltada para profissionais de TI e desenvolvedor]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>O <strong>SQL Server 2008</strong> Experience é um site da <strong>Microsoft </strong>voltada para profissionais de <strong>TI </strong>e desenvolvedores que contém uma série de entrevistas curtas e esclarecedoras com a equipe de Engenharia do <strong>SQL Server</strong> discutindo as diversas tecnologias do <strong>SQL Server 2008</strong>.</p>
<p>No site você poderá ver vídeos mostrando como as empresas estão utilizando as diversas tecnologias do <strong>SQL Server 2008</strong> para lidar com grandes desafios.</p>
<p>Além da parte informativa do site, você pode conferir também vídeos engraçados e divertidos do mercado de <strong>TI</strong> disponibilizados pela <strong>Microsoft</strong>.</p>
<p>O link para o site é: <a href="http://www.microsoft.com/sql/experience/?loc=pt" target="_blank">http://www.microsoft.com/sql/experience/?loc=pt</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Database diagram support cannot be installed because this database does not have a valid owner. Solucionado]]></title>
<link>http://esquinadotnet.wordpress.com/2009/11/18/database-diagram-support-cannot-be-installed-because-this-database-does-not-have-a-valid-owner-solucionado/</link>
<pubDate>Wed, 18 Nov 2009 19:15:25 +0000</pubDate>
<dc:creator>esquinadotnet</dc:creator>
<guid>http://esquinadotnet.wordpress.com/2009/11/18/database-diagram-support-cannot-be-installed-because-this-database-does-not-have-a-valid-owner-solucionado/</guid>
<description><![CDATA[Este error se presento al querer mostrar los diagramas de SQL Server, al principio crei que se debia]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Este error se presento al querer mostrar los diagramas de SQL Server, al principio crei que se debia a un error de configuración en el cliente del SQL Server Management Studio, sin embargo el error que mencionaba era el siguiente.</p>
<blockquote><p>Database diagram support cannot be installed because this database does not have a valid owner.<br />
To continue, first use the Files page of the Database Properties dialog box or ALTER AUTORIZATION statement to set the database owner to a valid login, then add the database diagram suppoert objects.</p></blockquote>
<p>Como se menciona en el mensaje habra que establecer un usuario válido como dueño de la Base de Datos, en mi caso tenia el de <em>NombreMaquina</em>\<em>Administrator</em>. asi que se lo cambie al usuario <em>sa</em></p>
<pre class="brush: sql;">ALTER AUTORIZATION ON DATABASE::dbname TO sa</pre>
<p>O bien desde la interfase gráfica del SQL Server Management Studio.</p>
<p>Si esto no funciona prueba, <strong><a title="Tim Huffam - GeeksWithBlogs" href="http://geekswithblogs.net/TimH/archive/2006/07/05/84171.aspx" target="_blank">esta otra solución</a></strong> o revisen <strong><a title="sql-server-performance.com" href="http://sql-server-performance.com/Community/forums/t/283.aspx" target="_blank">este hilo</a></strong>.</p>
<p>Saludos.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Backup programado en Sql Server 2008 Express]]></title>
<link>http://margotu.wordpress.com/2009/11/18/backup-programado-en-sql-server-2008-express/</link>
<pubDate>Wed, 18 Nov 2009 10:42:42 +0000</pubDate>
<dc:creator>Javier Aparicio</dc:creator>
<guid>http://margotu.wordpress.com/2009/11/18/backup-programado-en-sql-server-2008-express/</guid>
<description><![CDATA[Como muchos ya os habréis dado cuenta, la versión Sql Server Express 2008 no incluye el agente de ta]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Como muchos ya os habréis dado cuenta, la versión Sql Server Express 2008 no incluye el agente de tareas. ¿Y para que sirve el agente de tareas? os preguntareis otros. Pues bien el agente de tareas es el que se encarga de llevar a cabo todas las tareas relacionadas con el mantenimiento de la base de datos ya sea realizar copias de seguridad programadas (diarias, semanales, mensuales…), realizar una programación para limpiar registros, indexar la base de datos, etc…</p>
<p><!--more--></p>
<p>&#160;</p>
<p>&#160;</p>
<div id="attachment_129"><a href="http://aworenow.files.wordpress.com/2009/08/backup1.gif"><img title="backup" src="http://aworenow.files.wordpress.com/2009/08/backup1.gif?w=300&#038;h=185#38;h=185" alt="backup" width="300" height="185" /></a> Backup
<p>&#160;</p>
</div>
<p>En nuestro caso lo que buscamos de manera más urgente es poder realizar copias de seguridad programadas para evitar accidentes como la pérdida de información o borrado accidental o no de la base de datos. Siempre que trabajemos con una base de datos hay que tener un respaldo por si acaso el ordenador falla y hubiera que restaurarla en otro pc o para poder evitar cualquier pérdida accidental de los datos.</p>
<p>&#160;</p>
<p>Para realizar este ejercicio, es necesario un conocimiento previo del lenguaje SQL. Por ello vamos a ver previamente como se realizaría una copia de seguridad completa normal de una base de datos a una ruta concreta:</p>
<p>&#160;</p>
<p>BACKUP DATABASE nombredelabasededatos<br />
TO DISK = ‘C:\nombredelabasededatos.bak’<br />
WITH FORMAT;</p>
<p>&#160;</p>
<p>El funcionamiento es realizar la copia de seguridad con el nombre de la base de datos que queremos respaldar e indicar la ruta en la que queremos que se guarde la copia de seguridad (por ejemplo en c:\). Lo que se encuentra en letra naranja es lo que tendremos que cambiar para indicar el nombre de la base de datos a respaldar y el nombre de la copia de seguridad.</p>
<p>&#160;</p>
<p>Una vez tenemos claro el funcionamiento de la copia de seguridad, vamos a darle una fecha antes del nombre para poder crear una copia cada día y poder distinguirlas en formato año/mes/día:</p>
<p>&#160;</p>
<p>declare @ruta as nvarchar (50);<br />
declare @fecha as nvarchar (50);<br />
set @fecha = CONVERT (nvarchar, CURRENT_TIMESTAMP , 112)<br />
set @ruta = ‘C:\’ + @fecha + ‘nombredelabasededatos.bak’<br />
BACKUP DATABASE nombredelabasededatos<br />
TO DISK = @ruta<br />
WITH FORMAT;</p>
<p>&#160;</p>
<p>Aquí lo que hemos hecho es declarar dos variables una con la ruta y otra con la fecha para que quede claro su uso de manera muy sencilla. Declaramos las variables como nvarchar, establecemos el valor con set que van a tener cada una, en el caso de la fecha hay que convertir el formato datetime que usa current_timestamp a nvarchar que es cadena y luego lo utilizaremos en ese formato para anteponerlo al nombre y así distinguir los diversos archivos de las copias de seguridad. Y en el caso de la variable ruta hemos indicado simplemente la ruta donde se va a guardar el archivo con su fecha y nombre correspondiente.</p>
<p>&#160;</p>
<p>Ahora vamos a crear un archivo .bat para ejecutar el código mediante la consola de comandos de windows conocida como CMD y así con el programador de tareas de windows poder programar la tarea.</p>
<p>&#160;</p>
<p>1- Creamos con el bloc de notas un archivo y lo llamamos “tarea.bat” (sin las comillas). Le damos botón derecho y editar.</p>
<p>&#160;</p>
<div id="attachment_130"><a href="http://aworenow.files.wordpress.com/2009/08/blocnotassql.jpg"><img title="blocnotassql" src="http://aworenow.files.wordpress.com/2009/08/blocnotassql.jpg?w=300&#038;h=90#38;h=90" alt="Editar .bat" width="300" height="90" /></a> Editar .bat
<p>&#160;</p>
</div>
<p>2- Una vez estemos en modo edición, insertamos el siguiente código:</p>
<p>&#160;</p>
<p>ECHO ejecutando tarea<br />
ECHO.<br />
pause<br />
osql -S “nombredelainstanciasql\sqlexpress” -E -Q “declare @ruta as nvarchar (50);declare @fecha as nvarchar (50);set @fecha = CONVERT(nvarchar, CURRENT_TIMESTAMP , 112)set @ruta = ‘C:\’ + @fecha + ‘nombredelabasededatos.bak’ BACKUP DATABASE nombredelabasededatos TO DISK = @ruta   WITH FORMAT;”<br />
ECHO tarea ejecutada<br />
pause<br />
CLS<br />
EXIT</p>
<p>&#160;</p>
<p>3- Cambiamos lo que está escrito en naranja por lo que corresponda a la información de nuestra instancia de Sql Server Express 2008 (suele ser el nombre del equipo /sqlexpress, a no ser que se haya cambiado en la instalación) y nombre de la base de datos a respaldar.</p>
<p>&#160;</p>
<p>4- Ejecutamos el archivo para comprobar que no hemos cometido ningún error de código.</p>
<p>&#160;</p>
<div id="attachment_131"><a href="http://aworenow.files.wordpress.com/2009/08/cmdsql.jpg"><img title="cmdsql" src="http://aworenow.files.wordpress.com/2009/08/cmdsql.jpg?w=300&#038;h=151#38;h=151" alt="Cmd" width="300" height="151" /></a> Cmd
<p>&#160;</p>
</div>
<p>5- Si nos aparece como en la imagen y nos crea la copia de seguridad con éxito tendreamos que hacer un cambio en el código para quitarle las pausas de comprobación y que lo haga directamente sin pulsar ninguna tecla. Si nos fijamos en la imagen hay unas flechas que nos indican lo que en el código significa pause. Así que volvemos al fichero y lo editamos borrando las pause, nos quedaría así:</p>
<p>&#160;</p>
<p>ECHO ejecutando tarea<br />
ECHO.<br />
osql -S “nombredelainstanciasql\sqlexpress” -E -Q “declare @ruta as nvarchar (50);declare @fecha as nvarchar (50);set @fecha = CONVERT(nvarchar, CURRENT_TIMESTAMP , 112)set @ruta = ‘C:\’ + @fecha + ‘nombredelabasededatos.bak’ BACKUP DATABASE nombredelabasededatos TO DISK = @ruta   WITH FORMAT;”<br />
ECHO tarea ejecutada<br />
CLS<br />
EXIT</p>
<p>&#160;</p>
<p>Ahora vamos como paso final a programar la tarea para que se ejecute a diario.</p>
<p>&#160;</p>
<p>1- Para ello entramos en Inicio – Programas – Accesorios – Herramientas del sistema y pulsamos click en Tareas programadas.</p>
<p>&#160;</p>
<div id="attachment_132"><a href="http://aworenow.files.wordpress.com/2009/08/rutatareas.jpg"><img title="rutatareas" src="http://aworenow.files.wordpress.com/2009/08/rutatareas.jpg?w=300&#038;h=103#38;h=103" alt="Tareas Programadas" width="300" height="103" /></a> Tareas Programadas
<p>&#160;</p>
</div>
<p><img src="http://aworenow.wordpress.com/DOCUME~1/Usuario/CONFIG~1/Temp/moz-screenshot.jpg" alt="" /></p>
<p>&#160;</p>
<p>2- Le damos a agregar una nueva tarea y cuando nos salga el asistente pulsamos siguiente. Seleccionamos en examinar el archivo tarea.bat que hemos creado y pulsamos siguiente de nuevo.</p>
<p>&#160;</p>
<p>3- Pulsamos en la siguiente pantalla a diario para que se ejecute todos los dias y le damos a siguiente.</p>
<p>&#160;</p>
<div id="attachment_133"><a href="http://aworenow.files.wordpress.com/2009/08/tareadiaria.jpg"><img title="tareadiaria" src="http://aworenow.files.wordpress.com/2009/08/tareadiaria.jpg?w=300&#038;h=206#38;h=206" alt="Programar tarea" width="300" height="206" /></a> Programar tarea
<p>&#160;</p>
</div>
<p>4- Ahora es el momento de seleccionar que hora y con que frecuencia así como cuando se debe iniciar la tarea. Pulsamos en siguiente una vez configurado y nos va a pedir un nombre de usuario del equipo y una contraseña del usuario, pulsamos siguiente y pulsamos finalizar.</p>
<p>&#160;</p>
<p>De este modo quedaría completado el capítulo de como crear una programación de un backup en Sql Server Express 2008.</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Sql Server , donde esta el log de errores]]></title>
<link>http://margotu.wordpress.com/2009/11/18/sql-server-donde-esta-el-log-de-errores/</link>
<pubDate>Wed, 18 Nov 2009 10:37:52 +0000</pubDate>
<dc:creator>Javier Aparicio</dc:creator>
<guid>http://margotu.wordpress.com/2009/11/18/sql-server-donde-esta-el-log-de-errores/</guid>
<description><![CDATA[Siempre es curioso encontrarse con funcionalidades no documentadas en SQL Server. Aunque uno no pued]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Siempre es curioso encontrarse con funcionalidades no documentadas en SQL Server. Aunque uno no pueda fiarse mucho de ellas (al no estar documentadas, el equipo de desarrollo podría cambiarlas o directamente eliminarlas sin tener que rendir cuentas a nadie), en alguna ocasión te puede sacar de un apuro.</p>
<p><!--more--></p>
<p>El caso es que hoy me he encontrado con una forma fácil de conocer la ruta del log de errores de nuestra instancia. Sí, igual alguno puede conocer la forma por la cual podemos obtener algo similar leyendo del registro, mediante el procedimiento almacenado extendido xp_instance_regread (el cual tampoco está documentado) y filtrando por la clave correcta. Algo como:</p>
<p>DECLARE @DirLog nvarchar(512)</p>
<p>EXEC master.dbo.xp_instance_regread N&#8217;HKEY_LOCAL_MACHINE&#8217; , N&#8217;SOFTWARE\Microsoft\MSSQLServer\CPE&#8217; , N&#8217;ErrorDumpDir&#8217; , @DirLog OUTPUT</p>
<p>PRINT @DirLog</p>
<p>Teniendo en cuenta que lo anterior nos muestra la ruta de la carpeta LOG de nuestra instancia, no habría mayor problema en usar este método si conocemos la clave del registro donde buscar. Lo cual en algunas ocasiones puede ser bastante complicado.</p>
<p>Sin embargo, con este nuevo método que he encontrado, simplemente ejecutando</p>
<p>SELECT SERVERPROPERTY(&#8216;ErrorLogFileName&#8217;)</p>
<p>Tenemos no sólo la ruta completa, sino también el nombre del archivo de log de nuestra instancia.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Backup Sql Server 2008 en dispositivos de red]]></title>
<link>http://margotu.wordpress.com/2009/11/18/backup-sql-server-2008-en-dispositivos-de-red/</link>
<pubDate>Wed, 18 Nov 2009 10:34:08 +0000</pubDate>
<dc:creator>Javier Aparicio</dc:creator>
<guid>http://margotu.wordpress.com/2009/11/18/backup-sql-server-2008-en-dispositivos-de-red/</guid>
<description><![CDATA[Los pasos son: Ejecutamos el siguiente script para asociar la dirección de red a un dispositivo que ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Los pasos son:</p>
<ol>
<li>Ejecutamos el siguiente script para asociar la dirección de red a un dispositivo que el servidor aceptara:<strong><em>EXEC sp_configure ’show advanced options’, 1</em></strong><br />
<strong><em>GO<br />
RECONFIGURE<br />
GO<br />
EXEC sp_configure ‘xp_cmdshell’, 1<br />
GO<br />
RECONFIGURE<br />
GO<br />
EXEC xp_cmdshell ‘net use H: \\DRIVE PASSWORD /user:USUARIO’<br />
<!--more--></em></strong></li>
<li>Configuramos el correo electronico (Management/Database Mail)</li>
<li>Creamos un operador (SQL Server Agent/Operators)</li>
<li>Creamos un plan de mantenimiento (Management/Maintenance Plans) para verificar la integridad de la base de datos, reorganizar los índices, actualizar las estadísticas, hacer backups incrementales y enviar un correo electrónico con el reporte todas las madrugadas.</li>
</ol>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Record of a PSS Call]]></title>
<link>http://scarydba.wordpress.com/2009/11/17/record-of-a-pss-call/</link>
<pubDate>Tue, 17 Nov 2009 12:36:34 +0000</pubDate>
<dc:creator>scarydba</dc:creator>
<guid>http://scarydba.wordpress.com/2009/11/17/record-of-a-pss-call/</guid>
<description><![CDATA[Not everyone has the opportunity to call Microsoft Premier Support. For those who have not yet had t]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Not everyone has the opportunity to call Microsoft Premier Support. For those who have not yet had this experience, I&#8217;ll document my most recent, non-critical, call. Critical calls are a different critter entirely.</p>
<p>We were experiencing a very odd error on one server in our system. When a particular procedure was run with a particularly large set of data, it would produce an error, but only when called from the application. The exact same error with exactly the same data called from SSMS did not produce an error. We went through a very extensive set of tests and were unable to fix the problem on the server. After moving the production system that was experiencing the issue to a different server, we decided to contact PSS.</p>
<p>8:48 Am, Tuesday: I made the initial call and went through the process of validating my identity, our company, etc. I had to explain everything that we had done, what versions of the software involved everything was, etc. This took 10 minutes. Since I had called early in the day and this was non-critical call, although labeled as important since we are talking about a production system, I had to wait for the MS guys to come in.</p>
<p>9:47 AM, Tuesday: I received an email from PSS asking me for the SQL Server logs. I zipped up the most recent log with the error and sent it in to the guy. This took me about five minutes to get everything together and zip it up for him.</p>
<p>10:53AM, Tuesday: I received my first phone call on the process. I re-explained the issue to the support person. they suggested that we set up a server-side trace and get the query to error out when run from the app, and to run successfully from Management Studio and see what differences there might be, if any, in the basic trace. It took me about 30 minutes to set up the server-side trace, test it, generate the errors and run the query successfully and then zip it all up with sample code and sample data to ship off to MS.</p>
<p>Does it feel like this is going to take a long time? You&#8217;re right. It continues.</p>
<p>12:10PM, Tuesday: I get an email back with some initial thoughts. Unfortunately, it looks like we don&#8217;t have complete information. I respond in the email, providing more.</p>
<p>12:26PM, Tuesday: Another email back from MS confused about the trace. They had me use the default trace, which captures RPC:Completed and SQL:BatchStarting and SQL:BatchCompleted. They claimed that the app wasn&#8217;t run and must have errored before calling the database. But that&#8217;s because the app errored which means no RPC:Completed. We didn&#8217;t capture RPC:Starting. I pointed this out in a response. Nothing back yet.</p>
<p>1:32PM, Tuesday: I get my response back, am I sending a new trace? Nuts. I knew when I realized what they were looking for that I should have restarted the trace. There&#8217;s an hour shot.</p>
<p>2:35PM, Tuesday: I&#8217;ve finished rebuilding our trace, retesting and sending everything off for evaluation, again. It took longer for me this time because I was waiting on a developer who was away from his desk. PSS calls require everyone to be available, all the time. When we do critical calls we just jam everyone into the same room. It makes it easier.</p>
<p>6:39PM, Tuesday: The data wasn&#8217;t sufficient. It doesn&#8217;t show when the error occurs. PSS sends me a new trace template to try out. Unfortunately, I&#8217;m not at work any more and what&#8217;s more, the developers who&#8217;s support I need are long gone. I can&#8217;t do anything with this until morning.</p>
<p>DAY 2</p>
<p>8:08AM, Wednesday:  I&#8217;m setting up the trace to see what they&#8217;re having me gather while I wait for the developers to show up. Odin&#8217;s all seeing eye! They&#8217;re capturing quite a few events here. Just about every single event in &#8220;Errors and Warnings.&#8221; OLEDB Errors. Auto Stats, Degree of Parallelism, Showplan All and Showplan XML Statistics Profile from &#8220;Performance.&#8221; Server Memory Change. PreConnect Completed and Preconnect:Starting from Sessions (I&#8217;ve never even seen these before). RPC:Completed, RPC:Starting, SP:Completed, SP:Recompile, SP:Starting, SP:StmtCompleted (I knew that one was coming),SP:StmtStarting from &#8220;Stored Procedures.&#8221; Finally SQL:BatchCompleted,  SQL:BatchStarting, SQL:StmtCompleted, SQL:StmtRecompile, SQLStmtStarting from &#8220;TSQL.&#8221; A full load. This should be fun.</p>
<p>I&#8217;m converting it to a script and adding a filter to only capture data from the database I&#8217;m having troubles with. I&#8217;m also converting to a script for another reason, which I&#8217;ll post a little blog post about seperate from this one.</p>
<p>11:11AM, Wednesday: The joys of developing software. The developer I was working with yesterday wasn&#8217;t in, so I got a different developer to help out. He didn&#8217;t know how to run the code the way the other guy ran it. So it was run in a different way. I captured everything and shipped it off to Microsoft. While waiting for their response, I read through the data gathered by the trace. No error. In fact, everything ran successfully. We did a bunch of tests and found that as long as we were running the big trace, we didn&#8217;t get the error. It was almost like the error was caused by having too many resources.</p>
<p>12:00PM, Wedensday: The PSS person comes back and says that the data contained no error. Yep. They don&#8217;t have a single suggestion. All the indications are, the faster, more powerful server, is causing the problem.</p>
<p>DAY 3</p>
<p>I get a response back from PSS. They&#8217;re asking if I&#8217;m suggesting that I&#8217;m supposed to run the trace all the time. This is the point where I decide to bail on PSS. I&#8217;m leaving the case in a non-closed state, but I&#8217;ve been talking to some other resources and have a troubleshooting scheme from those resources that we&#8217;re going to try out.</p>
<p>More when I know more.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[70-432 Instalacja i konfiguracja SQL Server 2008 #3 - SQL Server Browser]]></title>
<link>http://sql4all.wordpress.com/2009/11/14/70-432-instalacja-i-konfiguracja-sql-server-2008-3-sql-server-browser/</link>
<pubDate>Sat, 14 Nov 2009 01:15:27 +0000</pubDate>
<dc:creator>Michał Pośnik</dc:creator>
<guid>http://sql4all.wordpress.com/2009/11/14/70-432-instalacja-i-konfiguracja-sql-server-2008-3-sql-server-browser/</guid>
<description><![CDATA[No dobra, obiecałem SQL Server Browser, to może napiszę coś o tej usłudze O co chodzi? SQL Server Br]]></description>
<content:encoded><![CDATA[No dobra, obiecałem SQL Server Browser, to może napiszę coś o tej usłudze O co chodzi? SQL Server Br]]></content:encoded>
</item>
<item>
<title><![CDATA[70-432 Instalacja i konfiguracja SQL Server 2008 #2 - Configuration Manager]]></title>
<link>http://sql4all.wordpress.com/2009/11/13/70-432-instalacja-i-konfiguracja-sql-server-2008-2-configuration-manager/</link>
<pubDate>Fri, 13 Nov 2009 18:38:59 +0000</pubDate>
<dc:creator>Michał Pośnik</dc:creator>
<guid>http://sql4all.wordpress.com/2009/11/13/70-432-instalacja-i-konfiguracja-sql-server-2008-2-configuration-manager/</guid>
<description><![CDATA[W poście dotyczącym instalacji SQL Server 2008 wspomniałem o Configuration Manager oraz SQL Server B]]></description>
<content:encoded><![CDATA[W poście dotyczącym instalacji SQL Server 2008 wspomniałem o Configuration Manager oraz SQL Server B]]></content:encoded>
</item>
<item>
<title><![CDATA[Inconsistent Date Literal Parameterization Behaviour]]></title>
<link>http://sqlfascination.com/2009/11/12/inconsistent-date-literal-parameterization-behaviour/</link>
<pubDate>Thu, 12 Nov 2009 22:20:12 +0000</pubDate>
<dc:creator>andrewhogg</dc:creator>
<guid>http://sqlfascination.com/2009/11/12/inconsistent-date-literal-parameterization-behaviour/</guid>
<description><![CDATA[I have mentioned query parameterization before and the process by which SQL extracts literal values ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I have mentioned query parameterization before and the process by which SQL extracts literal values from a query and re-writes the query in effect to use parameters to get a query plan cache hit which negates the need to recompile the plan costing both time and CPU. There are a lot of good articles and book chapters that cover the topic.</p>
<p>What has confused me for a while is witnessing date literals within a query being parameterized on one query and not on another, even though both databases has parameterization set to &#8216;Simple&#8217; mode. When a date literal is not parameterized the chances of getting a query plan cache hit is obviously very low which has performance impacts. The problem to date has been that I had been unable to ascertain the commonality and requirements that allowed the query to get parameterized and when it just kept the literal. I was paying too much attention to the query and as it turns out not enough to the table.</p>
<p>Well, after a number of hours getting to know the brick wall very well I finally tracked it down, and oddly it had nothing to do with the query I was submitting, but I could reproduce reliably by using an unrelated non-clustered index, which is confusing to say the least and I can not yet think of any reason why, is it a bug or just &#8217;Weird and Odd&#8217;.</p>
<p> The following steps reproduce the issue in both SQL Server 2005 and 2008.</p>
<p>Create a database, default settings, nothing specific, then the second step is to create our test table, a simple structure is suffice.</p>
<pre><span style="color:#0000ff;">CREATE</span> <span style="color:#0000ff;">TABLE</span> [dbo].[paramtest](  [id] [int] <span style="color:#0000ff;">IDENTITY</span>(1,1)<span style="color:#808080;"> NOT NULL</span>, [somedate] [datetime] <span style="color:#808080;">NOT NULL</span>, [somefield] [varchar](50) <span style="color:#0000ff;">COLLATE</span> SQL_Latin1_General_CP1_CI_AS <span style="color:#808080;">NULL</span>,
 <span style="color:#0000ff;">CONSTRAINT</span> [PK_paramtest] <span style="color:#0000ff;">PRIMARY</span> <span style="color:#0000ff;">KEY</span> <span style="color:#0000ff;">CLUSTERED</span>
(
 [id] <span style="color:#0000ff;">ASC</span>
)<span style="color:#0000ff;">WITH</span> (IGNORE_DUP_KEY = <span style="color:#0000ff;">OFF</span>) <span style="color:#0000ff;">ON</span> [PRIMARY]
) <span style="color:#0000ff;">ON</span> [PRIMARY]</pre>
<p>We need some data to work against just to make sure we are selecting results, and we can insert these trivially as follows: </p>
<pre><span style="color:#0000ff;">insert </span><span style="color:#0000ff;">into</span> [paramtest] <span style="color:#0000ff;">values</span> (<span style="color:#ff00ff;">getdate</span>(),<span style="color:#0000ff;">'a'</span>)
go 10000</pre>
<p>So we now have 10k rows within the table, and a clustered primary index on the identity column.</p>
<p>The test starts with freeing up the procedure cache, and then running the select statement, the datetime I used was roughly in the middle of the range of values I had inserted but is not a deciding factor in the query plan results.</p>
<pre><span style="color:#0000ff;">dbcc</span> freeproccache <span style="color:#0000ff;">select </span>* <span style="color:#0000ff;">from</span> paramtest <span style="color:#0000ff;">where</span> somedate &#62;<span style="color:#ff0000;"> '2009-11-12 21:14:50.000'</span></pre>
<p>Using a standard query plan cache extraction query the specific line of the xml plan we are interested in is the SQL Statement.</p>
<pre><span style="color:#ff0000;">&#60;StmtSimple StatementText="(@1 varchar(8000))SELECT * FROM [paramtest] WHERE [somedate]&#62;@1" StatementId="1" StatementCompId="1" StatementType="SELECT" StatementSubTreeCost="0.0379857" StatementEstRows="3831.48" StatementOptmLevel="TRIVIAL"&#62;</span></pre>
<p>From it you can see the literal varchar value was extracted as @1 with a type of varchar(8000) and the query altered to use this parameter &#8211; this is exactly the behaviour we would expect from parameter sniffing.</p>
<p>Next step is to create a non-clustered index on the varchar &#8217;somefield&#8217; &#8211; completely unrelated to the date literal being used, and should have no impact on the query at all.</p>
<pre><span style="color:#0000ff;">CREATE </span><span style="color:#0000ff;">NONCLUSTERED</span> <span style="color:#0000ff;">INDEX</span> [ix_test] <span style="color:#0000ff;">ON</span> [dbo].[paramtest] ([somefield] <span style="color:#0000ff;">ASC</span>
)<span style="color:#0000ff;">WITH</span> (SORT_IN_TEMPDB = <span style="color:#0000ff;">OFF</span>, DROP_EXISTING = <span style="color:#0000ff;">OFF</span>, IGNORE_DUP_KEY = <span style="color:#0000ff;">OFF</span>, ONLINE = <span style="color:#0000ff;">OFF</span>) <span style="color:#0000ff;">ON</span> [PRIMARY]</pre>
<p>Free the procedure cache up again and rerun the query</p>
<pre><span style="color:#0000ff;">dbcc</span> freeproccache <span style="color:#0000ff;">select </span>* <span style="color:#0000ff;">from</span> paramtest <span style="color:#0000ff;">where</span> somedate &#62; <span style="color:#ff0000;">'2009-11-12 21:14:50.000'</span></pre>
<p>Extract the query plan again from the cache, but this time it is noticable different, the parameterisation has not occurred. The literal has</p>
<pre><span style="color:#ff0000;">&#60;StmtSimple StatementText="select * from paramtest  where somedate &#62; '2009-11-12 21:14:50.000'" StatementId="1" StatementCompId="1" StatementType="SELECT" /&#62;</span></pre>
<p> To revert to the old plan, drop the index and clear the cache again, then run the query once more.</p>
<pre><span style="color:#0000ff;">DROP INDEX</span> [ix_test] <span style="color:#0000ff;">ON</span> [dbo].[paramtest] <span style="color:#0000ff;">WITH</span> (ONLINE = <span style="color:#0000ff;">OFF</span>)</pre>
<p>Then clear the cache again and run the query</p>
<pre><span style="color:#0000ff;">select</span> * <span style="color:#0000ff;">from</span> paramtest <span style="color:#0000ff;">where</span> somedate &#62; <span style="color:#ff0000;">'2009-11-12 21:14:50.000'</span></pre>
<p> And we are back to being parameterized.</p>
<p>So the application of a single non-clustered index on a separate field to the one being queried is preventing the simple parameterization mode from parameter sniffing the date literal &#8211; this makes absolutely no sense, and you can play around with it a lot more knowing what it causing the effect on the query plan. Even placing the additional non-clustered index on the identity field, which already has a clustered index results in the parameterization failing. If this behaviour is be design, then it makes for an interesting design or limitation on the parameterization.</p>
<p>As soon as the database is in &#8216;Forced&#8217; parameterization mode, the literal was converted each time, so this looks specific to simple mode, but is not explainable, just demonstratable.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Quickie: How to View Currently Executing Queries in SQL Server]]></title>
<link>http://dbalink.wordpress.com/2009/11/12/quickie-how-to-view-currently-executing-queries-in-sql-server/</link>
<pubDate>Thu, 12 Nov 2009 20:14:38 +0000</pubDate>
<dc:creator>MarlonRibunal</dc:creator>
<guid>http://dbalink.wordpress.com/2009/11/12/quickie-how-to-view-currently-executing-queries-in-sql-server/</guid>
<description><![CDATA[[This is actually *stolen* from Brad McGehee Twitter Stream. I am posting it here for reference for ]]></description>
<content:encoded><![CDATA[[This is actually *stolen* from Brad McGehee Twitter Stream. I am posting it here for reference for ]]></content:encoded>
</item>
<item>
<title><![CDATA[Dados Espaciais é com o SQL Server 2008]]></title>
<link>http://microsoftsqlserver.wordpress.com/2009/11/12/dados-espaciais-e-com-o-sql-server-2008/</link>
<pubDate>Thu, 12 Nov 2009 12:36:01 +0000</pubDate>
<dc:creator>dbaoracleinfnet</dc:creator>
<guid>http://microsoftsqlserver.wordpress.com/2009/11/12/dados-espaciais-e-com-o-sql-server-2008/</guid>
<description><![CDATA[Ao mesmo tempo, os avanços na tecnologia têm levado à proliferação de serviços e dispositivos geográ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Ao mesmo tempo, os avanços na tecnologia têm levado à proliferação de serviços e dispositivos geográficos, incluindo soluções de mapeamento online como o Microsoft® Virtual Earth™, e soluções GPS (global positioning system – sistema de posicionamento global) que não são caras. A tecnologia que antes era exclusiva dos especialistas em GIS (geographic information system – sistema de informações geográficas) está agora amplamente disponível para todos.</p>
<p>Esses dois fatores trazem novas expectativas e oportunidades para as aplicações de software. A ubiqüidade dos serviços geográficos e a crescente sofisticação com a qual os usuários consomem os dados mostram que as informações espaciais são apenas mais um componente a ser incorporado a uma solução e usado como base para tomar decisões bem fundamentadas e fornecer serviços de valor mais alto.</p>
<p>Os dados espaciais podem ser usados de várias formas, como demonstra a seguinte lista de exemplos:</p>
<ul>
<li>Um site comercial pode exibir os locais de todas as lojas como pinos em um mapa, e encontrar a mais próxima a um determinado CEP.</li>
<li>Um gerente de vendas pode definir regiões de vendas geográficas, e usá-las para relacionar clientes aos representantes de vendas e realizar análises do desempenho das vendas.</li>
<li>Um arquiteto pode criar projetos para um novo prédio, e sobrepor esses projetos a um mapa do local proposto.</li>
<li>Um motorista pode verificar a distância entre dois locais e planejar uma rota.</li>
<li>Um corretor de imóveis pode identificar, rapidamente, as propriedades que correspondem aos requisitos de um cliente, tais como casas com mais de 1860 metros quadrados localizadas na margem do Lago Washington.</li>
<li>Uma aplicação móvel pode encontrar todos os postos de gasolina dentro de uma distância de 16 quilômetros de um determinado local.</li>
</ul>
<p>Esses exemplos representam apenas algumas das possibilidades criadas pela integração de dados espaciais às aplicações de software.</p>
<p>O SQL Server 2008 oferece suporte para dados geográficos através da inclusão de novos tipos de dados espaciais, que você pode usar para armazenar e manipular informações baseadas em localização. O suporte a dados espaciais do SQL Server 2008 pode ajudar o usuário a tomar decisões mais bem fundamentadas por meio da análise de dados relacionados à localização em cenários como:</p>
<ul>
<li>Informações baseadas em localização e focadas no cliente</li>
<li>Gerenciamento e desenvolvimento baseados no cliente</li>
<li>Impacto, análise e planejamento de dados ambientais</li>
<li>Análise financeira e econômica em comunidades</li>
<li>Análise de desenvolvimento e planejamento baseados no governo</li>
<li>Segmentação e análise de mercado</li>
<li>Design e análise de estudo e pesquisa científica</li>
<li>Desenvolvimento e análise de bens imobiliários</li>
</ul>
<p>Existem dois modelos usados com dados espaciais: geodéticos (fornece uma maneira mais precisa de se definir locais e objetos em um globo, como mostra a Figura 1 abaixo) e planos (uma <em>projeção</em> é criada para aplanar os objetos geográficos no esferóide como mostra a figura 2).</p>
<p><a href="http://blogs.technet.com/blogfiles/especialistadba/WindowsLiveWriter/DadosEspaciaiscomoSQLServer2008_C12F/clip_image001_2.gif"><img title="clip_image001" src="http://blogs.technet.com/blogfiles/especialistadba/WindowsLiveWriter/DadosEspaciaiscomoSQLServer2008_C12F/clip_image001_thumb.gif" border="0" alt="clip_image001" width="244" height="231" /></a></p>
<p>Figura 1: Um modelo geodético</p>
<p><a href="http://blogs.technet.com/blogfiles/especialistadba/WindowsLiveWriter/DadosEspaciaiscomoSQLServer2008_C12F/clip_image002_2.gif"><img title="clip_image002" src="http://blogs.technet.com/blogfiles/especialistadba/WindowsLiveWriter/DadosEspaciaiscomoSQLServer2008_C12F/clip_image002_thumb.gif" border="0" alt="clip_image002" width="244" height="181" /></a></p>
<p>Figura 2: Um modelo plano</p>
<p>O SQL Server 2008 fornece o tipo de dado <strong>geography</strong> para dados espaciais geodéticos e o tipo de dado <strong>geometry</strong> para dados espaciais planos. Ambos são implementados como tipos de dados CLR (Common Language Runtime) do Microsoft .NET Framework e podem ser usados para armazenar diferentes tipos de elementos geográficos como pontos, linhas e polígonos. Os dois tipos de dados fornecem propriedades e métodos que podem ser usados para realizar operações espaciais, como calcular distâncias entre locais e encontrar componentes geográficos que se cruzam (por exemplo, um rio que corta uma cidade).</p>
<p>Fonte: Microsoft TechNet</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Create trigger to find out user updating table]]></title>
<link>http://melissasuciadi.wordpress.com/2009/11/10/create-trigger-to-find-out-user-updating-table/</link>
<pubDate>Tue, 10 Nov 2009 01:53:46 +0000</pubDate>
<dc:creator>melissasuciadi</dc:creator>
<guid>http://melissasuciadi.wordpress.com/2009/11/10/create-trigger-to-find-out-user-updating-table/</guid>
<description><![CDATA[Do you wish to know who do change to your table? Who is updating or do anything to your table? ya yo]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Do you wish to know who do change to your table? Who is updating or do anything to your table? ya you can keep log from your app but how about if you wish to done anything on your db site? Then I suggest you to use trigger like below</p>
<pre>--Create Trigger to insert lastmodifiedtime and lastmodifiedBy acc to SQL User
CREATE TRIGGER LastModif
 ON TableName
 AFTER Updated
 AS
 Update A
 Set LastModifiedBy = suser_sname(),
 LastModifiedTime = getdate()
 FROM TableName A
 JOIN Inserted as U
 ON A.ID = U.ID
</pre>
<p>In code above you&#8217;ll see suser_sname. Suser_sname returns the login name associated with a security identification number (SID). So If you try</p>
<pre>select suser_sname
</pre>
<p>It&#8217;ll displaey you the current account / domain you use.</p>
<p>more about suser_sname <a href="http://msdn.microsoft.com/en-us/library/ms174427.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ms174427.aspx</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Webcast sobre acceso de datos en SQL Server desde ASP.NET 4.0]]></title>
<link>http://todosobresqlserver.wordpress.com/2009/11/07/webcast-sobre-acceso-de-datos-en-sql-server-desde-asp-net-4-0/</link>
<pubDate>Sat, 07 Nov 2009 21:52:37 +0000</pubDate>
<dc:creator>ecastrom</dc:creator>
<guid>http://todosobresqlserver.wordpress.com/2009/11/07/webcast-sobre-acceso-de-datos-en-sql-server-desde-asp-net-4-0/</guid>
<description><![CDATA[En este webcast analizamos las nuevas formas de acceso a base de datos de SQL Server, que están disp]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>En este webcast analizamos las nuevas formas de acceso a base de datos de SQL Server, que están disponibles en ASP.NET 4.0 y Visual Studio 2010. </p>
<p>Puede accederlo en la siguiente dirección</p>
<p><a href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032426170&#38;Culture=es-AR">http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032426170&#38;Culture=es-AR</a></p>
<p>Saludos,     <br />Eduardo Castro Martinez     <br />Costa Rica</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Can a Covering NC Index be Tipped?]]></title>
<link>http://sqlfascination.com/2009/11/07/can-a-covering-nc-index-be-tipped/</link>
<pubDate>Sat, 07 Nov 2009 17:56:03 +0000</pubDate>
<dc:creator>andrewhogg</dc:creator>
<guid>http://sqlfascination.com/2009/11/07/can-a-covering-nc-index-be-tipped/</guid>
<description><![CDATA[Non-clustered indexes normally have a &#8216;tipping point&#8217;, which is the point at which the q]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Non-clustered indexes normally have a &#8216;tipping point&#8217;, which is the point at which the query engine decides to change strategies from seeking the index with a nested loop operator back to a seek on the underlying table or choosing to just scan the underlying table and ignore the index. <a href="http://www.sqlskills.com/blogs/kimberly/">Kimberley Tripp </a>wrote a great article about <a href="http://www.sqlskills.com/BLOGS/KIMBERLY/category/The-Tipping-Point.aspx">&#8216;The Tipping Point</a>&#8216; , and the guidance is at about the 25-33% the query engine will change strategies.</p>
<p>If the non-clustered index is a covering index (it contains all the fields within the query) the query engine does not take the same decision &#8211; it makes sense that if any change in strategy occurs, it would have to be at a far higher figure, and as we are about to see, it will not take that decision and tip.</p>
<p>To test what strategy the engine would use I created a test situation of 2 separate tables, with different page counts, due to the padding column forcing the second table to use far more pages (5953 pages vs 9233)</p>
<pre><span style="color:#0000ff;">CREATE TABLE</span> [dbo].[tblIxTest1]( [PersonnelID] [int] <span style="color:#0000ff;">IDENTITY</span>(1,1)<span style="color:#808080;"> NOT NULL</span>, [FirstName] [char](30) <span style="color:#808080;">NULL</span>, [LastName] [char](30) <span style="color:#808080;">NULL</span>,
   [Department] [char](30) <span style="color:#808080;">NULL</span>, [SomePadding] [char](10) <span style="color:#808080;">NULL</span>
) <span style="color:#0000ff;">ON </span>[PRIMARY]</pre>
<p>And,</p>
<pre><span style="color:#0000ff;">CREATE TABLE</span> [dbo].[tblIxTest2]( [PersonnelID] [int] <span style="color:#0000ff;">IDENTITY</span>(1,1) <span style="color:#808080;">NOT NULL</span>, [FirstName] [char](30) <span style="color:#808080;">NULL</span>, [LastName] [char](30) <span style="color:#808080;">NULL</span>,
   [Department] [char](30) <span style="color:#808080;">NULL</span>, [SomePadding] [char](1000) <span style="color:#808080;">NULL</span>
) <span style="color:#0000ff;">ON</span> [PRIMARY]</pre>
<p>Next step was to insert some data, I needed random data to be able to ensure the index was not unbalanced in some way, so I broke out my useful little random string generation function. I should mention how to create this, a SQL function will not directly support the inclusion of a Rand() call within them, any attempt to do this results in the error:</p>
<pre><span style="color:#ff0000;">Msg 443, Level 16, State 1, Procedure test, Line 13
Invalid use of a side-effecting operator 'rand' within a function.</span></pre>
<p>However, there is nothing stopping a view from using this, and the function from using the view to get around the limitation: </p>
<pre><span style="color:#0000ff;">Create View</span> [dbo].[RandomHelper] <span style="color:#0000ff;">as Select</span> <span style="color:#ff00ff;">Rand</span>() <span style="color:#0000ff;">as</span> r</pre>
<p>And then the function can be generated to use this, it is not necessarily the most efficient random string generation function, but it works nicely.</p>
<pre><span style="color:#0000ff;">CREATE FUNCTION</span> [dbo].[RandomString] (@Length <span style="color:#0000ff;">int</span>) <span style="color:#0000ff;">RETURNS varchar</span>(100)
<span style="color:#0000ff;">WITH EXECUTE AS CALLER
AS
BEGIN
</span>  <span style="color:#0000ff;">DECLARE</span> @Result <span style="color:#0000ff;">Varchar</span>(100)
  <span style="color:#0000ff;">SET</span> @Result = <span style="color:#ff0000;">''
</span>  <span style="color:#0000ff;">DECLARE</span> @Counter <span style="color:#0000ff;">int</span>
  <span style="color:#0000ff;">SET</span> @Counter = 0
  <span style="color:#0000ff;">WHILE</span> @Counter &#60;= @Length
  <span style="color:#0000ff;">BEGIN</span>
     <span style="color:#0000ff;">SET </span>@Result = @Result + <span style="color:#0000ff;">Char</span>(<span style="color:#ff00ff;">Ceiling</span>((<span style="color:#0000ff;">select</span> R <span style="color:#0000ff;">from</span> randomhelper) * 26) + 64)       
     <span style="color:#0000ff;">SET </span>@Counter = @Counter + 1   <span style="color:#0000ff;">END</span>
  <span style="color:#0000ff;">RETURN</span>(@Result)
<span style="color:#0000ff;">END</span></pre>
<p>This now allows me to generate random data and insert it into the tables to get a nice data distribution, and this was run for both of the tables.</p>
<pre><span style="color:#0000ff;">insert into </span>tblIxTest1 <span style="color:#0000ff;">values</span> (dbo.RandomString(20),dbo.RandomString(20),dbo.RandomString(20),<span style="color:#ff0000;">''</span>)
<span style="color:#0000ff;">go </span>1000000</pre>
<p>Two NC indexes are now needed, one for each table and both are identical and cover just the FirstName and PersonnelID fields within the table.</p>
<pre><span style="color:#0000ff;">CREATE NONCLUSTERED INDEX</span> [IX_Test1] <span style="color:#0000ff;">ON</span> [dbo].[tblIxTest1] ( [FirstName] <span style="color:#0000ff;">ASC</span>, [PersonnelID] <span style="color:#0000ff;">ASC</span>
)<span style="color:#0000ff;">WITH</span> (<span style="color:#0000ff;">STATISTICS_NORECOMPUTE</span>  = <span style="color:#0000ff;">OFF</span>, <span style="color:#0000ff;">SORT_IN_TEMPDB</span> = <span style="color:#0000ff;">OFF</span>, <span style="color:#0000ff;">IGNORE_DUP_KEY</span> = <span style="color:#0000ff;">OFF</span>, <span style="color:#0000ff;">DROP_EXISTING</span> = <span style="color:#0000ff;">OFF</span>, <span style="color:#0000ff;">ONLINE</span> = <span style="color:#0000ff;">OFF</span>, <span style="color:#0000ff;">ALLOW_ROW_LOCKS</span>  = <span style="color:#0000ff;">ON</span>, <span style="color:#0000ff;">ALLOW_PAGE_LOCKS</span>  = <span style="color:#0000ff;">ON</span>) <span style="color:#0000ff;">ON</span> [PRIMARY]
GO
<span style="color:#0000ff;">CREATE NONCLUSTERED INDEX</span> [IX_Test2] <span style="color:#0000ff;">ON</span> [dbo].[tblIxTest2] ( [FirstName] <span style="color:#0000ff;">ASC</span>, [PersonnelID] <span style="color:#0000ff;">ASC</span>
)<span style="color:#0000ff;">WITH</span> (<span style="color:#0000ff;">STATISTICS_NORECOMPUTE</span>  = <span style="color:#0000ff;">OFF</span>, <span style="color:#0000ff;">SORT_IN_TEMPDB</span> = <span style="color:#0000ff;">OFF</span>, <span style="color:#0000ff;">IGNORE_DUP_KEY</span> = <span style="color:#0000ff;">OFF</span>, <span style="color:#0000ff;">DROP_EXISTING</span> = <span style="color:#0000ff;">OFF</span>, <span style="color:#0000ff;">ONLINE</span> = <span style="color:#0000ff;">OFF</span>, <span style="color:#0000ff;">ALLOW_ROW_LOCKS</span>  = <span style="color:#0000ff;">ON</span>,<span style="color:#0000ff;"> ALLOW_PAGE_LOCKS</span>  = <span style="color:#0000ff;">ON</span>) <span style="color:#0000ff;">ON</span> [PRIMARY]
GO</pre>
<p>The setup is complete and it is pretty easy to now show the NC covering index is not going to tip, the most extreme where clause is where I am allowing every record to be returned:</p>
<pre><span style="color:#0000ff;">select</span> personnelid , firstname <span style="color:#0000ff;">from</span> tblixtest1 <span style="color:#0000ff;">where</span> firstname &#62;= 'a' <span style="color:#0000ff;">and</span> firstname &#60;= <span style="color:#ff0000;">'zzzzzzzzzzzzzzzzzzzzz'</span></pre>
<p>This still produces a query plan with a seek strategy, regardless of which of my two tables it was executed on:</p>
<pre>select personnelid , firstname from tblixtest1  where firstname &#62;= 'a' and firstname &#60;= 'zzzzzzzzzzzzzzzzzzzzz'  
    &#124;--Index Seek(OBJECT:([FilteredIndexTest].[dbo].[tblIxTest1].[IX_Test1]), SEEK:([FilteredIndexTest].[dbo].[tblIxTest1].[FirstName] &#62;= [@1] AND [FilteredIndexTest].[dbo].[tblIxTest1].[FirstName] &#60;= [@2]) ORDERED FORWARD)</pre>
<p>If we just select the entire table, unsurprisingly at that point it chooses to perform an index scan.</p>
<pre><span style="color:#0000ff;">select</span> personnelid , firstname <span style="color:#0000ff;">from </span>tblixtest1</pre>
<p>Results in the following plan:</p>
<pre>select personnelid , firstname from tblixtest1   &#124;--Index Scan(OBJECT:([FilteredIndexTest].[dbo].[tblIxTest1].[IX_Test1])) </pre>
<p>The row counts on both queries were identical at 1 million. Slightly more interesting is that if I use a Like clause instead of a direct string evaluation, the behaviour alters slightly when selecting all the values:</p>
<pre><span style="color:#0000ff;">select </span>personnelid , firstname <span style="color:#0000ff;">from </span>tblixtest1 <span style="color:#0000ff;">where</span> firstname like '<span style="color:#ff0000;">[a-z]%</span>'</pre>
<p>Gives the query plan:</p>
<pre>select personnelid , firstname from tblixtest1  where firstname like '[a-z]%'  
   &#124;--Index Scan(OBJECT:([FilteredIndexTest].[dbo].[tblIxTest1].[IX_Test1]),  WHERE:([FilteredIndexTest].[dbo].[tblIxTest1].[FirstName] like '[a-z]%'))</pre>
<p>So the query engine is potentially making an optimisation that it knows the like clause covers 100% and adopts an automatic scan, but it is not really very clear why it has this optimisation path. If the like clause changes to [a-y] then it reverts back to a seek, so it looks specific to covering all the values within the like statement. If a between statement is used, it remains a seek regardless.</p>
<p>So the result is that a Non-clustered covering index is very unlikely to tip, you either have to not give it a where clause, or use a like statement across all the values available, it will steadfastly refuse to seek and choose the scan.</p>
<p>Why?</p>
<p>Well the I/O cost of the operation remains the same, it has to read every page in the table and it considered the cost of traversing the B-Tree negligible, so the difference between seek and scan is not very great. Running the seek based query and scan based query in the same batch the relative percentages are 48% vs 52% &#8211; that is the scan scoring 52% even though they read the same number of rows.</p>
<p>Outputting the IO statistics when they are run side by side shows the same number of pages being read, but the seek is clearly being favoured and is slightly faster as far as SQL is concerned &#8211; it is quite weird to consider a seek of an entire index is more efficient than a scan of the index.</p>
<pre>(1000000 row(s) affected)
Table 'tblIxTest1'. Scan count 1, logical reads 5995, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
(1000000 row(s) affected)
Table 'tblIxTest1'. Scan count 1, logical reads 5995, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.</pre>
<p>So if you come across a covering index in a query plan that is scanning, it would be worth investigating as to whether it is intended. The chances are more likely the index field order is not supporting the predicates being used, than engine has chosen to tip the index like it would for the non-covering non-clustered indexes.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Podsumowanie 40. spotkania PLSSUG]]></title>
<link>http://sql4all.wordpress.com/2009/11/06/podsumowanie-40-spotkania-plssug/</link>
<pubDate>Fri, 06 Nov 2009 09:52:16 +0000</pubDate>
<dc:creator>Michał Pośnik</dc:creator>
<guid>http://sql4all.wordpress.com/2009/11/06/podsumowanie-40-spotkania-plssug/</guid>
<description><![CDATA[Wczoraj w Microsoftie, chwilę po godzinie 18, odbyło się 40. spotkanie PLSSUG. Było nas ok. 30 osób?]]></description>
<content:encoded><![CDATA[Wczoraj w Microsoftie, chwilę po godzinie 18, odbyło się 40. spotkanie PLSSUG. Było nas ok. 30 osób?]]></content:encoded>
</item>
<item>
<title><![CDATA[Virtual Study Group 70-432 session 6]]></title>
<link>http://sql4all.wordpress.com/2009/11/06/virtual-study-group-70-432-session-6/</link>
<pubDate>Fri, 06 Nov 2009 09:51:04 +0000</pubDate>
<dc:creator>Michał Pośnik</dc:creator>
<guid>http://sql4all.wordpress.com/2009/11/06/virtual-study-group-70-432-session-6/</guid>
<description><![CDATA[W środę, 04.11 odbyło się szóste już spotkanie Virtual Study Group. Niestety nie mogłem w nim uczest]]></description>
<content:encoded><![CDATA[W środę, 04.11 odbyło się szóste już spotkanie Virtual Study Group. Niestety nie mogłem w nim uczest]]></content:encoded>
</item>

</channel>
</rss>
