<rss version="2.0" xmlns:a10="http://www.w3.org/2005/Atom"><channel><title>SQLService blog posts feed</title><link>http://sqlservice.se/</link><description>SQLService blog posts</description><managingEditor>info@sqlservice.se</managingEditor><category>Blog Posts</category><item><guid isPermaLink="false">835675dc-0705-4eaf-8259-43dfb5c52696</guid><link>http://sqlservice.se/sv/start/blogg/updated-microsoft-sql-server-trace-flag-list.aspx?lang=sv</link><title>Updated: Microsoft SQL Server Trace Flag list</title><description>&lt;p&gt;&lt;em&gt;Updated 2013-05-09 with TF 8002, 4130, 4135, 7826,&amp;nbsp;7827&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;We have in our blog written a lot about Microsoft SQL Server Trace Flags, so I thought it was about time to start making a list of known (and unknown) Trace Flags.&lt;/p&gt;&#xD;
&lt;p&gt;First some info to get you started:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;What are Microsoft SQL Server Trace Flags?&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Trace Flags are settings that in some way or another alters the behaviour of various SQL Server functions.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;How do I turn Trace Flags on and off?&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;- You can use the DBCC TRACEON and DBCC TRACEOFF commands&lt;/p&gt;&#xD;
&lt;p&gt;- You can use the -T option in the startup configuration fo the SQL Server Service&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;strong&gt;How do I know what Trace Flags are turned on at the moment?&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;- You can use the DBCC TRACESTATUS command&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;REMEMBER: Be extremely careful with trace flags, test in yuo test environment first. And consult professionals first if you are the slightest uncertain about the effects of your changes.&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;So, here is the list, but it is just the beginning. We will continue to add more flags, and more information as we go along&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;General Links:&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;SQL Server Central TF List: &lt;a href="http://www.sqlservercentral.com/articles/trace+flags/70131/"&gt;http://www.sqlservercentral.com/articles/trace+flags/70131/&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;MSDN TF list: &lt;a href="http://sqlserverpedia.com/wiki/Trace_Flags"&gt;http://sqlserverpedia.com/wiki/Trace_Flags&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Albert van der Sel TF list: &lt;a href="http://antapex.org/traceflags_sqlserver.txt"&gt;http://antapex.org/traceflags_sqlserver.txt&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Technet Wiki TF list: &lt;a href="http://social.technet.microsoft.com/wiki/contents/articles/13105.trace-flags-in-sql-server.aspx"&gt;http://social.technet.microsoft.com/wiki/contents/articles/13105.trace-flags-in-sql-server.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Amit Banerjee TF list: &lt;a href="http://troubleshootingsql.com/2012/07/01/sql-server-2008-trace-flags/"&gt;http://troubleshootingsql.com/2012/07/01/sql-server-2008-trace-flags/&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Paul Randal discussing TF Pro's and Con's: &lt;a href="http://www.sqlskills.com/blogs/paul/the-pros-and-cons-of-trace-flags/"&gt;http://www.sqlskills.com/blogs/paul/the-pros-and-cons-of-trace-flags/&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 107&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Alter input rules for decimal numbers&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/203787"&gt;http://support.microsoft.com/kb/203787&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Thanks to: &lt;a href="http://www.sqlservercentral.com"&gt;http://www.sqlservercentral.com&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 168&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Bugfix in ORDER BY&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/926292"&gt;http://support.microsoft.com/kb/926292&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 205&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Log usage of AutoStat/Auto Update Statistics&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/195565"&gt;http://support.microsoft.com/kb/195565&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 260&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Prints Extended stord proc DLL versioning info&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 610&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Minimally logged inserts to indexed tables&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://msdn.microsoft.com/en-us/library/dd425070%28v=SQL.100%29.aspx"&gt;http://msdn.microsoft.com/en-us/library/dd425070%28v=SQL.100%29.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 652&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Disable page pre-fetching scans&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/920093"&gt;http://support.microsoft.com/kb/920093&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 661&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function:&amp;nbsp; Disable the ghost record removal process&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/920093"&gt;http://support.microsoft.com/kb/920093&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 834&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Large Page Allocations&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="../sv/start/blogg/nagra-trace-flags-for-sql-server.aspx"&gt;http://sqlservice.se/sv/start/blogg/nagra-trace-flags-for-sql-server.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/920093"&gt;http://support.microsoft.com/kb/920093&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 836&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Use the max server memory option for the buffer pool&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/920093"&gt;http://support.microsoft.com/kb/920093&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 845&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Enable Lock pages in Memory on Standard Edition&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="../sv/start/blogg/sql-server-performance-with-dynamics-axapta.aspx"&gt;http://sqlservice.se/sv/start/blogg/sql-server-performance-with-dynamics-axapta.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 902&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Bypass Upgrade Scripts&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="../sv/start/blogg/sql-server-2012-cu1-upgrade-step--msdb110_upgrade-sql--encountered-error-547.aspx"&gt;http://sqlservice.se/sv/start/blogg/sql-server-2012-cu1-upgrade-step--msdb110_upgrade-sql--encountered-error-547.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 1117&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Simultaneous Autogrowth in Multiple-file database&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="../sv/start/blogg/nagra-trace-flags-for-sql-server.aspx"&gt;http://sqlservice.se/sv/start/blogg/nagra-trace-flags-for-sql-server.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://blogs.technet.com/technet_blog_images/b/sql_server_sizing_ha_and_performance_hints/archive/2012/02/09/sql-server-2008-trace-flag-t-1117.aspx"&gt;http://blogs.technet.com/technet_blog_images/b/sql_server_sizing_ha_and_performance_hints/archive/2012/02/09/sql-server-2008-trace-flag-t-1117.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;strong&gt;Trace Flag : 1118&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Force Uniform Extent Allocation&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="../sv/start/blogg/nagra-trace-flags-for-sql-server.aspx"&gt;http://sqlservice.se/sv/start/blogg/nagra-trace-flags-for-sql-server.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://blogs.msdn.com/b/psssql/archive/2008/12/17/sql-server-2005-and-2008-trace-flag-1118-t1118-usage.aspx"&gt;http://blogs.msdn.com/b/psssql/archive/2008/12/17/sql-server-2005-and-2008-trace-flag-1118-t1118-usage.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 1204&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Returns info about deadlocks&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 1211&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Disables Lock escalation caused by mem pressure&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 1222&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Returns Deadlock info in XML format&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 1224&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Disables lock escalation based on number of locks&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 1264&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Collect process names in non-yielding scenario memory dumps&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/2630458/en-us"&gt;http://support.microsoft.com/kb/2630458/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 1448&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Alters replication logreader functionality&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 1462&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Disable Mirroring Log compression&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://sqlcat.com/sqlcat/b/technicalnotes/archive/2007/09/17/database-mirroring-log-compression-in-sql-server-2008-improves-throughput.aspx"&gt;http://sqlcat.com/sqlcat/b/technicalnotes/archive/2007/09/17/database-mirroring-log-compression-in-sql-server-2008-improves-throughput.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2301&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Enable advanced decision support optimizations&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/920093"&gt;http://support.microsoft.com/kb/920093&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2335&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Generates Query Plans&amp;nbsp;optimized for&amp;nbsp;less memory&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/2413549"&gt;http://support.microsoft.com/kb/2413549&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2340&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Disable specific SORT optimization in Query Plan&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/2009160"&gt;http://support.microsoft.com/kb/2009160&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2371&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Change threshold for auto update stats&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://www.sqlservice.se/sv/start/blogg/sql-server--auto-update-stats-part-2.aspx"&gt;http://www.sqlservice.se/sv/start/blogg/sql-server--auto-update-stats-part-2.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2389&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Enable auto-quick-statistics update for known ascending keys&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="../sv/start/blogg/sql-server-statistics--traceflags-2389--2390.aspx"&gt;http://sqlservice.se/sv/start/blogg/sql-server-statistics--traceflags-2389--2390.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link: &lt;a href="http://blogs.msdn.com/b/ianjo/archive/2006/04/24/582227.aspx"&gt;http://blogs.msdn.com/b/ianjo/archive/2006/04/24/582227.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link: &lt;a href="http://www.sqlmag.com/article/tsql3/making-the-most-of-automatic-statistics-updating--96767"&gt;http://www.sqlmag.com/article/tsql3/making-the-most-of-automatic-statistics-updating--96767&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2390&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Enable auto-quick-statistics update for all columns&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="../sv/start/blogg/sql-server-statistics--traceflags-2389--2390.aspx"&gt;http://sqlservice.se/sv/start/blogg/sql-server-statistics--traceflags-2389--2390.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link: &lt;a href="http://blogs.msdn.com/b/ianjo/archive/2006/04/24/582227.aspx"&gt;http://blogs.msdn.com/b/ianjo/archive/2006/04/24/582227.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link: &lt;a href="http://www.sqlmag.com/article/tsql3/making-the-most-of-automatic-statistics-updating--96767"&gt;http://www.sqlmag.com/article/tsql3/making-the-most-of-automatic-statistics-updating--96767&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2430&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Fixes performance problem when using large numbers of locks&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/2754301/en-us"&gt;http://support.microsoft.com/kb/2754301/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2470&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Fixes performance problem when using AFTER triggers on partitioned tables&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/2606883/en-us"&gt;http://support.microsoft.com/kb/2606883/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2528&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Disables parallellism in CHECKDB etc.&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2540&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Unknown, but related to controlling the contents of a memorydump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2541&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Unknown, but related to controlling the contents of a memorydump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2542&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Unknown, but related to controlling the contents of a memorydump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2543&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Unknown, but related to controlling the contents of a memorydump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2544&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Produces a full memory dump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2545&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Unknown, but related to controlling the contents of a memorydump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2546&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Dumps all threads for SQL Server in the dump file&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2547&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Unknown, but related to controlling the contents of a memorydump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2548&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Unknown, but related to controlling the contents of a memorydump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2549&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Faster CHECKDB&lt;/p&gt;&#xD;
&lt;p&gt;Link: &lt;a href="../sv/start/blogg/faster-dbcc-checkdb-by-using-trace-flag-2562-and-2549.aspx"&gt;http://sqlservice.se/sv/start/blogg/faster-dbcc-checkdb-by-using-trace-flag-2562-and-2549.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://blogs.msdn.com/b/saponsqlserver/archive/2011/12/22/faster-dbcc-checkdb-released-in-sql-2008-r2-sp1-traceflag-2562-amp-2549.aspx"&gt;http://blogs.msdn.com/b/saponsqlserver/archive/2011/12/22/faster-dbcc-checkdb-released-in-sql-2008-r2-sp1-traceflag-2562-amp-2549.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/2634571"&gt;http://support.microsoft.com/kb/2634571&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link: &lt;a href="http://support.microsoft.com/kb/2732669/en-us"&gt;http://support.microsoft.com/kb/2732669/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2550&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Unknown, but related to controlling the contents of a memorydump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2551&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Produces a filtered memory dump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2552&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Unknown, but related to controlling the contents of a memorydump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2553&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Unknown, but related to controlling the contents of a memorydump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2554&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Unknown, but related to controlling the contents of a memorydump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2555&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Unknown, but related to controlling the contents of a memorydump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2556&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Unknown, but related to controlling the contents of a memorydump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2557&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Unknown, but related to controlling the contents of a memorydump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2558&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Unknown, but related to controlling the contents of a memorydump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2559&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Unknown, but related to controlling the contents of a memorydump&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 2562&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Faster CHECKDB&lt;/p&gt;&#xD;
&lt;p&gt;Link: &lt;a href="../sv/start/blogg/faster-dbcc-checkdb-by-using-trace-flag-2562-and-2549.aspx"&gt;http://sqlservice.se/sv/start/blogg/faster-dbcc-checkdb-by-using-trace-flag-2562-and-2549.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://blogs.msdn.com/b/saponsqlserver/archive/2011/12/22/faster-dbcc-checkdb-released-in-sql-2008-r2-sp1-traceflag-2562-amp-2549.aspx"&gt;http://blogs.msdn.com/b/saponsqlserver/archive/2011/12/22/faster-dbcc-checkdb-released-in-sql-2008-r2-sp1-traceflag-2562-amp-2549.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/2634571"&gt;http://support.microsoft.com/kb/2634571&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link: &lt;a href="http://support.microsoft.com/kb/2732669/en-us"&gt;http://support.microsoft.com/kb/2732669/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 3042&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Alters backup compression functionality&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 3101&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Fix performance problems when restoring database with CDC&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/2567366/en-us"&gt;http://support.microsoft.com/kb/2567366/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 3205&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Disable HW compression for backup to tape drives&lt;/p&gt;&#xD;
&lt;p&gt;Link :&amp;nbsp; &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 3213&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Output buffer info for backups to ERRORLOG&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://sqlcat.com/sqlcat/b/technicalnotes/archive/2008/04/21/tuning-the-performance-of-backup-compression-in-sql-server-2008.aspx"&gt;http://sqlcat.com/sqlcat/b/technicalnotes/archive/2008/04/21/tuning-the-performance-of-backup-compression-in-sql-server-2008.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 3226&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Turns off "Backup Successful" messages in errorlog&lt;/p&gt;&#xD;
&lt;p&gt;Link :&amp;nbsp; &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Thanks to: @lwiederstein &lt;a href="https://twitter.com/sql_handle"&gt;/&lt;/a&gt;&lt;a href="https://twitter.com/lwiederstein"&gt;https://twitter.com/lwiederstein&lt;/a&gt;)&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 3604&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Redirect DBCC command output to query window&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://blogs.msdn.com/b/askjay/archive/2011/01/21/why-do-we-need-trace-flag-3604-for-dbcc-statements.aspx"&gt;http://blogs.msdn.com/b/askjay/archive/2011/01/21/why-do-we-need-trace-flag-3604-for-dbcc-statements.aspx&lt;/a&gt; Link: &lt;a href="../sv/start/blogg/querytraceon.aspx"&gt;http://sqlservice.se/sv/start/blogg/querytraceon.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 3605&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Output buffer info for backups to ERRORLOG&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://sqlcat.com/sqlcat/b/technicalnotes/archive/2008/04/21/tuning-the-performance-of-backup-compression-in-sql-server-2008.aspx"&gt;http://sqlcat.com/sqlcat/b/technicalnotes/archive/2008/04/21/tuning-the-performance-of-backup-compression-in-sql-server-2008.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 3608&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Recover only Master db at startup&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 3625&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Masks some errormessages&lt;/p&gt;&#xD;
&lt;p&gt;Link :&amp;nbsp; &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 3656&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Enables resolve of all callstacks in extended events&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://sqlcat.com/sqlcat/b/msdnmirror/archive/2010/05/11/resolving-dtc-related-waits-and-tuning-scalability-of-dtc.aspx"&gt;http://sqlcat.com/sqlcat/b/msdnmirror/archive/2010/05/11/resolving-dtc-related-waits-and-tuning-scalability-of-dtc.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 3688&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Removes messages to errorlog about traces started and stopped&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/922578/en-us"&gt;http://support.microsoft.com/kb/922578/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 4022&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Bypass Startup procedures&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="../sv/start/blogg/sql-server-2012-cu1-upgrade-step--msdb110_upgrade-sql--encountered-error-547.aspx"&gt;http://sqlservice.se/sv/start/blogg/sql-server-2012-cu1-upgrade-step--msdb110_upgrade-sql--encountered-error-547.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 4130&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: XML performance fix&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/957205"&gt;http://support.microsoft.com/kb/957205&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 4135&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Bugfix for error inserting to temp table&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/960770"&gt;http://support.microsoft.com/kb/960770&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 4136&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Parameter Sniffing behaviour alteration&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://blogs.msdn.com/b/axinthefield/archive/2010/11/04/sql-server-trace-flags-for-dynamics-ax.aspx"&gt;http://blogs.msdn.com/b/axinthefield/archive/2010/11/04/sql-server-trace-flags-for-dynamics-ax.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="../sv/start/blogg/nagra-trace-flags-for-sql-server.aspx"&gt;http://sqlservice.se/sv/start/blogg/nagra-trace-flags-for-sql-server.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 4137&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Fix for bad performance in queries with several AND criteria&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/2658214"&gt;http://support.microsoft.com/kb/2658214&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 4138&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Fixes performance probles with certain queries that use TOP statement&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/2667211"&gt;http://support.microsoft.com/kb/2667211&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 4199&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Turn on all optimizations&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="../sv/start/blogg/one-trace-flag-to-rule-them-all.aspx"&gt;http://sqlservice.se/sv/start/blogg/one-trace-flag-to-rule-them-all.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 4616&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Alters server-level metadata visibility&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 6527&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Alters mem dump functionality&lt;/p&gt;&#xD;
&lt;p&gt;Link :&amp;nbsp; &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 7806&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Enables DAC on SQL Server Express&lt;/p&gt;&#xD;
&lt;p&gt;Link :&amp;nbsp; &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 7826&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Disable Connectivity ringbuffer&lt;/p&gt;&#xD;
&lt;p&gt;Link :&amp;nbsp; &lt;a href="http://blogs.msdn.com/b/sql_protocols/archive/2008/05/20/connectivity-troubleshooting-in-sql-server-2008-with-the-connectivity-ring-buffer.aspx"&gt;http://blogs.msdn.com/b/sql_protocols/archive/2008/05/20/connectivity-troubleshooting-in-sql-server-2008-with-the-connectivity-ring-buffer.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 7827&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Record connection closure info in ring buffer&lt;/p&gt;&#xD;
&lt;p&gt;Link :&amp;nbsp; &lt;a href="http://blogs.msdn.com/b/sql_protocols/archive/2008/05/20/connectivity-troubleshooting-in-sql-server-2008-with-the-connectivity-ring-buffer.aspx"&gt;http://blogs.msdn.com/b/sql_protocols/archive/2008/05/20/connectivity-troubleshooting-in-sql-server-2008-with-the-connectivity-ring-buffer.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link: &lt;a href="https://connect.microsoft.com/SQLServer/feedback/details/518158/-packet-error-a-fatal-error-occurred-while-reading-the-input-stream-from-the-network"&gt;https://connect.microsoft.com/SQLServer/feedback/details/518158/-packet-error-a-fatal-error-occurred-while-reading-the-input-stream-from-the-network&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8002&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Changes CPU Affinity behaviour&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/818769"&gt;http://support.microsoft.com/kb/818769&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8010&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Fixes problem that SQL Server services can not be stopped&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/2633271/en-us"&gt;http://support.microsoft.com/kb/2633271/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8011&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Disable the ring buffer for Resource Monitor&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/920093"&gt;http://support.microsoft.com/kb/920093&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8012&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Disable the ring buffer for schedulers&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/920093"&gt;http://support.microsoft.com/kb/920093&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8015&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Ignore NUMA functionality&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://sql-sasquatch.blogspot.se/2013/04/startup-trace-flags-i-love.html"&gt;http://sql-sasquatch.blogspot.se/2013/04/startup-trace-flags-i-love.html&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Thanks to: @sql_handle (&lt;a href="https://twitter.com/sql_handle"&gt;https://twitter.com/sql_handle&lt;/a&gt;)&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8018&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Disable the exception ring buffer&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/920093"&gt;http://support.microsoft.com/kb/920093&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8019&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Disable stack collection for the exception ring buffer&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/920093"&gt;http://support.microsoft.com/kb/920093&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8020&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Disable working set monitoring&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/920093"&gt;http://support.microsoft.com/kb/920093&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8026&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: SQL Server will clear a dumptrigger after generating the dump once&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917825/en-us"&gt;http://support.microsoft.com/kb/917825/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8030&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Fix for performance bug&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/917035"&gt;http://support.microsoft.com/kb/917035&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="../sv/start/blogg/sql-server-2005-slowing-down-after-a-while.aspx"&gt;http://sqlservice.se/sv/start/blogg/sql-server-2005-slowing-down-after-a-while.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8032&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Alters cache limit settings&lt;/p&gt;&#xD;
&lt;p&gt;Link :&amp;nbsp; &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8048&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: NUMA CPU based partitioning&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://sql-sasquatch.blogspot.se/2013/04/startup-trace-flags-i-love.html"&gt;http://sql-sasquatch.blogspot.se/2013/04/startup-trace-flags-i-love.html&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link: &lt;a href="http://blogs.msdn.com/b/psssql/archive/2012/12/20/how-it-works-cmemthread-and-debugging-them.aspx"&gt;http://blogs.msdn.com/b/psssql/archive/2012/12/20/how-it-works-cmemthread-and-debugging-them.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Link: &lt;a href="http://blogs.msdn.com/b/psssql/archive/2011/09/01/sql-server-2008-2008-r2-on-newer-machines-with-more-than-8-cpus-presented-per-numa-node-may-need-trace-flag-8048.aspx"&gt;http://blogs.msdn.com/b/psssql/archive/2011/09/01/sql-server-2008-2008-r2-on-newer-machines-with-more-than-8-cpus-presented-per-numa-node-may-need-trace-flag-8048.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Thanks to: @sql_handle (&lt;a href="https://twitter.com/sql_handle"&gt;https://twitter.com/sql_handle&lt;/a&gt;)&lt;/p&gt;&#xD;
&lt;p&gt;Related to: 8015, 9024&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8207&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Alters Transactional Replication behaviour of UPDATE statement&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8209&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Output extra infomation to errorlog regarding replication of schema changes in SQL Server Replication&lt;/p&gt;&#xD;
&lt;p&gt;Link :&amp;nbsp;&lt;a href="http://support.microsoft.com/kb/916706/en-us"&gt;http://support.microsoft.com/kb/916706/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8602&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Disable Query Hints&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://www.sqlservice.se/sv/start/blogg/sql-server-trace-flag-8602.aspx"&gt;http://www.sqlservice.se/sv/start/blogg/sql-server-trace-flag-8602.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8649&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Set Cost Threshold for parallelism to 0&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://www.sqlservice.se/sv/start/blogg/enable-parallellism-for-specific-query.aspx"&gt;http://www.sqlservice.se/sv/start/blogg/enable-parallellism-for-specific-query.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 8744&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Disable pre-fetching for ranges&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/920093"&gt;http://support.microsoft.com/kb/920093&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 9024&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Performance fix for AlwaysON log replication&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://support.microsoft.com/kb/2809338/en-us"&gt;http://support.microsoft.com/kb/2809338/en-us&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Related to: 8048&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flag : 9485&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Function: Disables SELECT permission for DBCC SHOW_STATISTICS.&lt;/p&gt;&#xD;
&lt;p&gt;Link : &lt;a href="http://msdn.microsoft.com/en-us/library/ms188396.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms188396.aspx&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2013-05-09T12:26:07Z</a10:updated></item><item><guid isPermaLink="false">1d355e7f-2966-4784-8753-75ad59b2d8f3</guid><link>http://sqlservice.se/sv/start/blogg/index-hint--with-(-index-(-0-)-).aspx?lang=sv</link><title>Index Hint - With ( Index ( 0 ) )</title><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;En m&amp;ouml;jlighet som man har n&amp;auml;r man skriver SQL kod &amp;auml;r att ange sk &lt;strong&gt;index hints&lt;/strong&gt;. Att man anv&amp;auml;nder dessa &amp;auml;r inte alltf&amp;ouml;r vanligt, men det f&amp;ouml;rekomer ibland. N&amp;auml;r man g&amp;ouml;r detta s&amp;aring; m&amp;aring;ste man ha klart f&amp;ouml;r sig att detta i framtiden kanske inte var s&amp;aring; smart. Datavolymerna v&amp;auml;xer,&amp;nbsp; inneh&amp;aring;llet i tabellerna f&amp;ouml;r&amp;auml;ndras, nya index tillkommer osv. Ett av de s&amp;auml;mre s&amp;auml;tten &amp;auml;r att ange &lt;strong&gt;WITH ( INDEX ( 0 ) )&lt;/strong&gt; som inneb&amp;auml;r att det alltid blir en scan av tabellen eller det det klustrade index'et och detta kan vara riktigt d&amp;aring;ligt som vi ser nedan.&lt;/p&gt;&#xD;
&lt;p&gt;Om vi k&amp;ouml;r denna fr&amp;aring;ga :&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;USE [AdventureWorks2012];&#xD;
&#xD;
SELECT  [BusinessEntityID] ,&#xD;
        [LastName]&#xD;
FROM    [AdventureWorks2012].[Person].[Person] WITH ( INDEX ( 0 ) )&#xD;
WHERE   [BusinessEntityID] = 1;&lt;/pre&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Detta ger denna statistik&amp;nbsp;f&amp;ouml;r en enda rad som resultat av fr&amp;aring;gan:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=d4d49558-3e1c-46c5-8de6-468916084a9f&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Om man d&amp;auml;remot k&amp;ouml;r samma fr&amp;aring;ga utan att peka ut n&amp;aring;got index ...&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;SELECT  [BusinessEntityID] ,&#xD;
        [LastName]&#xD;
FROM    [AdventureWorks2012].[Person].[Person] &#xD;
WHERE   [BusinessEntityID] = 1;&lt;/pre&gt;&#xD;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;. s&amp;aring; blir det helt annan statistik:&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;img src="../ci.axd?sid=1e9f912a-d6c1-4fe9-8c8f-f109584940a6&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Exekveringsplanerna f&amp;ouml;r dessa fr&amp;aring;gor visar ocks&amp;aring; vilken skillnad det &amp;auml;r p&amp;aring; dem och fr&amp;aring;n verkligheten kan man ske skillnader n&amp;auml;r det g&amp;auml;ller svarstider p&amp;aring; t.ex millisekunder j&amp;auml;mf&amp;ouml;rt med minuter.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=00f4d3b8-441b-48bd-baab-077ee1eeb77f&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;</description><a10:updated>2013-05-08T17:06:15Z</a10:updated></item><item><guid isPermaLink="false">ac8f915a-0120-4fef-b976-860ec559a1f6</guid><link>http://sqlservice.se/sv/start/blogg/powerpivot-tool-dax-studio.aspx?lang=sv</link><title>PowerPivot tool -DAX Studio</title><description>&lt;p&gt;If you work with PowerPivot in Excel, you probably are familiar with DAX. To make your work with DAX easier, you should download the &lt;a href="http://daxstudio.codeplex.com/" target="_blank"&gt;DAX studio&lt;/a&gt; from CodePlex that includes features&amp;nbsp;as Object Browser, query editing and execution, formula and measure editing ,syntax highlighting, integrated tracing and query execution breakdowns.&lt;/p&gt;</description><a10:updated>2013-05-05T21:34:00Z</a10:updated></item><item><guid isPermaLink="false">c07525d5-19c1-4e8e-852d-8cb3f8ba4f0f</guid><link>http://sqlservice.se/sv/start/blogg/prepare-yourself--the-end-is-near.aspx?lang=sv</link><title>Prepare yourself - the end is near</title><description>&lt;p&gt;Well, at least the end of &lt;a href="http://support.microsoft.com/lifecycle/search/?sort=PN&amp;amp;alpha=SQL" target="_blank"&gt;mainstream support&lt;/a&gt; for Microsoft SQL Server 2008 and 2008R2 is near. The mainstream support ends 7/8/2014 and you should prepare yourself and your SQL server environment for SQL server 2012. To prepare yourself you can sign up for a&amp;nbsp;class at &lt;a href="http://www.informator.se"&gt;www.informator.se&lt;/a&gt; or &lt;a href="http://www.labcenter.se"&gt;www.labcenter.se&lt;/a&gt;&amp;nbsp;and to prepare your environment you can contact&amp;nbsp;us for help with consolidation to save money or upgrade support. You can also sign up for a SQL service agreement for your SQL server.&lt;/p&gt;&#xD;
&lt;p&gt;/H&amp;aring;kan Winther&lt;br /&gt;COO&lt;br /&gt;SQL Service&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-04-26T20:51:46Z</a10:updated></item><item><guid isPermaLink="false">275dcf19-2698-4bdb-bea0-79586501d7d1</guid><link>http://sqlservice.se/sv/start/blogg/ny-uppdatering-av-sql-server-2012-rtm.aspx?lang=sv</link><title>Ny uppdatering av SQL Server 2012 RTM</title><description>&lt;p&gt;Sedan f&amp;ouml;rra veckan finns en ny uppdatering f&amp;ouml;r SQL Server 2012 RTM. Observera allts&amp;aring; att denna inte g&amp;auml;ller f&amp;ouml;r service pack 1 d&amp;auml;r n&amp;auml;sta uppdatering kommer om ungef&amp;auml;r en m&amp;aring;nad.&lt;/p&gt;&#xD;
&lt;p&gt;Denna uppdatering inneh&amp;aring;ller 17 r&amp;auml;ttningar, och nedan f&amp;ouml;ljer n&amp;aring;gra av dessa:&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;FIX: Slow performance when you run the SSIS Server Maintenance Job to remove old data in SQL Server 2012&lt;/li&gt;&#xD;
&lt;li&gt;FIX: Incorrect results when you run a FULL JOIN query that uses the CROSS APPLY clause in SQL Server 2008 R2 or in SQL Server 2012&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2823247"&gt;Cumulative update package 7 for SQL Server 2012 &lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Som vanligt g&amp;auml;ller det att alltid testa innan man g&amp;ouml;r f&amp;ouml;r&amp;auml;ndringar i sin produktionsmilj&amp;ouml;, men man b&amp;ouml;r alltid kontrollera vilka f&amp;ouml;rb&amp;auml;ttringar som gjorts i dessa uppdateringar och vem vill inte ha l&amp;ouml;st dessa problem som man kan ha i sin SQL Server milj&amp;ouml;.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-04-25T10:54:27Z</a10:updated></item><item><guid isPermaLink="false">bdfadf68-b360-4968-85b2-17ade7b43a41</guid><link>http://sqlservice.se/sv/start/blogg/rattigheter-for-anvandarna.aspx?lang=sv</link><title>Rättigheter för användarna</title><description>&lt;p&gt;N&amp;auml;r det g&amp;auml;ller r&amp;auml;ttigheter f&amp;ouml;r anv&amp;auml;ndarna i databaserna finns det ingen m&amp;ouml;jlighet att se detta i SQL Server Management Studio p&amp;aring; ett &amp;ouml;versk&amp;aring;dligt s&amp;auml;tt. Nedan &amp;auml;r ett exempel som b&amp;auml;ttre visar de olika anv&amp;auml;ndarna och dess r&amp;auml;ttigheter och d&amp;auml;r vi kan se n&amp;aring;gra av kolumnerna fr&amp;aring;n SQL koden som f&amp;ouml;ljer l&amp;auml;ngre ned.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=1756d769-57ee-41a9-b021-01c83895dcb4&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Att de r&amp;aring;der f&amp;ouml;rrvirring om vilka r&amp;auml;ttighet man egentligen beh&amp;ouml;ver f&amp;ouml;r de olika anv&amp;auml;ndarna och dess roller m&amp;ouml;ter vi ganska ofta. Ofta verkar det ha slutat med att man s&amp;auml;tter sysadmin och detta &amp;auml;r f&amp;ouml;rst&amp;aring;s inte bra, d&amp;aring; det inneb&amp;auml;r totalt frihet att g&amp;ouml;ra allt p&amp;aring; servern.&lt;/p&gt;&#xD;
&lt;p&gt;Mer om databasroller kan man l&amp;auml;sa &lt;a href="http://msdn.microsoft.com/en-us/library/ms189121.aspx"&gt;h&amp;auml;r&amp;nbsp;&lt;/a&gt;och om serverroller finns information &lt;a href="http://msdn.microsoft.com/en-us/library/ms188659.aspx"&gt;h&amp;auml;r&lt;/a&gt;.&lt;/p&gt;&#xD;
&lt;p&gt;Nedan f&amp;ouml;ljer koden som visar de olika anv&amp;auml;ndarna f&amp;ouml;r hela servern och dess databaser och den kan man f&amp;ouml;rst&amp;aring;s modifiera f&amp;ouml;r att passa ens smak och tycke&amp;nbsp;b&amp;auml;ttre&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;DECLARE @DB_USers TABLE&#xD;
(DatabaseName sysname, UserName sysname, LoginType sysname, DBRoleName varchar(max),&#xD;
	CreateDate datetime, ModifyDate datetime, ServerRoleName varchar(max))&#xD;
&#xD;
INSERT @DB_USers&#xD;
EXEC sp_MSforeachdb&#xD;
&#xD;
'USE [?]&#xD;
&#xD;
SELECT ''?'', Users.Name, Users.Type_Desc,  UserDBRole.DBRoleName, Users.Create_date, &#xD;
	ISNULL(UserDBRole.Modify_date, Users.Modify_date), ServerRole.name&#xD;
FROM sys.server_principals Users&#xD;
&#xD;
OUTER APPLY&#xD;
(&#xD;
SELECT&#xD;
	prin.name, &#xD;
	ISNULL(USER_NAME(mem.role_principal_id),'''') AS DBRoleName,&#xD;
	Create_date, Modify_date&#xD;
FROM sys.database_principals prin&#xD;
	LEFT OUTER JOIN sys.database_role_members mem ON prin.principal_id=mem.member_principal_id&#xD;
WHERE prin.sid IS NOT NULL and prin.sid NOT IN (0x00) and&#xD;
	prin.is_fixed_role &amp;lt;&amp;gt; 1 AND prin.name NOT LIKE ''##%'' AND&#xD;
	prin.name COLLATE Finnish_Swedish_CI_AS = Users.Name COLLATE Finnish_Swedish_CI_AS&#xD;
) UserDBRole&#xD;
&#xD;
OUTER APPLY&#xD;
(&#xD;
	SELECT principals.name&#xD;
	FROM&#xD;
		sys.server_principals principals&#xD;
		INNER JOIN sys.server_role_members members ON &#xD;
			principals.principal_id = members.role_principal_id&#xD;
		INNER JOIN sys.server_principals principals2 ON &#xD;
			principals2.principal_id = members.member_principal_id&#xD;
	WHERE principals2.name  = Users.Name&#xD;
) ServerRole&#xD;
&#xD;
WHERE NOT Users.Name IN (''NT AUTHORITY\SYSTEM'')&#xD;
	AND (NOT ServerRole.name IS NULL OR NOT UserDBRole.name IS NULL)' &#xD;
&#xD;
SELECT&#xD;
	DatabaseName, LoginType, UserName, CreateDate AS CreateDate, ModifyDate,&#xD;
&#xD;
	STUFF(&#xD;
	(&#xD;
	SELECT DISTINCT ',' + CONVERT(VARCHAR(500),ServerRoleName)&#xD;
	FROM @DB_USers user2&#xD;
	WHERE&#xD;
		user1.DatabaseName=user2.DatabaseName AND user1.UserName=user2.UserName &#xD;
	FOR XML PATH('')&#xD;
	)&#xD;
	,1,1,'') AS ServerRoleName	,&#xD;
	&#xD;
	STUFF(&#xD;
	(&#xD;
	SELECT DISTINCT ',' + CONVERT(VARCHAR(500),DBRoleName)&#xD;
	FROM @DB_USers user2&#xD;
	WHERE&#xD;
		user1.DatabaseName=user2.DatabaseName AND user1.UserName=user2.UserName&#xD;
	FOR XML PATH('')&#xD;
	)&#xD;
	,1,1,'') AS DBRoleName&#xD;
&#xD;
FROM @DB_USers user1&#xD;
&#xD;
GROUP BY DatabaseName, UserName ,LoginType ,CreateDate ,ModifyDate&#xD;
ORDER BY DatabaseName, LoginType, UserName&#xD;
&lt;/pre&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-04-25T08:04:06Z</a10:updated></item><item><guid isPermaLink="false">b6ca5b8f-3cc1-447c-9639-aadeb19a738c</guid><link>http://sqlservice.se/sv/start/blogg/nya-forbattringar-for-sql-server-2008-r2.aspx?lang=sv</link><title>Nya förbättringar för SQL Server 2008 R2</title><description>&lt;p&gt;Nu finns m&amp;ouml;jlighet att ladda ner nya f&amp;ouml;rb&amp;auml;ttringar f&amp;ouml;r SQL Server 2008 R2 i och med att nya sk kumulativa uppdateringar sl&amp;auml;ppts.&lt;/p&gt;&#xD;
&lt;p&gt;Observera att dessa &amp;auml;r olika beroende p&amp;aring; vilken service pack man har installerat och man m&amp;aring;ste v&amp;auml;lja r&amp;auml;tt version. Om man av n&amp;aring;gon anledning inte vet vilken SQL Server version man har installerat kan man t.ex. anv&amp;auml;nda denna SQL kod:&lt;/p&gt;&#xD;
&lt;p&gt;SELECT @@VERSION&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2830140"&gt;Cumulative update package 6 for SQL Server 2008 R2 SP2&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2828727"&gt;Cumulative update package 12 for SQL Server 2008 R2 SP1 &lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Som vanligt g&amp;auml;ller det att alltid testa innan man g&amp;ouml;r f&amp;ouml;r&amp;auml;ndringar i sin produktionsmilj&amp;ouml;, men man b&amp;ouml;r alltid kontrollera vilka f&amp;ouml;rb&amp;auml;ttringar som gjorts i dessa uppdateringar.&lt;/p&gt;</description><a10:updated>2013-04-23T06:35:26Z</a10:updated></item><item><guid isPermaLink="false">c0c96e72-ce97-4f8e-ba13-447def9f3754</guid><link>http://sqlservice.se/sv/start/blogg/mer-om-sql-server-2012-pa-runasradio.aspx?lang=sv</link><title>Mer om SQL Server 2012 på RunAsRadio</title><description>&lt;p&gt;Som vi skrivit tidigare s&amp;aring; finns det utm&amp;auml;rkta m&amp;ouml;jlighet att l&amp;auml;ra sig mer om SQL Server p&amp;aring; denna informationskanal, som inte enbart handlar om SQL Server. Som regel &amp;auml;r varje session p&amp;aring; dryga halvtimmen och senaste SQL Server sessionen &amp;auml;r :&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.runasradio.com/default.aspx?showNum=311%20%20%20"&gt;Brent Ozar Updates Us On SQL Server 2012&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-04-18T06:19:29Z</a10:updated></item><item><guid isPermaLink="false">17b300c2-3788-407a-bf8a-9ee042323428</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-instead-of-trigger.aspx?lang=sv</link><title>SQL server INSTEAD OF TRIGGER</title><description>&lt;p&gt;First of all, I am not a fan of triggers because of a number of reasons, but i will not go into those in this blog. Anyway, triggers can be useful sometimes, and there are two types of triggers, AFTER trigger and INSTEAD OF TRIGGER. In this blog, I'll focus on the INSTEAD OF TRIGGER.&lt;/p&gt;&#xD;
&lt;p&gt;When this trigger is fired it will handle all records in the same call. That means that you need to take care of all the records in the INSERTED or UPDATED table and update your undlerlying table. Take a look at this sample:&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;SET ANSI_NULLS ON&#xD;
GO&#xD;
IF EXISTS (SELECT * FROM [INFORMATION_SCHEMA].TABLES t WHERE t.[TABLE_SCHEMA] ='dbo' AND t.[TABLE_NAME] = 'triggerTest')&#xD;
	DROP TABLE [dbo].[triggerTest]&#xD;
GO&#xD;
	 &#xD;
SET QUOTED_IDENTIFIER ON&#xD;
GO&#xD;
&#xD;
SET ANSI_PADDING ON&#xD;
GO&#xD;
&#xD;
CREATE TABLE [dbo].[triggerTest](&#xD;
	[col1] [int] IDENTITY(1,1) NOT NULL,&#xD;
	[myName] [varchar](50) COLLATE Finnish_Swedish_CI_AS NOT NULL,&#xD;
	lastUpdated DATE NULL&#xD;
 CONSTRAINT [PK_triggerTest] PRIMARY KEY CLUSTERED &#xD;
(&#xD;
	[col1] ASC&#xD;
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]&#xD;
) ON [PRIMARY]&#xD;
&#xD;
GO&#xD;
&#xD;
SET ANSI_PADDING OFF&#xD;
GO&#xD;
&#xD;
SET ANSI_NULLS ON&#xD;
GO&#xD;
SET QUOTED_IDENTIFIER ON&#xD;
GO&#xD;
&#xD;
CREATE TRIGGER dbo.trigg &#xD;
   ON  dbo.triggerTest &#xD;
   INSTEAD OF INSERT&#xD;
AS &#xD;
BEGIN&#xD;
	SET NOCOUNT ON;&#xD;
	&#xD;
	-- get the records from inserted table&#xD;
 	DECLARE @name VARCHAR(50)&#xD;
	SELECT @name =	[myName] FROM INSERTED&#xD;
&#xD;
	IF EXISTS(SELECT [myName] FROM [dbo].[triggerTest] WHERE [myName] = @name)&#xD;
		UPDATE [dbo].[triggerTest]&#xD;
		SET lastUpdated = GETDATE()&#xD;
		WHERE [dbo].[triggerTest].[myName] = @name &#xD;
	ELSE&#xD;
		-- insert the records in the table&#xD;
		INSERT INTO dbo.[triggerTest] ([myName])&#xD;
		VALUES (@name)   &#xD;
END&#xD;
GO&#xD;
&#xD;
&#xD;
-- insert three records in triggerTest&#xD;
INSERT INTO [dbo].[triggerTest] &#xD;
	([myName])&#xD;
VALUES&#xD;
	('H&amp;aring;kan Winther'),&#xD;
	('Jan Nieminen'),&#xD;
	('G&amp;ouml;ran R&amp;ouml;nnb&amp;auml;ck')&#xD;
&#xD;
-- and take a look at the result&#xD;
SELECT * FROM dbo.[triggerTest] AS tt &#xD;
&#xD;
--as you can see, only one record is inserted&#xD;
--that's because the instead of trigger is &#xD;
--handling all records in the same call&#xD;
--and my trigger is only handling one record&#xD;
&#xD;
GO&#xD;
&#xD;
ALTER TRIGGER dbo.trigg &#xD;
   ON  dbo.triggerTest &#xD;
   INSTEAD OF INSERT&#xD;
AS &#xD;
BEGIN&#xD;
	SET NOCOUNT ON;&#xD;
	&#xD;
	-- update existing records&#xD;
	UPDATE [dbo].[triggerTest]&#xD;
	SET lastUpdated = GETDATE()&#xD;
	WHERE [dbo].[triggerTest].[myName] IN (SELECT [myName] FROM INSERTED)&#xD;
&#xD;
	-- insert the new records in the table&#xD;
	INSERT INTO dbo.[triggerTest] ([myName])&#xD;
	SELECT i.[myName] FROM INSERTED I &#xD;
	LEFT JOIN [dbo].[triggerTest] AS TT &#xD;
	ON I.myName = tt.[myName]&#xD;
	WHERE tt.col1 IS NULL&#xD;
END&#xD;
GO&#xD;
&#xD;
-- insert three records in triggerTest&#xD;
INSERT INTO [dbo].[triggerTest] &#xD;
	([myName])&#xD;
VALUES&#xD;
	('H&amp;aring;kan Winther'),&#xD;
	('Jan Nieminen'),&#xD;
	('G&amp;ouml;ran R&amp;ouml;nnb&amp;auml;ck')&#xD;
&#xD;
-- and take a look at the result&#xD;
SELECT * FROM dbo.[triggerTest] AS tt &lt;/pre&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;As you can see, before we changed the trigger, only the last record is inserted (or updated). After the trigger was changed to use the INSERTED table, the complete set of records was inserted or updated. Make sure you take care of all records in the trigger, otherwise you are in serious trouble.&lt;/p&gt;&#xD;
&lt;p&gt;If you have any SQL server related questions, feel free to contact any of our SQL server consultants and we will help you.&lt;/p&gt;&#xD;
&lt;p&gt;H&amp;aring;kan Winther&lt;br /&gt;twitter: @h_winther&lt;/p&gt;</description><a10:updated>2013-04-15T13:20:43Z</a10:updated></item><item><guid isPermaLink="false">169eab78-bc34-4235-99e4-d068646ae2cc</guid><link>http://sqlservice.se/sv/start/blogg/sqlintersection--execution-plans.aspx?lang=sv</link><title>SQLIntersection - Execution Plans </title><description>&lt;p&gt;Som sagt g&amp;auml;ller det olika sp&amp;aring;r varje dag p&amp;aring; SQLIntersection, och s&amp;aring; den 5:e dagen handlade det enbart om Execution Plans f&amp;ouml;r min del. F&amp;ouml;rsta sessionen med Grant Fritchey om "Tune Queries by Fixing Bad Parameter Sniffing". Normalt och oftast s&amp;aring; fungerar "Parameter Sniffing" bra, men ibland blir det v&amp;auml;ldigt d&amp;aring;ligt och det &amp;auml;r ofta d&amp;aring; vi m&amp;auml;rker problemen, det sv&amp;auml;nger i prestandan p&amp;aring; samma fr&amp;aring;ga kan man tycka. F&amp;ouml;r att l&amp;ouml;sa det m&amp;aring;ste man till att b&amp;ouml;rja ha uppdaterad statistik. Kanske inte det hj&amp;auml;lper pga man har har v&amp;auml;ldigt skev statistik och d&amp;aring; har man har v&amp;auml;lja bland olika s&amp;auml;tt med dess f&amp;ouml;r- och nackdelar t.ex. lokala variabler, optimize for value, optimize for unknown, recompile, plan guides osv. Dessutom kan man faktiskt sl&amp;aring; av parameter sniffing med en traceflagga, men det vill man f&amp;ouml;rst&amp;aring;s inte. Att rekommendera &amp;auml;r ocks&amp;aring; l&amp;auml;sa Grants bok "SQL Server 2008 Query Performance Tuning Distilled" som &amp;auml;r en klassiker och handlar v&amp;auml;ldigt mycket om exekveringsplaner.&lt;/p&gt;&#xD;
&lt;p&gt;Resten av dagen h&amp;ouml;ll Paul White tv&amp;aring; sessioner om just exekveringsplaner, Han b&amp;ouml;rjade med "I love execution plans" och det &amp;auml;r inget tvivel om :-). Del 1 p&amp;aring; 200 niv&amp;aring; gick han igenom hur man skall l&amp;auml;sa en exekveringsplan och vad man b&amp;ouml;r inrikta sig p&amp;aring; t.ex. stora skillnader mellan estimate och actual number of rows, tjockleken p&amp;aring; linjerna, scans, lookups, on&amp;ouml;diga sorteringar osv. Del 2 p&amp;aring; 400 niv&amp;aring; bestod till skillnad fr&amp;aring;n del 1 av bara en overhead och resten med massor av exempel. Paul White &amp;auml;r ju k&amp;auml;nd f&amp;ouml;r att ha testat allt f&amp;ouml;r att se vilka skillnader det blir i exekveringsplanerna och resultaten och det visade han ocks&amp;aring;. Nedan &amp;auml;r ett exempel av detta och d&amp;auml;r kan man tycka att det borde visa samma resultat i b&amp;aring;da fallen.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=ae861a60-376d-4cbd-9a41-c1ba1ee605d1&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;</description><a10:updated>2013-04-12T04:03:46Z</a10:updated></item><item><guid isPermaLink="false">14fc98fd-c09e-463a-9b29-6bd5d00b1d5f</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-och-portar.aspx?lang=sv</link><title>SQL Server och portar</title><description>&lt;p&gt;SQL Server lyssnar ju som bekant by default p&amp;aring; port 1433 om man installerar en default instans. Installerar man en namngiven instans kan man v&amp;auml;lja att antingen l&amp;aring;ta SQL Server lyssna p&amp;aring; en port dynamiskt eller s&amp;aring; anger man en port som den skall lyssna p&amp;aring;.&lt;/p&gt;&#xD;
&lt;p&gt;Men kan man ha mer &amp;auml;n en port? Ja det kan man. Detta kan man g&amp;ouml;ra mha Configuration Manager.&lt;/p&gt;&#xD;
&lt;p&gt;Detta g&amp;ouml;r man via SQL Server Network Configuration i Configuration Manager. D&amp;auml;ri v&amp;auml;ljer man sedan ut den instans man vill &amp;auml;ndra, klickar p&amp;aring; fliken IP Addresses och IP ALL. H&amp;auml;r kan man sedan ange sina portar &amp;aring;tskiljda med kommatecken som man vill att SQL Server skall lyssna p&amp;aring;.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=efae5d23-532d-4548-9aaa-26304c750c94&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Efter detta m&amp;aring;ste man som vanligt starta om SQL tj&amp;auml;nsten innan &amp;auml;ndringen sl&amp;aring;r igenom.&lt;/p&gt;&#xD;
&lt;p&gt;Om&amp;nbsp;man nu vill testa att detta fungerar kan vi enkelt g&amp;ouml;ra det med Management Studio. Vi b&amp;ouml;rjar med att st&amp;auml;nga av SQL Server Browser. Efter det kan vi prova att koppla upp v&amp;aring;r instans med r&amp;auml;tt portnummer. I exemplet ovan hade jag en instans som heter SQL2012 d&amp;auml;r jag angav portar: 1205 och 1206. I och med att jag st&amp;auml;ngt av SQL Server Browser, och vill koppla upp en namngiven instans,&amp;nbsp;s&amp;aring; m&amp;aring;ste jag &amp;auml;ven ange port:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=45c9bca6-d43f-4be4-af7c-41ef910e1535&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Vi kan h&amp;auml;r se att SQL Server nu lyssnar p&amp;aring; mer &amp;auml;n en port. En titt i error loggen bekr&amp;auml;ftar detta:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=a2ec8e96-9896-41c7-b748-38315557667c&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;</description><a10:updated>2013-04-11T20:58:03Z</a10:updated></item><item><guid isPermaLink="false">f24367cd-5261-4070-b4c3-00d30977c933</guid><link>http://sqlservice.se/sv/start/blogg/sqlintersection--virtualize--azure.aspx?lang=sv</link><title>SQLIntersection - Virtualize &amp; Azure </title><description>&lt;p&gt;Dag 4 inledde jag med "Oh No! They're Making Me Virtualize!" av Brent Ozar. Han gick igenom de olika steg som ev inneb&amp;auml;r att man beslutar att flytta sina databaser till en virtuell v&amp;auml;rld. I korthet sammafattat att man till att b&amp;ouml;rja med m&amp;auml;ter i sin nuvarande milj&amp;ouml;, sedan avg&amp;ouml;r beroende p&amp;aring; flaskhalsarna om databasen &amp;ouml;verhuvudtaget skall flyttas och till sist genomf&amp;ouml;r med de inst&amp;auml;llningar man m&amp;aring;ste g&amp;ouml;ra i sin SQL Server milj&amp;ouml; samt att sedan bevaka genom att forts&amp;auml;tta m&amp;auml;ta. En mycket bra dragning och som vid handuppr&amp;auml;ckning visade att enstaka &amp;auml;r n&amp;ouml;jda med prestanda i sin virtuella v&amp;auml;rld och att de allra flesta anv&amp;auml;nder VMware.&lt;/p&gt;&#xD;
&lt;p&gt;En annan session visade att Azure inte blivit n&amp;aring;got hit &amp;auml;nnu bland oss utvecklare. P&amp;aring; Grant Fritcheys session "Query Tuning in the Clouds" var vi 5 totalt i rummet ?. Hur som helst en bra dragning som visar att det blir &amp;auml;n viktigare att designa och koda smart och r&amp;auml;tt. Han visade de verktyg som vi har att anv&amp;auml;nda SSMS, SQL Management Portal och DMV's. Nyttig dragning f&amp;ouml;r mig och det &amp;auml;r klart att det blir diskussioner med Aaron Bertrand fr&amp;aring;n SQL Sentry med verktyget &lt;a href="http://www.sqlsentry.net/plan-explorer/sql-server-query-view.asp"&gt;Plan Explorer&lt;/a&gt; i rummet n&amp;auml;r vi tittade p&amp;aring; exekveringsplanen som man f&amp;aring;r fr&amp;aring;n portalen.&lt;/p&gt;&#xD;
&lt;p&gt;Ytterligare en bra dag allts&amp;aring; :-)&lt;/p&gt;</description><a10:updated>2013-04-11T13:52:53Z</a10:updated></item><item><guid isPermaLink="false">316fb787-b7e0-47ea-a3c7-10a93a522f39</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-statistics--traceflags-2389--2390.aspx?lang=sv</link><title>SQL Server statistics - traceflags 2389 &amp; 2390</title><description>&lt;p&gt;A common problem with statistics is when it's based on an index with an incrementing column, like an IDENTITY column or a DATETIME column that is behaving like a time stamp. The problem occurs when you have a large table and you add more records (less than 20% of the number of existing records)&amp;nbsp;and then tries to select those newly added records. As the auto update statistics is only triggered when 20% of the records are updated, you'll have statistics that are "out of date" and doesn't know anything about the new records.&lt;/p&gt;&#xD;
&lt;p&gt;This lack of statistics will cause the SQL optimizer to choose a plan that is based on the assumption that there are&amp;nbsp;only&amp;nbsp;one records for the incrementing column, and that's usually a bad idea from a performance perspective.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;When you select records, you'll see differences between the estimated and actual number of records.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;img src="../ci.axd?sid=f4726b1b-213a-4df2-b836-3492a2709458&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Since SQL server 2005 SP1, there are two undocumented (and unsupported) trace flags that can be used to solve this issue and they also applies to SQL2008, SQL2008R2 and SQL2012. Traceflag 2389 will &amp;nbsp;enable auto-quick-statistics update for known ascending keys and 2390 will enable auto-quick-statistics update for all columns, known ascending or unknown.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;What does that mean? Well, when the statistics are seen to increase three times the column is branded ascending.&amp;nbsp; If trace flag 2389 is set, and a column is branded ascending, and an index exists with that ascending column as the leading key, then the statistics will be updated automatically at query compile time.&amp;nbsp; SQL Server finds the highest value and adds a new step at the end of the existing histogram.&amp;nbsp; &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Lets look at a sample&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;-- create a table with values from 1 to 200 000&#xD;
SELECT * &#xD;
INTO dbo.IncreasingColumn&#xD;
FROM dbo.[fnNumsTable](1,200000,1) AS fnt; -- this function generates records from x to Y&#xD;
&#xD;
-- create a clustered index&#xD;
CREATE CLUSTERED INDEX ix ON dbo.IncreasingColumn (n);&#xD;
&#xD;
-- the statistics is up to date&#xD;
-- take a look at the execution plan&#xD;
-- as you can see, the estimated and the actual number of records match&#xD;
SELECT n FROM dbo.increasingColumn WHERE n &amp;gt; 200000&#xD;
&#xD;
-- lets add 100 records&#xD;
-- not enough to trigger the auto update stats &#xD;
INSERT INTO dbo.IncreasingColumn&#xD;
SELECT n&#xD;
FROM [SQLServiceTools].dbo.[fnNumsTable](200001,200100,1) AS fnt;&#xD;
&#xD;
--if you compare the estimated and actual number of records,&#xD;
--you'll notice that estimated number of records is only 1&#xD;
-- this is beacause the value I am lookin for is not within range in&#xD;
-- the statistics &#xD;
SELECT n FROM dbo.increasingColumn WHERE n &amp;gt; 200000&#xD;
&#xD;
-- let's activate the trace flags&#xD;
DBCC TRACEON(2389,2390);&#xD;
&#xD;
-- and compare the actual and estimated again.&#xD;
-- now they match each other, exactly what we want&#xD;
SELECT n FROM dbo.increasingColumn WHERE n &amp;gt; 200000 OPTION(RECOMPILE)&lt;/pre&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=ccd57afd-f9df-408a-9b2b-296c7d66c06a&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;As you can see in the actual execution plan, with the trace flags active you'll get more accurate statistics and that's a good thing for your performance. When you have accurate statistics it's more likely that SQL server optimizer will choose a good plan and the right indexes depending on the number of records you'll trying to get.&lt;/p&gt;&#xD;
&lt;p&gt;You can activate the trace flags on Global, Session or Statement level ( by using OPTION(QUERYTRACEON 2390,QUERYTRACEON 2389, RECOMPILE) ), but you have to be a member of the sysadmin role.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;If you experience performancec issues, call us and our SQL server consultants will help you.&lt;/p&gt;&#xD;
&lt;p&gt;/H&amp;aring;kan Winther&lt;br /&gt;Twitter: @h_winther&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-04-11T12:00:47Z</a10:updated></item><item><guid isPermaLink="false">63d9c1ce-ffaa-4252-bd61-0e2ec3e8408c</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-trace-flag-8602.aspx?lang=sv</link><title>SQL Server trace flag 8602</title><description>&lt;p&gt;Sometimes you may stumble upon a slow running query in SQL server and when you look at the code you find&amp;nbsp;an index hint. In normal cases the query runs fast and you need to investigate why the the query suddenly runs slower. One option you could try is to remove the query hint and run the query to see if you get a different execution plan and faster query. An easier way without changing the query is to use the trace flag 8602. This trace flag disables all index hints in your session or at a global level.&lt;/p&gt;&#xD;
&lt;p&gt;You can try the code below to see the difference.&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;USE [AdventureWorks2008R2]&#xD;
GO&#xD;
&#xD;
CREATE PROCEDURE Sales.spGetCustomerWithIndexHint @customerID INT = NULL&#xD;
AS&#xD;
SELECT * &#xD;
FROM Sales.Customer c WITH(INDEX(AK_Customer_AccountNumber)) -- force a specific (incorrect) index for demonstration &#xD;
WHERE &#xD;
	c.[CustomerID] = @customerID;&#xD;
GO&#xD;
&#xD;
SET STATISTICS IO ON;&#xD;
SET STATISTICS TIME ON;&#xD;
&#xD;
--execute the procedure&#xD;
EXEC Sales.spGetCustomerWithIndexHint 1&#xD;
&#xD;
--activate the traceflag and try again&#xD;
DBCC TRACEON(8602,-1)&#xD;
GO&#xD;
EXEC Sales.spGetCustomerWithIndexHint 1&lt;br /&gt;DBCC TRACEOFF(8602)&#xD;
GO&#xD;
--compare the execution plans &#xD;
--and the statistics time and IO in the message window&#xD;
--as you can see when using the index hint,&#xD;
--you get and index scan and a key lookup&#xD;
--Without the index hint, you get an clustered index seek&lt;/pre&gt;&#xD;
&lt;p&gt;In this case, you notice that the index you are trying to force is causing SQL server to do&amp;nbsp;key lookups and is causing the performance issues. To solve this issue you remove the index hint or change the query to return only the columns you need and change the index to include&amp;nbsp;all the columns you have specified in the query.&lt;/p&gt;&#xD;
&lt;p&gt;Index hints can sometimes help, but as your database grow and data is changing, you might end up in a situation where SQL server should have chosen a faster execution plan.&lt;/p&gt;&#xD;
&lt;p&gt;If you are experiencing performance issues, feel free to contact us, and our highly skilled SQL server consultants will help you.&lt;/p&gt;&#xD;
&lt;p&gt;/H&amp;aring;kan Winther&lt;br /&gt;@h_winther&lt;/p&gt;</description><a10:updated>2013-04-11T07:37:51Z</a10:updated></item><item><guid isPermaLink="false">8b817ff2-d291-4c66-b972-a43de287d515</guid><link>http://sqlservice.se/sv/start/blogg/finding-prime-numbers-with-sql-server.aspx?lang=sv</link><title>Finding prime numbers with SQL server</title><description>&lt;div&gt;Today I just wanted to have a little fun, while at the same time brushing off my T-SQL skills. As you know, &lt;a href="http://en.wikipedia.org/wiki/Prime_number"&gt;prime numbers&lt;/a&gt;have many uses, for example in encryption. And while they are easy to find in the beginning, it gets increasingly harder as the numbers go up. Below is the little snippet of code that prints out prime numbers.&lt;/div&gt;&#xD;
&lt;p&gt;It has 2 parameters that you can use to control it, @a is the first number to evaluate and @b is the last.&lt;/p&gt;&#xD;
&lt;p&gt;The rest is basically 2 nested loops, one that counts from @a to @b, and one that evaluates @a to see if it is a prime number by dividing it by all numbers between 2 and @a/2. The little trick with @a/2 makes it twice as fast as without :-)&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;UPDATE: It turns out, that in fact much time can be saved by just dividing with all integers between 2 and sqrt(@2) so the code below is updated, and it now runs in 2 seconds :-)&lt;/p&gt;&#xD;
&lt;p&gt;Enjoy!&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;declare @b int&#xD;
declare @c float&#xD;
declare @d int&#xD;
&#xD;
select @a = 10&#xD;
select @b = 10000&#xD;
select @c = @a&#xD;
select @d = 0&#xD;
&#xD;
&#xD;
while @a &amp;lt; @b &#xD;
begin&#xD;
&#xD;
select @c = (convert(int, sqrt(@a)) ) + 1&#xD;
&#xD;
while @c &amp;gt; 1&#xD;
begin&#xD;
&#xD;
&#xD;
if (select (@a/@c) - (convert(int, @a/@c) )) = 0&#xD;
  select @d=@d+1&#xD;
  if (select (@a/@c) - (convert(int, @a/@c) )) = 0&#xD;
  break&#xD;
select @c=@c-1&#xD;
end&#xD;
if (select @d) = 0&#xD;
  print convert(varchar(10),@a) + ' is a prime number'&#xD;
select @d = 0&#xD;
select @a=@a+1&#xD;
end&lt;/pre&gt;&#xD;
&lt;p&gt;It is not the fastest prime number finder in the world, but I clocked it at &lt;span style="text-decoration: line-through;"&gt;50&lt;/span&gt; 2 seconds to find all primes between 10 and 10000 and 1 minute and 17 seconds to find all primes between 10 and 100.000. Can you beat that with T-SQL? in that case, post the code in a comment !&lt;/p&gt;</description><a10:updated>2013-04-10T14:58:39Z</a10:updated></item><item><guid isPermaLink="false">d79e68ca-79b7-4058-adbf-34635daa21b7</guid><link>http://sqlservice.se/sv/start/blogg/sqlintersection--troubleshooting--tune.aspx?lang=sv</link><title>SQLIntersection - Troubleshooting &amp; Tune </title><description>&lt;p&gt;Dag 3 inleddes sj&amp;auml;lva konferensen med 3 olika sp&amp;aring;r f&amp;ouml;r oss med SQL fokus. Att v&amp;auml;lja r&amp;auml;tt session &amp;auml;r ju inte helt l&amp;auml;tt och de som varit p&amp;aring; PASS Summit vet hur sv&amp;aring;rt det kan vara att v&amp;auml;lja och ibland blir det fel. En nyhet som testas h&amp;auml;r &amp;auml;r ocks&amp;aring; v&amp;auml;rdarna f&amp;ouml;r de olika sp&amp;aring;ren som jag skrivit om tidigare och det var ocks&amp;aring; ett lyft f&amp;ouml;r sessionerna. Sp&amp;aring;ren f&amp;ouml;r dag 3 var:&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;Design and Tune&lt;/li&gt;&#xD;
&lt;li&gt;Troubleshooting and Monitoring&lt;/li&gt;&#xD;
&lt;li&gt;2012 and Beyond&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;F&amp;ouml;r mig inleddes dagen med "Performance Troubleshooting" av Brent Ozar. Tiden f&amp;ouml;r varje session &amp;auml;r inte l&amp;aring;ng, ca 1 timme och &amp;nbsp;Brent valde denna g&amp;aring;ng att presentera tre av sina farvoritverktyg:&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;&lt;a href="http://www.scalesql.com/cleartrace/download.aspx"&gt;ClearTrace &lt;/a&gt;&lt;/li&gt;&#xD;
&lt;li&gt;&lt;a href="http://sqlserverpedia.com/wiki/Queries_in_Procedure_Cache"&gt;Plans in the Cache &lt;/a&gt;&lt;/li&gt;&#xD;
&lt;li&gt;&lt;a href="http://www.brentozar.com/archive/2010/09/sql-server-dba-scripts-how-to-find-slow-sql-server-queries/"&gt;sp_WhoIsActive&lt;/a&gt;&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;Som sagt tiden &amp;auml;r knapp men en lysande presentation och Brent &amp;auml;r i en klass f&amp;ouml;r sig.&lt;/p&gt;&#xD;
&lt;p&gt;En annan bra talare &amp;auml;r Paul Randal som drog "Making SQL Faster : No so Simple Things". Han valde att fokusera p&amp;aring; Waits och gick igenom symptom och orsaken till n&amp;aring;gra av de vanligaste som f&amp;ouml;rekommer.&lt;/p&gt;</description><a10:updated>2013-04-10T12:00:17Z</a10:updated></item><item><guid isPermaLink="false">37b2123d-309d-4cf1-951a-96b3added036</guid><link>http://sqlservice.se/sv/start/blogg/sqlintersection--statement-execution-and-optimizing-stored-procedures.aspx?lang=sv</link><title>SQLIntersection - Statement Execution and Optimizing Stored Procedures</title><description>&lt;p&gt;Dag tv&amp;aring; i ett kyligare Vegas fortsatte f&amp;ouml;r mig med sessionen "Understanding Statement Execution and Optimizing Stored Procedures". Ocks&amp;aring; den h&amp;aring;llen av Kimberly Tripp. Dock var inte Paul Randal med och st&amp;ouml;ttade idag eftersom han bara sa tre ord ig&amp;aring;r :-). Idag har vi g&amp;aring;tt genom &amp;nbsp;procedurcachen eller plan cache'n som man numera kallar den och hur man b&amp;auml;st utnyttjar detta utrymme, som f&amp;ouml;r t.ex. SQL Server 2008+ och SQL Server 2005 SP2 med 16 GB tilldelat till SQL Server hela 4,2 GB g&amp;aring;r &amp;aring;t till plan cache'n. D&amp;aring; g&amp;aring;r det inte att fylla den med planer &amp;nbsp;som bara anv&amp;auml;nds enstaka g&amp;aring;nger. Mer om detta och hur man hittar dessa kan man l&amp;auml;sa &lt;a href="http://msdn.microsoft.com/en-us/library/cc645887(sql.105).aspx"&gt;h&amp;auml;r&lt;/a&gt;.&lt;/p&gt;&#xD;
&lt;p&gt;F&amp;ouml;rst&amp;aring;s pratade vi mycket om Ad hoc fr&amp;aring;gor kontra lagrade procedurer och n&amp;auml;r man skall anv&amp;auml;nda dem och vilka f&amp;ouml;rdelar/nackdelar det ger, t.ex. problemen som man kan f&amp;aring; med "parameter sniffing och vilka alternativ man har att f&amp;ouml;r att l&amp;ouml;sa nackdelarna.&lt;/p&gt;&#xD;
&lt;p&gt;Att kombinera OR och AND i sina SQL satser har s&amp;auml;kert de flesta m&amp;auml;rkt &amp;auml;r ingen lyckad kombination n&amp;auml;r det g&amp;auml;ller prestanda f&amp;ouml;r SQL Server. Exemplet nedan &amp;auml;r s&amp;auml;kert inte alltf&amp;ouml;r ovanligt f&amp;ouml;r m&amp;aring;nga av oss och detta resulterar ofta i d&amp;aring;liga planer. En l&amp;ouml;sningen &amp;nbsp;som i alla fall kan hj&amp;auml;lpa en del &amp;auml;r "Option Recompile" men &amp;auml;nnu b&amp;auml;ttre &amp;auml;r kombinera detta med dynamisk SQL.&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;(&#xD;
 @Lastname varchar(30) = NULL,&#xD;
 @Firstname varchar(30) = NULL,&#xD;
 @member_no int = NULL&#xD;
)&#xD;
&#xD;
SELECT m.* &#xD;
FROM dbo.member AS m&#xD;
WHERE (m.lastname LIKE @lastname &lt;strong&gt;OR @lastname IS NULL&lt;/strong&gt;)&#xD;
 AND (m.member_no = @member_no &lt;strong&gt;OR @member_no IS NULL&lt;/strong&gt;)&#xD;
 AND (m.firstname LIKE @firstname &lt;strong&gt;OR @firstname IS NULL&lt;/strong&gt;)&lt;/pre&gt;&#xD;
&lt;p&gt;Ocks&amp;aring; dag tv&amp;aring; mycket bra och nu &amp;auml;r ocks&amp;aring; antalet deltagare betydligt flera.&lt;/p&gt;</description><a10:updated>2013-04-09T03:00:31Z</a10:updated></item><item><guid isPermaLink="false">4f80cdd1-8b64-4a72-be3c-7df339aa6cee</guid><link>http://sqlservice.se/sv/start/blogg/sql-intersection--indexing-strategies-that-work.aspx?lang=sv</link><title>SQL Intersection - Indexing Strategies that Work </title><description>&lt;p&gt;I g&amp;aring;r s&amp;aring; startade SQLIntersection som allts&amp;aring; g&amp;aring;r under samma paraply som DevIntersection. Dock var det enda sessionen ig&amp;aring;r Kimberly Tripps om "Indexing Strategies that Work: Covering - Concepts, Concerns, Costs". En heldag med index som visade hur viktigt det &amp;auml;r att g&amp;ouml;ra r&amp;auml;tt urval och skapa r&amp;auml;tt index och att ocks&amp;aring; inkludera de kolumner man beh&amp;ouml;ver f&amp;ouml;r att undvika sk bookmark lookups. Kimberly visade med formler som verkar h&amp;aring;lla n&amp;auml;r SQL Server v&amp;auml;ljer att g&amp;ouml;ra en table/index scan ist&amp;auml;llet f&amp;ouml;r denna lookup som kostar rej&amp;auml;lt n&amp;auml;r det g&amp;auml;ller prestanda. Detta kallar hon "Tipping Point" och det kan f&amp;ouml;rv&amp;aring;na m&amp;aring;nga att det vid v&amp;auml;ldigt f&amp;aring; rader som en bookmark lookup l&amp;ouml;nar sig, under 1 %. Mer om detta kan man testa&amp;nbsp;sj&amp;auml;lv &lt;a href="http://sqlinthewild.co.za/index.php/2009/01/09/seek-or-scan/"&gt;h&amp;auml;r&lt;/a&gt;.&amp;nbsp;Sammanfattningsvis handlar det om att skapa r&amp;auml;tt index och bara f&amp;ouml;r att det g&amp;aring;r att indexera allt betyder det inte att man skall g&amp;ouml;ra det. Dessutom anv&amp;auml;nda de m&amp;ouml;jlighet som finns i de olika SQL Server versionerna:&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;Nonclustered index (alla versioner)&lt;/li&gt;&#xD;
&lt;li&gt;Indexed views (SQL Server 2000)&lt;/li&gt;&#xD;
&lt;li&gt;Included columns (SQL Server 2005)&lt;/li&gt;&#xD;
&lt;li&gt;Filtered indexes (SQL Server 2008)&lt;/li&gt;&#xD;
&lt;li&gt;Filtered statistics (SQL Server 2008)&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;En mycket bra start allts&amp;aring; p&amp;aring; denna konferens som idag forts&amp;auml;tter med heldagssessioner.&lt;/p&gt;</description><a10:updated>2013-04-08T13:49:23Z</a10:updated></item><item><guid isPermaLink="false">f796c7ed-0bbb-485d-ab6d-c3d9ddd3557c</guid><link>http://sqlservice.se/sv/start/blogg/snart-dags-for-sqlintersection.aspx?lang=sv</link><title>Snart dags för SQLIntersection</title><description>&lt;p&gt;Redan i morgon startar SQLIntersection som vi skrivit om tidigare och som man kan l&amp;auml;sa mer om &lt;a href="http://www.sqlskills.com/blogs/kimberly/"&gt;h&amp;auml;r&lt;/a&gt;, med tv&amp;aring; dagar heldagssessioner. Sedan forts&amp;auml;tter det med 3 fullsp&amp;auml;ckade sessionsdagar innan det avslutas med en heldagssession p&amp;aring; fredag. Det &amp;auml;r f&amp;ouml;rsta g&amp;aring;ngen som SQLIntersection h&amp;aring;lls och det &amp;auml;r idel bra talare. Skall ocks&amp;aring; bli sp&amp;auml;nnande att bl a se hur konceptet med v&amp;auml;rdar med v&amp;auml;rdar f&amp;ouml;r de olika sessionerna fungerar. Kimberly Tripp, Brent Ozar och Aaron Bertrand &amp;auml;r de som h&amp;aring;ller i olika sp&amp;aring;ren.&lt;/p&gt;&#xD;
&lt;p&gt;Mer om agendan hittar ni &lt;a href="http://devintersection.com/shows/images/schedulepdfs/Sp2013_SQL%20Sched_v13.pdf"&gt;h&amp;auml;r&lt;/a&gt;.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-04-06T20:28:55Z</a10:updated></item><item><guid isPermaLink="false">d58ec720-d666-4da8-9861-02185d7eea55</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-link-tip.aspx?lang=sv</link><title>SQL Server link tip</title><description>&lt;p&gt;Today I stumbled over a nice list of documented and undocumented DBCC commands. I verified the content against SQL Server 2012, and unfortunately it seems that a lot of the output has been removed, even if the commands still exsist. The list can be found &lt;a href="http://www.novicksoftware.com/tipsandtricks/tip-sql-dbcc-help.htm"&gt;here&lt;/a&gt;, but PLEASE be careful, and don't use DBCC commands that you are not 100% familiar with, on your production systems!&lt;/p&gt;</description><a10:updated>2013-04-05T15:26:47Z</a10:updated></item><item><guid isPermaLink="false">c66cd9f1-22f5-4333-a7fc-d57299fe751c</guid><link>http://sqlservice.se/sv/start/blogg/monitoring-sql-server,-your-own-way.aspx?lang=sv</link><title>Monitoring SQL Server, your own way</title><description>&lt;p&gt;When you think about monitoring SQL Server instances, you probably often think about monitoring that the service is up, performance, security and such.&lt;/p&gt;&#xD;
&lt;p&gt;But just as important in many cases is to monitor some specific part of you most critical systems. For example, how many rows are in a particular table, if a specific job takes too long to run or if a certain process is blocked. That is something that you cannot do out of the box in most monitoring systems. You could of course write specific scripts for it, depending on what tool you use for monitoring. But there is one way that works with most if not all monitoring tools, and that is to use the user settable performance monitor counters.&lt;/p&gt;&#xD;
&lt;p&gt;You have 10 counters to use, and it's quite easy. all you do is execute a stored procedure and use the value you want to expose to the performance counter as a parameter:&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;-- Set the value of user counter 1 to 5&#xD;
exec sp_user_counter1 5&#xD;
--The performance counter will now show 5&lt;/pre&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;More information here: &lt;a href="http://msdn.microsoft.com/en-US/library/ms187480(v=sql.110).aspx"&gt;http://msdn.microsoft.com/en-US/library/ms187480(v=sql.110).aspx&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2013-03-30T10:27:43Z</a10:updated></item><item><guid isPermaLink="false">49f1de52-e7cc-4a17-bc71-c4a8056f1fa7</guid><link>http://sqlservice.se/sv/start/blogg/ny-uppdatering-for-sql-server-2012-sp1.aspx?lang=sv</link><title>Ny uppdatering för SQL Server 2012 SP1</title><description>&lt;p&gt;Sedan f&amp;ouml;rra veckan finns en ny uppdatering f&amp;ouml;r SQL Server 2012 SP1. Vi har nu kommit till uppdatering nummer 3 som allts&amp;aring; inneh&amp;aring;ller alla f&amp;ouml;rb&amp;auml;ttringar sedan service pack 1.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Denna uppdatering inneh&amp;aring;ller ovanligt m&amp;aring;nga r&amp;auml;ttningar, n&amp;auml;stan 40 stycken. Nedan f&amp;ouml;ljer n&amp;aring;gra av dessa:&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;FIX: Poor performance in SQL Server 2012 when you run a SQL Server trace&lt;/li&gt;&#xD;
&lt;li&gt;FIX: CPU spike when there is no load on a server after you install SQL Server 2012 on the server&lt;/li&gt;&#xD;
&lt;li&gt;FIX: Error when you open a tabular model file in SQL Server 2012&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;Cumulative update package 3 for SQL Server 2012 SP1&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2812412"&gt;http://support.microsoft.com/kb/2812412&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Som vanligt g&amp;auml;ller det att alltid testa innan man g&amp;ouml;r f&amp;ouml;r&amp;auml;ndringar i sin produktionsmilj&amp;ouml;, men man b&amp;ouml;r alltid kontrollera vilka f&amp;ouml;rb&amp;auml;ttringar som gjorts i dessa uppdateringar, och vem vill inte ha l&amp;ouml;st dessa problem som man kan ha i sin SQL Server milj&amp;ouml; ?.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-03-25T06:24:21Z</a10:updated></item><item><guid isPermaLink="false">3dde2d4a-032e-4187-92f6-8dd8e8dda25f</guid><link>http://sqlservice.se/sv/start/blogg/mer-sql-server-pa-runas-radio.aspx?lang=sv</link><title>Mer SQL Server på RunAs Radio</title><description>&lt;p&gt;Som vi skrivit tidigare s&amp;aring; finns det utm&amp;auml;rkta m&amp;ouml;jlighet att l&amp;auml;ra sig mer om SQL Server p&amp;aring; denna informationskanal, som faktiskt inte enbart handlar om SQL Server. Som regel &amp;auml;r varje session p&amp;aring; dryga halvtimmen och senaste SQL Server sessionen &amp;auml;r denna som f&amp;ouml;rst&amp;aring;s handlar mycket om SQL Server 2012:&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;&lt;a href="http://www.runasradio.com/default.aspx?showNum=307%20%20"&gt;Robert Cain Gets Us Started with Business Intelligence &lt;/a&gt;&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;&amp;nbsp;Hela inneh&amp;aring;llet hittar ni &lt;a href="http://www.runasradio.com/archives.aspx"&gt;h&amp;auml;r&lt;/a&gt;.&lt;/p&gt;</description><a10:updated>2013-03-20T20:15:49Z</a10:updated></item><item><guid isPermaLink="false">f37515f0-aca7-46d9-ba94-38548a9b8667</guid><link>http://sqlservice.se/sv/start/blogg/hur-svart-kan-det-vara.aspx?lang=sv</link><title>Hur svårt kan det vara?</title><description>&lt;p&gt;Vi som jobbar med SQL Server &amp;auml;lskar verkligen produkten, f&amp;ouml;r det mesta. Men inte riktigt hela tiden. Det kan man ibland se p&amp;aring; &lt;a href="https://connect.microsoft.com/SQLServer/Feedback"&gt;Connect&lt;/a&gt; till exempel. Connect &amp;auml;r Microsofts website f&amp;ouml;r feedback fr&amp;aring;n kunder p&amp;aring; olika produkter, till exempel SQL Server. Och &amp;auml;ven om vi f&amp;ouml;rst&amp;aring;r att fel finns i programvaror, och att det ibland ka ta tid att fixa, s&amp;aring; &amp;auml;r det s&amp;aring; att ibland tar det orimligt l&amp;aring;ng tid.&lt;/p&gt;&#xD;
&lt;p&gt;Exempel: F&amp;ouml;r n&amp;auml;sta 5 &amp;aring;r sedan beg&amp;auml;rdes en f&amp;ouml;rb&amp;auml;ttring av informationen kopplad till felmeddelandet&amp;nbsp;"String or binary data would be truncated", och det &amp;auml;r det &amp;auml;rende som har flest r&amp;ouml;ster idag p&amp;aring; Connect. Men det &amp;auml;r fortfarande inte l&amp;ouml;st&amp;nbsp;(L&amp;auml;s mer h&amp;auml;r: &lt;a href="https://connect.microsoft.com/SQLServer/feedback/details/339410/please-fix-the-string-or-binary-data-would-be-truncated-message-to-give-the-column-name"&gt;https://connect.microsoft.com/SQLServer/feedback/details/339410/please-fix-the-string-or-binary-data-would-be-truncated-message-to-give-the-column-name&lt;/a&gt;)&lt;/p&gt;&#xD;
&lt;p&gt;Men&amp;nbsp;jag tycker att Connect &amp;auml;r ett bra initiaitv av Microsoft, och tittar&amp;nbsp;man p&amp;aring; antal l&amp;ouml;sta &amp;auml;renden ("Korrigerade", men &amp;auml;ven "Korrigeras inte"&amp;nbsp;och "Kan ej &amp;aring;terskapas" r&amp;auml;knas som l&amp;ouml;sta) s&amp;aring; &amp;auml;r det ca 18.600 styck vilket visar p&amp;aring; ett stort engagemang b&amp;aring;de fr&amp;aring;n oss kunder och fr&amp;aring;n Microsoft :-)&lt;/p&gt;</description><a10:updated>2013-03-17T20:38:00Z</a10:updated></item><item><guid isPermaLink="false">6cb45268-4e2f-46df-97a3-3342aba40030</guid><link>http://sqlservice.se/sv/start/blogg/kortet-som-satter-fart-pa-sql-server.aspx?lang=sv</link><title>Kortet som sätter fart på SQL Server</title><description>&lt;p&gt;"G&amp;aring;r f&amp;ouml;retagets SQL Server-databas lite tr&amp;ouml;gt? D&amp;aring; kan det kanske vara l&amp;auml;ge att piska upp farten med hj&amp;auml;lp av OCZ:s nya accelerationskort." &lt;a href="http://techworld.idg.se/2.2524/1.496539/kortet-som-satter-fart-pa-sql-server"&gt;http://techworld.idg.se/2.2524/1.496539/kortet-som-satter-fart-pa-sql-server&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Visst &amp;auml;r det bra om man f&amp;aring;r fart p&amp;aring; sin SQL Server milj&amp;ouml;. Dock &amp;auml;r ju fakta att man i de allra flesta fall kan f&amp;aring; det &amp;auml;ven utan att uppgradera sin h&amp;aring;rdvara. Det &amp;auml;r r&amp;auml;tt ovanligt att vi m&amp;ouml;ter s&amp;aring;dana milj&amp;ouml;er d&amp;auml;r det enda som &amp;aring;terst&amp;aring;r &amp;auml;r att uppgradera sin h&amp;aring;rdvara. Skall hur som helst blir sp&amp;auml;nnade f&amp;ouml;lja detta kort :-)&lt;/p&gt;</description><a10:updated>2013-03-15T21:00:35Z</a10:updated></item><item><guid isPermaLink="false">fba7fb35-bd53-4a60-9dd6-bbb4431bf2aa</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-edition-features.aspx?lang=sv</link><title>SQL Server Edition Features</title><description>&lt;p&gt;Har ni precis som jag st&amp;auml;llt er f&amp;ouml;ljande fr&amp;aring;gor n&amp;aring;gon g&amp;aring;ng?&lt;/p&gt;&#xD;
&lt;p&gt;Tex: &lt;br /&gt;M&amp;aring;ste man ha Enterprise Edition f&amp;ouml;r att k&amp;ouml;ra MERGE kommandot? &amp;nbsp;&lt;br /&gt;Svar: Nej, den finns till och med i Express Edition&lt;/p&gt;&#xD;
&lt;p&gt;Hur m&amp;aring;nga instanser kan man installera av SQL Server p&amp;aring; en och samma h&amp;aring;rdvara? &amp;nbsp;&lt;br /&gt;Svar: 50 st, g&amp;auml;ller alla editions&lt;/p&gt;&#xD;
&lt;p&gt;&amp;Auml;r Change Tracking en Enterprise Edition feature? &amp;nbsp;&lt;br /&gt;Svar: Nej, &amp;auml;ven den finns i alla editions&lt;/p&gt;&#xD;
&lt;p&gt;S&amp;aring; finner ni svaren p&amp;aring; detta och mycket mer h&amp;auml;r: &lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc645993.aspx"&gt;http://msdn.microsoft.com/en-us/library/cc645993.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Kanske har ni &amp;auml;ven haft funderingar p&amp;aring; hur mycket SQL Server klarar av i olika avseenden?&lt;/p&gt;&#xD;
&lt;p&gt;Tex: Hur m&amp;aring;nga kolumner kan jag ha i ett och samma SELECT statement? &amp;nbsp;&lt;br /&gt;Svar: 4096&lt;/p&gt;&#xD;
&lt;p&gt;Vad &amp;auml;r max antal filer i en databas? &amp;nbsp;&lt;br /&gt;Svar: 32767&lt;/p&gt;&#xD;
&lt;p&gt;Vad &amp;auml;r max antal parametrar i en Stored Procedure? &amp;nbsp;&lt;br /&gt;Svar: 2100&lt;/p&gt;&#xD;
&lt;p&gt;S&amp;aring; finner ni svaren p&amp;aring; detta och mycket mer h&amp;auml;r: &lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms143432.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms143432.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;br /&gt;B&amp;aring;da l&amp;auml;nkar g&amp;auml;ller SQL Server 2012.&lt;/p&gt;</description><a10:updated>2013-03-15T14:07:32Z</a10:updated></item><item><guid isPermaLink="false">39983df4-95e8-4b3b-9043-23cef6ed42ee</guid><link>http://sqlservice.se/sv/start/blogg/sql-learning-resources--msbi-academy.aspx?lang=sv</link><title>SQL Learning resources : MSBI Academy</title><description>&lt;p&gt;Recently I found a nice learning resource for Microsoft BI tools : &lt;a href="http://msbiacademy.com"&gt;http://msbiacademy.com&lt;/a&gt;&amp;nbsp;Here you will find a lot of videos that will cover&amp;nbsp;how to do something that MS BI practitioners need to know.&amp;nbsp;The videos are aproximate no more than 10 minutes each for&amp;nbsp;a&amp;nbsp;specific topic.&lt;/p&gt;&#xD;
&lt;p&gt;There is also a Windows 8 app that you can download from the&amp;nbsp;Windows Store&amp;nbsp;to view the content&lt;/p&gt;&#xD;
&lt;p&gt;The site is created by Rob Kerr.&amp;nbsp;&amp;nbsp;He is&amp;nbsp;a SQL Server MVP and is passionate&amp;nbsp;about helping people use information to make their&amp;nbsp;work a lot easier.&amp;nbsp;&amp;nbsp;He has used Microsoft databases and development tools since he first wrote Microsoft BASIC code to store customer information for&amp;nbsp;his family business at the age of 13.&lt;/p&gt;&#xD;
&lt;p&gt;Thank you Rob!&lt;/p&gt;</description><a10:updated>2013-03-11T13:53:45Z</a10:updated></item><item><guid isPermaLink="false">3dd0c6e5-6ff2-4865-a2e3-1fe1378fb11f</guid><link>http://sqlservice.se/sv/start/blogg/microsoft-sql-server-data-tools--business-intelligence-for-visual-studio-2012.aspx?lang=sv</link><title>Microsoft SQL Server Data Tools - Business Intelligence for Visual Studio 2012</title><description>&lt;p&gt;In the 5th of March 2013, Microsoft released Microsoft SQL Server Data Tools - Business Intelligence for Visual Studio 2012. Download it from : &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=36843"&gt;http://www.microsoft.com/en-us/download/details.aspx?id=36843&lt;/a&gt;&amp;nbsp;&lt;br /&gt;This will give you Microsoft SQL Server Business Intelligence projects for Analysis Services, Integration Services, and Reporting Services support in&amp;nbsp;Visual Studio 2012.&lt;/p&gt;&#xD;
&lt;p&gt;If you like to know more about SQL server 2012, feel free to contact us at SQL Service.&lt;/p&gt;</description><a10:updated>2013-03-08T13:50:27Z</a10:updated></item><item><guid isPermaLink="false">bc1f925c-3b83-4119-a721-522bf6291665</guid><link>http://sqlservice.se/sv/start/blogg/generate-insert-statements.aspx?lang=sv</link><title>Generate Insert Statements</title><description>&lt;p&gt;Ok, i might be the last person on earth to know about this but here it goes:&lt;/p&gt;&#xD;
&lt;p&gt;The other day a customer approached me with a question: "Is there a way to generate insert statements, with the data included, for a specific table ?" &lt;br /&gt;My immediate thought was that surely Management Studio incorporates this kind of functionality.&lt;/p&gt;&#xD;
&lt;p&gt;I started to right click on a table just to see what options there are.&lt;br /&gt;Immediately i saw: Script Table as -&amp;gt; Insert To -&amp;gt; New Query Editor Window... &lt;br /&gt;Alright here we go, another - soon to be, satisfied customer! &lt;br /&gt;Well, not really...what i got was an insert statement with all the columns -&amp;nbsp;INSERT INTO Table(Columns) VALUES(Columns), not the data.&lt;/p&gt;&#xD;
&lt;p&gt;So back to square one, regroup, rethink...&lt;/p&gt;&#xD;
&lt;p&gt;Next thing that came to mind was right click on the database -&amp;gt; Tasks -&amp;gt; Generate Scripts...&lt;/p&gt;&#xD;
&lt;p&gt;Another wizard starts. Here i chose to script a specific table and click next. In the next step in the wizard there is a button - "Advanced" which shows us the Advanced Scripting Options. &lt;br /&gt;Here i finally found what i was looking for: In "Types of data to script" i can choose: "Schema and data" which was exactly what i was looking for.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=3c3eafa6-a12b-4ef4-8d01-e5148da1c604&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;I finish the wizard and script the result to a new query window. And there is was, exactly as i wanted. Insert statements for every row in the table WITH the data.&lt;/p&gt;&#xD;
&lt;p&gt;There we go, another happy customer!&lt;/p&gt;</description><a10:updated>2013-03-08T09:03:38Z</a10:updated></item><item><guid isPermaLink="false">d0997742-78f3-48fc-9c30-998a55d8cce3</guid><link>http://sqlservice.se/sv/start/blogg/check-instant-file-initialization.aspx?lang=sv</link><title>Check instant file initialization</title><description>&lt;p&gt;Som vi skrivit om tidigare&amp;nbsp;s&amp;aring; finns det m&amp;ouml;jlighet att slippa den tid det tar f&amp;ouml;r datafilen att v&amp;auml;xa genom att skippa den sk nollutfyllnaden. Detta kan man l&amp;auml;sa mer om i detta inl&amp;auml;gg: &lt;a href="http://www.sqlservice.se/sv/start/blogg/instant-file-initialization.aspx"&gt;http://www.sqlservice.se/sv/start/blogg/instant-file-initialization.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Om man verkligen vill kontrollera om detta fungerar och om det &amp;auml;r n&amp;ouml;dv&amp;auml;ndigt att g&amp;ouml;ra n&amp;aring;gra f&amp;ouml;r&amp;auml;ndringar, dvs man &amp;auml;r os&amp;auml;ker om det fungerar med nuvarande inst&amp;auml;llningar &amp;auml;r fr&amp;aring;gan "Hur vet man det". Jo, genom att sl&amp;aring; p&amp;aring; traceflaggorna 3004 och 3605,&amp;nbsp; skapa en testdatabas, sl&amp;aring; av traceflaggorna och ta bort databasen. D&amp;auml;refter kontrollerar man SQL Servers senaste errorlog och i b&amp;ouml;rjan av densamme ser man hur detta fungerar.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=b7ab7e32-906e-4900-a8ac-15f83b2408ef&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;H&amp;auml;r ser man att den sk nollutfyllnaden av datafilen mdf&amp;nbsp;instr&amp;auml;ffar och detta g&amp;aring;r allts&amp;aring; att undvika och som man f&amp;ouml;rst&amp;aring;s b&amp;ouml;r fixa av de orsaker som Janne skriver om i l&amp;auml;nken.&amp;nbsp; I n&amp;auml;sta bild ser&amp;nbsp;vi att de gulmarkeraderna nu saknas. D&amp;auml;remot kan man inte undvika att nollutfyllnad sker av loggfilerna.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=ac39beb6-3119-4458-abb2-e1c5a387ceb6&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;SQL koden f&amp;ouml;r att testa detta &amp;auml;r denna:&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;USE master; &#xD;
&#xD;
--Sl&amp;aring; p&amp;aring; traceflaggorna 3004 och 3605&#xD;
DBCC TRACEON(3004, 3605, -1);&#xD;
&#xD;
-- Skapa en testdatabas &#xD;
CREATE DATABASE TestDB ON  PRIMARY&#xD;
	(NAME = N'TestDB', &#xD;
		FILENAME = N'C:\Temp\TestDB.mdf', SIZE = 5MB) &#xD;
	LOG ON( NAME = N'TestDB_log', &#xD;
		FILENAME = N'C:\Temp\TestDB_log.ldf', SIZE = 2MB) &#xD;
	&#xD;
-- Sl&amp;aring; av de tv&amp;aring; traceflaggorna&#xD;
DBCC TRACEOFF(3004,3605,-1); &#xD;
&#xD;
--Ta bort databasen&#xD;
DROP DATABASE TestDB;&#xD;
&lt;/pre&gt;</description><a10:updated>2013-03-07T19:57:38Z</a10:updated></item><item><guid isPermaLink="false">650cd577-ebb8-4b62-94eb-fe2228a9aa3a</guid><link>http://sqlservice.se/sv/start/blogg/query-the-server-error-log.aspx?lang=sv</link><title>Query the Server Error Log</title><description>&lt;p&gt;If you would like to query the ERRORLOG with T-SQL you have the undocumented procedure SP_READERRORLOG. But as it's a procedure filteriung the result may be a bit hard.&lt;/p&gt;&#xD;
&lt;p&gt;By using a table variable it becomes much easier:&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;&lt;span style="color: #ff6600; background-color: #ffffff;"&gt;DECLARE @errorlog TABLE ( LogDate datetime, ProcessInfo varchar(max), LogText varchar(max) ) INSERT INTO @errorlog EXEC sp_readerrorlog SELECT * FROM @errorlog&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre class="prettyprint"&gt;Just add any where-clause and start finding the records you're interested in.&lt;/pre&gt;</description><a10:updated>2013-03-06T17:58:37Z</a10:updated></item><item><guid isPermaLink="false">048d7a51-d16b-41ae-a5c2-09d1c05bce77</guid><link>http://sqlservice.se/sv/start/blogg/nagra-bra-installningar-efter-installation-av-sql-server-2012.aspx?lang=sv</link><title>Några bra inställningar efter installation av SQL Server 2012</title><description>&lt;p&gt;N&amp;auml;r man installerar SQL Server finns det n&amp;aring;gra bra att g&amp;ouml;ra inst&amp;auml;llningar.&lt;/p&gt;&#xD;
&lt;p&gt;Dels minimum och maximum memory, standardv&amp;auml;rdet &amp;auml;r 0 MB&amp;nbsp;som minimum och 2147483647 MB, dvs 2 PB, som maximum. Jag brukar alltid reservera ett minimum och maximum baserat p&amp;aring; m&amp;auml;ngden RAM servern har. Om min server har upp till 4GB RAM s&amp;auml;tter jag 1024 MB som minimum och 3072 MB&amp;nbsp;som maximum, dvs l&amp;auml;mnar 1 GB till operativsystemet. 4-16 GB RAM, ja d&amp;aring; s&amp;auml;tter jag min till 2048 och max till 14336, dvs l&amp;auml;mna 2 GB till operativsystemnet. Med 16GB eller mer s&amp;aring; l&amp;auml;mnar jag 4 GB RAM till operativsystemet. Om jag har fler instanser av SQL Server Database Engine eller andra tj&amp;auml;nster m&amp;aring;ste jag minska max v&amp;auml;rdet f&amp;ouml;r att inte &amp;ouml;verallockera fysiskt RAM-minne.&lt;/p&gt;&#xD;
&lt;p&gt;Maximum degree of parallellism &amp;auml;r ocks&amp;aring; ett v&amp;auml;rde som kan vara bra att konfigurera, generellt f&amp;ouml;r ett OLTP-system kan man s&amp;auml;tta MAXDOP till 1. Dvs st&amp;auml;nga av parallellism, detta d&amp;aring; OLTP operationer s&amp;auml;llan drar nytta av parallellism, i ett OLTP-system kan till och med parallellism vara till nackdel. Detta beror dock p&amp;aring; hur databasen &amp;auml;r indexerad och hur fr&amp;aring;gorna ser ut. Upplever man ober&amp;auml;knelig locking p g a parallellism kan man prova att s&amp;auml;tta detta v&amp;auml;rde till 1. I Data Warehouses d&amp;auml;remot &amp;auml;r parallellism ofta en f&amp;ouml;rdel d&amp;aring; det till st&amp;ouml;rsta delen &amp;auml;r l&amp;auml;sl&amp;aring;s som &amp;auml;r delade, och d&amp;aring; riskerar man inte att man l&amp;aring;ser sig sj&amp;auml;lv.&lt;/p&gt;&#xD;
&lt;p&gt;Nu finns det mer bakom dessa v&amp;auml;rden som man b&amp;ouml;r t&amp;auml;nka p&amp;aring;, det jag n&amp;auml;mnt h&amp;auml;r &amp;auml;r bara n&amp;aring;gra bra att s&amp;auml;tta v&amp;auml;rden p&amp;aring; ett dedikerat och nyinstallerat system. Givetvis m&amp;aring;ste man m&amp;auml;ta belastningen p&amp;aring; servern och justera dessa och fler v&amp;auml;rden s&amp;aring; att servern fungerar optimalt. Visste du att vi p&amp;aring; SQL Service Nordic AB har flera bra produkter f&amp;ouml;r att hj&amp;auml;lpa Er hitta den mest optimala konfigurationen f&amp;ouml;r Er databasserver och databas.&lt;/p&gt;&#xD;
&lt;p&gt;Ha det bra tills n&amp;auml;sta g&amp;aring;ng!&lt;/p&gt;&#xD;
&lt;p&gt;/Mattias&lt;/p&gt;</description><a10:updated>2013-03-06T16:10:40Z</a10:updated></item><item><guid isPermaLink="false">da359f0b-3594-47d4-b993-97807f627e6a</guid><link>http://sqlservice.se/sv/start/blogg/fun-with-sql-server-sys-messages.aspx?lang=sv</link><title>Fun with SQL Server sys.messages</title><description>&lt;p&gt;Sometimes I like to poke around inside SQL Server just for fun. Today I looked at the differences between SQL Server 2008R2 and SQL Server 2012 errormessages, located in sys.messages. I used the following query:&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;SELECT * FROM sys.messages WHERE language_id = 1033&#xD;
AND message_id NOT IN(SELECT message_id FROM [localhost\sql2008r2].MASTER.sys.messages WHERE language_id = 1033)&lt;/pre&gt;&#xD;
&lt;p&gt;That gave me 1616 rows back, but I suspect that some of these errormessages are not really new in SQL 2012, but rater have a new message_id. But, there are plenty of interesting messages left anyway, giving insight to functionality and maybe giving ideas.&amp;nbsp; Many of the are related to SQL Azure, and are probably present because SQL Server and SQL Azure shares the same codebase.&lt;/p&gt;&#xD;
&lt;p&gt;Here are some that indicates that SQL Azure might have been called CloudDB internally:&lt;/p&gt;&#xD;
&lt;p&gt;(Columns are: message_id, language,severity, is_event_logged and text)&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;35412	1033	16	0	CloudDB Async Transport&#xD;
35413	1033	16	0	CloudDB Async Transport Forwarder&#xD;
40147	1033	16	0	Stored procedure '%.*ls' is only for CloudDB.&#xD;
40166	1033	16	0	A CloudDB reconfiguration is going on and all new user transactions are aborted. &#xD;
40167	1033	21	1	A paired CloudDB fabric node failed and database %d must be shutdown. &#xD;
40572	1033	16	0	Cannot obtain primary partition lock for CloudDB auto partition upgrade.&#xD;
40573	1033	16	0	Cannot upgrade CloudDB auto partitions in database '%.*ls' because the physical database is read only.&#xD;
&lt;/pre&gt;&#xD;
&lt;p&gt;Here are some some more samples:&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;687	1033	16	0	Cannot compress a nchar or nvarchar column that has an odd number of bytes.&#xD;
1482	1033	10	0	Database mirroring failed to get snapshot synchrinization lock.&#xD;
1793	1033	16	0	Cannot federate a temporary table.&#xD;
1795	1033	16	0	Nullable column '%.*ls' cannot be used to federate the table '%.*ls'.&#xD;
1796	1033	16	0	Computed column '%.*ls' cannot be used to federate the table '%.*ls'.&#xD;
1797	1033	16	0	Sparse column '%.*ls' cannot be used to federate the table '%.*ls'.&#xD;
1798	1033	16	0	Federated tables cannot be created in a non-federated database.&#xD;
1799	1033	16	0	Column '%.*ls' cannot be used to federate the table '%.*ls' because it does not match the federation key type.&#xD;
1841	1033	16	0	CREATE DATABASE failed. CONTAINMENT clause cannot be used with the FOR ATTACH option.&#xD;
4190	1033	16	0	PIVOT operator is not allowed in the recursive part of a recursive common table expression '%.*ls'.&#xD;
4194	1033	15	0	RANGE is only supported with UNBOUNDED and CURRENT ROW window frame delimiters.&#xD;
5287	1033	10	0	DBCC THROWERROR bypass exception. This is an informational message only. No user action is required.&#xD;
5284	1033	16	0	The replicated index '%.*ls' (object ID %d) and one or more of its clones do not contain the same rows.  &#xD;
5283	1033	10	0	The Cross Rowset check on columnstore index object ID %d, index ID %d, partition ID %I64d. Drop and recreate the columnstore index.&#xD;
5901	1033	16	0	One or more recovery units belonging to database '%.*ls' failed to generate a checkpoint. This is typically caused by lack of system resources such as disk or memory, or in some cases due to database corruption. Examine previous entries in the error log for more detailed information on this failure.&#xD;
8658	1033	17	0	Cannot start the columnstore index build because it requires at least %I64d KB, while the maximum memory grant is limited to %I64d KB per query in workload group '%ls' (%ld) and resource pool '%ls' (%ld). Retry after modifying columnstore index to contain fewer columns, or after increasing the maximum memory grant limit with Resource Governor.&#xD;
8659	1033	16	0	Cannot create the clustered index "%.*ls" on view "%.*ls" because for clustered indexes on aggregate views without GROUP BY, the only distribution option supported is DISTRIBUTION=NONE.&#xD;
8674	1033	16	0	The query processor is unable to produce a plan. The table '%.*ls' is unavailable because the heap is corrupted. Take the database offline to rebuild the table and heap, and then run the query processor again.&#xD;
8675	1033	17	1	A timeout occurred while waiting for remote memory resources to execute the query in resource pool '%ls' (%ld). Rerun the query.&#xD;
8676	1033	16	0	Invalid plan.&#xD;
10146	1033	16	0	Cannot create %S_MSG on the view '%.*ls' because it uses the SEMANTICSIMILARITYTABLE, SEMANTICKEYPHRASETABLE or SEMANTICSIMILARITYDETAILSTABLE function.&#xD;
10746	1033	15	0	The FORCESCAN hint is specified simultaneously with the FORCESEEK hint. Remove one of the hints and resubmit the query.&#xD;
10747	1033	15	0	The parameterized FORCESEEK hint cannot be simultaneously used with INDEX hints or a non-parameterized FORCESEEK hint on the same object. Use either INDEX hints and a non-parameterized FORCESEEK hint or use a parameterized FORCESEEK hint without INDEX hints for each table or view.&#xD;
10748	1033	15	0	There are multiple FORCESEEK hints specified on the same table or view. Remove the extra FORCESEEK hints and resubmit the query.&#xD;
10749	1033	15	0	The FORCESEEK hint cannot be used with index 0. Correct the index provided to the FORCESEEK hint and resubmit the query.&#xD;
10750	1033	15	0	The FORCESCAN hint cannot be used with more than one INDEX hint. Remove the extra INDEX hints and resubmit the query.&#xD;
12104	1033	15	0	ALTER DATABASE CURRENT failed because '%.*ls' is a system database. System databases cannot be altered by using the CURRENT keyword. Use the database name to alter a system database.&#xD;
33426	1033	16	0	INSERT, UPDATE, DELETE, or MERGE to FileTable '%.*ls' is not allowed inside a trigger on a FileTable.&#xD;
35217	1033	16	0	 The thread pool for AlwaysOn Availability Groups was unable to start a new worker thread because there are not enough available worker threads.  This may degrade AlwaysOn Availability Groups performance.  Use the "max worker threads" configuration option to increase number of allowable threads.&#xD;
35223	1033	16	0	Cannot add %d availability replica(s) to availability group '%.*ls'.  The availability group already contains %d replica(s), and the maximum number of replicas supported in an availability group is %d.&#xD;
35225	1033	16	0	Could not process the operation. The  instance of SQL Server is running under WOW64 (Windows 32-bit on Windows 64-bit), which does not support AlwaysOn Availability Groups.  Reinstall SQL Server in the native 64-bit edition, and re-enable AlwaysOn Availability Groups. Then, restart the SQL Server service, and retry the operation. For information about how to enable and disable AlwaysOn Availability Groups, see SQL Server Books Online.&#xD;
35226	1033	16	0	Could not process the operation.  AlwaysOn Availability Groups has not started because the instance of SQL Server is not running as a service. Restart the server instance as a service, and retry the operation.&#xD;
35239	1033	16	0	The ALTER DATABASE  SET HADR SUSPEND (or SET HADR RESUME) statement failed on database '%.*ls' of availability group '%.*ls''. Either the availability group does not contain the specified database, or the database has not joined the availability group, or the database has not yet started. Reenter the command after the database is online and has joined the availability group.'&#xD;
35260	1033	16	0	 During an attempted database recovery, an availability database manager was not found for database id %d with availability group ID %d and group database ID %ls.  Recovery was terminated. The most likely cause of this error is that the availability group manager is not running, but the cause could be a metadata error. Ensure that the availability group manager and the WSFC cluster are started, and retry the recovery operation.&#xD;
35261	1033	16	0	 Attempt to perform an AlwaysOn Availability Groups operation on a system database, '%ls', failed. System databases are not supported by AlwaysOn Availability Groups.&#xD;
35262	1033	17	1	Skipping the default startup of database '%.*ls' because the database belongs to an availability group (Group ID:  %d). The database will be started by the availability group. This is an informational message only. No user action is required.&#xD;
35263	1033	16	0	During the undo phase, a function call (%ls) to the primary replica returned an unexpected status (Code: %d). Check for a possible cause in the SQL Server error log for the primary replica. If an error occurred on the primary database, you might need to suspend the secondary database, fix the issue on the primary database, and then resume the database.&#xD;
35264	1033	10	0	AlwaysOn Availability Groups data movement for database '%.*ls' has been suspended for the following reason: "%S_MSG" (Source ID %d; Source string: '%.*ls'). To resume data movement on the database, you will need to resume the database manually. For information about how to resume an availability database, see SQL Server Books Online.&#xD;
35265	1033	10	0	AlwaysOn Availability Groups data movement for database '%.*ls' has been resumed. This is an informational message only. No user action is required.&#xD;
35266	1033	10	0	AlwaysOn Availability Groups connection with %S_MSG database established for %S_MSG database '%.*ls' on the availability replica with Replica ID: {%.8x-%.4x-%.4x-%.2x%.2x-%.2x%.2x%.2x%.2x%.2x%.2x}. This is an informational message only. No user action is required.&#xD;
35267	1033	10	0	AlwaysOn Availability Groups connection with %S_MSG database terminated for %S_MSG database '%.*ls' on the availability replica with Replica ID: {%.8x-%.4x-%.4x-%.2x%.2x-%.2x%.2x%.2x%.2x%.2x%.2x}. This is an informational message only. No user action is required.&#xD;
35301	1033	15	0	CREATE INDEX statement failed because a columnstore index cannot be unique. Create the columnstore index without the UNIQUE keyword or create a unique index without the COLUMNSTORE keyword.&#xD;
35302	1033	15	0	CREATE INDEX statement failed because specifying sort order (ASC or DESC) is not allowed when creating a columnstore index. Create the columnstore index without specifying a sort order.&#xD;
35305	1033	15	0	CREATE INDEX statement failed because a columnstore index cannot be created on a view. Consider creating a columnstore index on the base table or creating an index without the COLUMNSTORE keyword on the view.&#xD;
35307	1033	15	0	CREATE INDEX statement failed because column '%.*ls' on table '%.*ls' is a computed column and a columnstore index cannot be created on a computed column. Consider creating a nonclustered columnstore index on a subset of columns that does not include the column.&#xD;
35308	1033	15	0	CREATE INDEX statement failed because a columnstore index cannot be a filtered index. Consider creating a columnstore index without the predicate filter.&#xD;
35309	1033	15	0	CREATE INDEX statement failed because a columnstore index cannot be created on a sparse column. Consider creating a nonclustered columnstore index on a subset of columns that does not include any sparse columns.&#xD;
35311	1033	15	0	CREATE INDEX statement failed because a columnstore index cannot have included columns.   Create the columnstore index on the desired columns without specifying any included columns.&#xD;
35312	1033	15	0	CREATE INDEX statement failed because a columnstore index cannot be created on a column with filestream data. Consider creating a nonclustered columnstore index on a subset of columns that does not include any columns with filestream data.&#xD;
35313	1033	15	0	CREATE INDEX statement failed because specifying FILESTREAM_ON is not allowed when creating a columnstore index. Consider creating a columnstore index on columns without filestream data and omit the FILESTREAM_ON specification.&#xD;
35314	1033	15	0	CREATE INDEX statement failed because a columnstore index cannot be created on a column set. Consider creating a nonclustered columnstore index on a subset of columns in the table that does not contain a column set or any sparse columns.&#xD;
35315	1033	15	0	CREATE INDEX statement failed because a columnstore index cannot be created in this edition of SQL Server.   See Books Online for more details on feature support in different SQL Server editions.&#xD;
35316	1033	15	0	CREATE INDEX statement failed because a columnstore index must be partition-aligned with the base table. Create the columnstore index using the same partition function and same (or equivalent) partition scheme as the base table.  If the base table is not partitioned, create a nonpartitioned columnstore index.&#xD;
35317	1033	15	0	CREATE INDEX statement failed because specifying %S_MSG is not allowed when creating a columnstore index. Consider creating a columnstore index without specifying %S_MSG.&#xD;
35318	1033	15	0	CREATE INDEX statement failed because the %S_MSG option is not allowed when creating a columnstore index. Create the columnstore index without specifying the %S_MSG option.&#xD;
35320	1033	15	0	CREATE INDEX statement failed because specifying DATA_COMPRESSION is not allowed when creating a columnstore index. Consider creating a columnstore index without specifying DATA_COMPRESSION.  Columnstore indexes are always compressed automatically.&#xD;
35325	1033	15	0	ALTER TABLE statement failed because the definition of a column cannot be changed if the column is part of a columnstore index. Consider dropping the columnstore index, altering the column, then creating a new columnstore index.&#xD;
35326	1033	15	0	ALTER INDEX statement failed because a columnstore index cannot be reorganized. Reorganization of a columnstore index is not necessary.&#xD;
35327	1033	15	0	ALTER INDEX REBUILD statement failed because specifying %S_MSG is not allowed when rebuilding a columnstore index. Rebuild the columnstore index without specifying %S_MSG.&#xD;
35328	1033	15	0	ALTER INDEX REBUILD statement failed because the %S_MSG option is not allowed when rebuilding a columnstore index. Rebuild the columnstore index without specifying the %S_MSG option.&#xD;
35329	1033	15	0	ALTER INDEX REBUILD statement failed because specifying DATA_COMPRESSION is not allowed when rebuilding a columnstore index. Rebuild the columnstore index without specifying DATA_COMPRESSION.  Columnstore indexes are always compressed automatically.&#xD;
35330	1033	16	0	%S_MSG statement failed because data cannot be updated in a table with a columnstore index. Consider disabling the columnstore index before issuing the %S_MSG statement, then rebuilding the columnstore index after %S_MSG is complete.&#xD;
35334	1033	15	0	DBCC DBREINDEX failed because specifying FILLFACTOR is not allowed when creating or rebuilding a columnstore index. Rebuild the columnstore index without specifying FILLFACTOR.&#xD;
35336	1033	15	0	CREATE INDEX statement failed because specifying key list is missing when creating an index. Create the index with specifying key list .&#xD;
35337	1033	16	0	UPDATE STATISTICS failed because statistics cannot be updated on a columnstore index.  UPDATE STATISTICS is valid only when used with the STATS_STREAM option.&#xD;
35338	1033	16	0	Clustered columnstore index is not supported.&#xD;
35339	1033	16	0	Multiple nonclustered columnstore indexes are not supported.&#xD;
35340	1033	16	0	Conversion between columnstore index and relational index is not supported.&#xD;
35341	1033	16	0	CREATE INDEX statement failed. A columnstore index cannot include a decimal or numeric data type with a precision greater than 18.  Reduce the precision of column '%.*ls' to 18 or omit column '%.*ls'.&#xD;
35342	1033	16	0	CREATE INDEX statement failed. A columnstore index cannot include a datetimeoffset data type with a precision greater than 2. Reduce the precision of column '%.*ls' to 2 or omit column '%.*ls'.&#xD;
35343	1033	15	0	CREATE INDEX statement failed. Column '%.*ls'has a data type that cannot participate in a columnstore index. Omit column '%.*ls'.&#xD;
35344	1033	16	0	MERGE clause of ALTER PARTITION statement failed because two nonempty partitions containing a columnstore index cannot be merged. Consider disabling the columnstore index before issuing the ALTER PARTITION statement, then rebuilding the columnstore index after ALTER PARTITION is complete.&#xD;
35345	1033	16	0	MERGE clause of ALTER PARTITION statement failed because two partitions on different filegroups cannot be merged if either partition contains columnstore index data. Consider disabling the columnstore index before issuing the ALTER PARTITION statement, then rebuilding the columnstore index after ALTER PARTITION is complete.&#xD;
35346	1033	16	0	SPLIT clause of ALTER PARTITION statement failed because the partition is not empty.  Only empty partitions can be split in when a columnstore index exists on the table. Consider disabling the columnstore index before issuing the ALTER PARTITION statement, then rebuilding the columnstore index after ALTER PARTITION is complete.&#xD;
35347	1033	16	0	The stored procedure, sp_tableoption failed because a table with a nonclustered columnstore index cannot be altered to use vardecimal storage format. Consider dropping the columnstore index.&#xD;
35348	1033	16	0	CREATE INDEX statement failed because table '%.*ls' uses vardecimal storage format. A columnstore index cannot be created on a table using vardecimal storage. Consider rebuilding the table without vardecimal storage.&#xD;
35349	1033	16	0	TRUNCATE TABLE statement failed because table '%.*ls' has a columnstore index on it. A table with a columnstore index cannot be truncated. Consider dropping the columnstore index then truncating the table.&#xD;
35350	1033	16	0	CREATE INDEX statement failed because a columnstore index on a partitioned table must be partition-aligned with the base table. Consider dropping the columnstore index before creating a new clustered index.&#xD;
35351	1033	16	0	DROP INDEX statement failed because a columnstore index on a partitioned table must be partition-aligned with the base table (heap). Consider dropping the columnstore index before dropping a clustered index.&#xD;
35352	1033	16	0	%S_MSG statement failed because the operation cannot be performed online on a table with a columnstore index. Perform the operation without specifying the ONLINE option or drop (or disable) the columnstore index before performing the operation using the ONLINE option.&#xD;
35353	1033	16	0	%s cannot be enabled on a table with a columnstore index.  Consider dropping columnstore index '%s' on table '%s'.&#xD;
35354	1033	16	0	CREATE INDEX statement failed because a columnstore index cannot be created on a table enabled for %S_MSG.  Consider disabling %S_MSG and then creating the columnstore index.&#xD;
35355	1033	16	0	CREATE INDEX statement failed. Column '%.*ls' is either a primary key or a partitioning key that must be included, but a columnstore index cannot include a decimal or numeric data type with a precision greater than 18. Consider reducing the precision of column '%.*ls' to 18.&#xD;
35356	1033	16	0	CREATE INDEX statement failed. Column '%.*ls' is either a primary key or a partitioning key that must be included, but a columnstore index cannot include a datetimeoffset data type with a precision greater than 2. Consider reducing the precision of column '%.*ls' to 2.&#xD;
35357	1033	15	0	CREATE INDEX statement failed. Column '%.*ls' is either a primary key or a partitioning key that must be included, but '%.*ls'has a data type that cannot participate in a columnstore index.&#xD;
40014	1033	16	0	Multiple databases can not be used in the same transaction.&#xD;
40034	1033	16	0	CSN being added must be equal last CSN+1. The new CSN is (%d,%I64d), the current CSN is (%d,%I64d).&#xD;
40131	1033	16	0	Partition key type '%.*ls' is not supported. Only BIGINT, UNIQUEIDENTIFIER, and VARBINARY(n) (0&lt;/pre&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-03-03T15:34:59Z</a10:updated></item><item><guid isPermaLink="false">65b5edec-0106-46aa-95d7-5820d6ba191e</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-compression--don-t-loose-it.aspx?lang=sv</link><title>SQL Server compression - don't loose it</title><description>&lt;p&gt;If you are using the Enterprise Edition of SQL server 2008 or later, you have the option to use Data compression and it can be used to improve performance in some scenarios. It is easy to apply datacompression to an existing index. The script below rebuilds an existing index on Employee table in AdventureWorks:&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;ALTER INDEX [AK_Employee_rowguid] ON [HumanResources].[Employee] REBUILD PARTITION = ALL &#xD;
WITH (&#xD;
	PAD_INDEX = OFF, &#xD;
	STATISTICS_NORECOMPUTE = OFF, &#xD;
	SORT_IN_TEMPDB = OFF, &#xD;
	IGNORE_DUP_KEY = OFF, &#xD;
	ONLINE = OFF, &#xD;
	ALLOW_ROW_LOCKS = ON, &#xD;
	ALLOW_PAGE_LOCKS = ON, &#xD;
	DATA_COMPRESSION = PAGE)&#xD;
&lt;/pre&gt;&#xD;
&lt;p&gt;But&amp;nbsp;when you have applied&amp;nbsp;data compression, make sure&amp;nbsp;you don't&amp;nbsp;loose it by mistake. Lets say you wants to add another column to the index and&amp;nbsp;you right click the index and klick the menu &lt;strong&gt;Script Index /Drop and Create to / New Query Window, &lt;/strong&gt;and then you add your column to the create script and execute the query.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;img src="../ci.axd?sid=d732769a-c82e-4a1b-b2a2-7e51e8ae0612&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;If you are unlucky the compression is lost. Why? Well it has to to with an option in Management Studio. Click the menu &lt;strong&gt;Tools / Options&lt;/strong&gt;, scroll down to the "SQL Server object explorer" and look at the&amp;nbsp;"scripting" options. &amp;nbsp;The default setting for "Script Data Compression Options" is actually false! Change the setting to True and close the dialog.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;img src="../ci.axd?sid=c008a09a-56a5-4d0d-8ce2-c7fb9bd7d8fd&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;/H&amp;aring;kan Winther&lt;br /&gt;COO / Senior SQL Server consultant&lt;/p&gt;</description><a10:updated>2013-02-27T20:56:54Z</a10:updated></item><item><guid isPermaLink="false">29021d1f-18ae-4794-8f2f-69c239a77450</guid><link>http://sqlservice.se/sv/start/blogg/forslag-och-buggar-for-sql-server--i-microsoft-connect.aspx?lang=sv</link><title>Förslag och buggar för SQL Server  i Microsoft Connect</title><description>&lt;p&gt;Om du hittar en bugg eller kommer p&amp;aring; en ide p&amp;aring; hur SQL server kan bli &amp;auml;nnu b&amp;auml;ttre s&amp;aring; kan du logga in p&amp;aring; &lt;a href="http://connect.microsoft.com/"&gt;http://connect.microsoft.com/&lt;/a&gt;&amp;nbsp;och registerara din ide. Dessutom s&amp;aring; kan du &amp;auml;ven r&amp;ouml;sta p&amp;aring; andras f&amp;ouml;rslag eller buggrapporter. Ju fler r&amp;ouml;ster ett f&amp;ouml;rslag eller buggrapport f&amp;aring;r desto st&amp;ouml;rre &amp;auml;r chansen att Microsoft g&amp;ouml;r n&amp;aring;got av ditt connect item.&lt;/p&gt;&#xD;
&lt;p&gt;Personligen har jag rapporterat 3 st, g&amp;aring; g&amp;auml;rna in och r&amp;ouml;sta&amp;nbsp;p&amp;aring; dem:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="https://connect.microsoft.com/SQLServer/feedback/details/691085/plan-handle-for-the-last-execution-in-missing-index-dmv-s"&gt;https://connect.microsoft.com/SQLServer/feedback/details/691085/plan-handle-for-the-last-execution-in-missing-index-dmv-s&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="https://connect.microsoft.com/SQLServer/feedback/details/691081/add-sort-order-suggestions-to-missing-index-dmv"&gt;https://connect.microsoft.com/SQLServer/feedback/details/691081/add-sort-order-suggestions-to-missing-index-dmv&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="https://connect.microsoft.com/SQLServer/feedback/details/699153/window-for-new-index-should-contain-option-for-compression"&gt;https://connect.microsoft.com/SQLServer/feedback/details/699153/window-for-new-index-should-contain-option-for-compression&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;/H&amp;aring;kan Winther&lt;br /&gt;COO / Senior SQL server konsult&lt;br /&gt;Twitter: @h_winther&lt;/p&gt;</description><a10:updated>2013-02-27T20:27:58Z</a10:updated></item><item><guid isPermaLink="false">f0a44f68-8519-4a73-8f97-ef5af588daca</guid><link>http://sqlservice.se/sv/start/blogg/vardet-av-certifieringar.aspx?lang=sv</link><title>Värdet av certifieringar</title><description>&lt;p&gt;I rekryteringstider framf&amp;ouml;rallt, men &amp;auml;ven till vardags, &amp;auml;r certifiering p&amp;aring; Microsoft SQL Server hett och viktigt. Vi p&amp;aring; SQL Service tycker att certifiering &amp;auml;r viktigt och alla v&amp;aring;ra konsulter har aktuella certifieringar p&amp;aring; Microsoft SQL Server inklusive SQL Server 2012. Men vad betyder en certifiering?&lt;/p&gt;&#xD;
&lt;p&gt;Om man klarar ett certifieringsprov anses man kapabel att motsvara den kompetensrollen certifieringen motsvarar, vilket best&amp;aring;r av ett antal kompetensdom&amp;auml;ner med b&amp;aring;de praktiska och teoretiska m&amp;auml;tomr&amp;aring;den definerade av tillverkaren. Ja ja, men vad betyder d&amp;aring; en certifiering?&lt;/p&gt;&#xD;
&lt;p&gt;Att inneha en certifiering tillsammans med erfarenhet fr&amp;aring;n "verkligheten" &amp;auml;r en riktig guldklimp i och med att du med certifieringen kan visa att du teoretiskt motsvarar tillverkarens krav p&amp;aring; kompetens, och med erfarenheten kombinerat &amp;auml;ven kunna motsvara "verklighetens" krav p&amp;aring; kompetens. H&amp;auml;r p&amp;aring; SQL Service har vi v&amp;auml;l &amp;ouml;ver&amp;nbsp;hundra &amp;aring;rs samlad erfarenhet av SQL Server och vi &amp;auml;r certifierade.&lt;/p&gt;&#xD;
&lt;p&gt;F&amp;ouml;r att f&amp;ouml;rklara certifieringarna b&amp;ouml;rjar vi med ett enskilt certifieringsprov, en s&amp;aring; kallad MCP, Microsoft Certified Professional. Inom SQL Server 2012 finns f&amp;ouml;r n&amp;auml;rvarande nio examineringsprov varav tv&amp;aring; &amp;auml;r uppgraderingsprov p&amp;aring; tidigare certifiering. Klarar man ett prov &amp;auml;r man s&amp;aring;ledes MCP. Genom kombinationer av enskilda prov uppn&amp;aring;r man d&amp;auml;refter olika kompetensomr&amp;aring;den/-profiler.&lt;/p&gt;&#xD;
&lt;p&gt;MCSA, Microsoft Certified Solution Associate, &amp;auml;r grunden vilket &amp;auml;r t&amp;auml;nkt att vara en bred kompetensbas passande f&amp;ouml;r juniora konsulter. Den innefattar produkt&amp;ouml;versikt, implementation, drift och underh&amp;aring;ll av teknologien. F&amp;ouml;r SQL Server blir det s&amp;aring;ledes "&lt;a href="http://www.microsoft.com/learning/en/us/mcsa-sql-certification.aspx" target="_blank"&gt;MCSA: SQL Server 2012&lt;/a&gt;" och tre enskilda certifieringar.&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;&lt;a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-461" target="_blank"&gt;70-461: Querying Microsoft SQL Server 2012&lt;/a&gt;&lt;/li&gt;&#xD;
&lt;li&gt;&lt;a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-462" target="_blank"&gt;70-462: Administering Microsoft SQL Server 2012 Databases&lt;/a&gt;&lt;/li&gt;&#xD;
&lt;li&gt;&lt;a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-463"&gt;70-463: Implementing a Data Warehouse with Microsoft SQL Server 2012&lt;/a&gt;&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;MCSE, Microsoft Certified Solution Expert, &amp;auml;r p&amp;aring;byggnad av certifieringen MCSA och passar ypperligt f&amp;ouml;r seniora konsulter. H&amp;auml;r specialiserar man sig mer inom vissa teknologiska aspekter av produkten. Det innefattar bland annat mer detaljk&amp;auml;nnedom, djupare analyskunskap, vidare arkitekturella problemst&amp;auml;llningar och utveckling inom en smalare del av produkten. Inom Microsoft SQL Server 2012 finns det tv&amp;aring; huvudinriktningar, "&lt;a href="http://www.microsoft.com/learning/en/us/mcse-sql-data-platform.aspx" target="_blank"&gt;MCSE: Data Platform&lt;/a&gt;" och "&lt;a href="http://www.microsoft.com/learning/en/us/mcse-sql-business-intelligence.aspx" target="_blank"&gt;MCSE: Business Intelligence&lt;/a&gt;".&lt;/p&gt;&#xD;
&lt;p&gt;MCSE: Data Platform fokuserar mer p&amp;aring; databasadministrat&amp;ouml;rs och -utvecklarrollen och innefattar fr&amp;auml;mst kompetenser inom Database Engine, OLTP, datalager, utveckling, prestanda och optimering.&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;&lt;a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-464" target="_blank"&gt;70-464: Developing Microsoft SQL Server 2012 Databases&lt;/a&gt;&lt;/li&gt;&#xD;
&lt;li&gt;&lt;a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-465" target="_blank"&gt;70-465: Designing Database Solutions for SQL Server 2012&lt;/a&gt;&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;MCSE: Business Intelligence har sitt fokus inom BI och innefattar teknologier som Integration Services, Analysis Services och Reprting Services samt Data Quality Services, Master Data Services, PowerPIVOT, PowerView med mera.&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;&lt;a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-466" target="_blank"&gt;70-466: Implementing Data Models and Reports with Microsoft SQL Server 2012&lt;/a&gt;&lt;/li&gt;&#xD;
&lt;li&gt;&lt;a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-467"&gt;70-467: Designing Business Intelligence Solutions with Microsoft SQL Server 2012&lt;/a&gt;&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;Tidigare genom &amp;aring;ren har dessa certifieringar haft lite olika namn och f&amp;ouml;rkortningar som MCDBA "Microsoft Certified Database Administrator", MCTS "Microsoft Certified Technology Specialist"&amp;nbsp;och MCITP "Microsoft Certified Information Technology Professional". MCTS motsvarar i stort niv&amp;aring;n f&amp;ouml;r MCSA, och MCITP samt MCDBA motsvarar niv&amp;aring;n MCSE.&lt;/p&gt;&#xD;
&lt;p&gt;F&amp;ouml;r de som &amp;auml;r riktigt hard-core finns det &amp;auml;ven en certifiering som heter Microsoft Certified Solutions Master, MCSM. F&amp;ouml;r Microsoft SQL Server 2012 blir det s&amp;aring;ledes "&lt;a href="http://www.microsoft.com/learning/en/us/mcsm-sql-data-platform.aspx"&gt;MCSM: Data Platform&lt;/a&gt;", dock har dessa examineringar ej &amp;auml;nnu f&amp;auml;rdigutvecklats. Tills vidare &amp;auml;r det s&amp;aring;ledes dem motsvarande certifieringen Microsoft Certified Master, MCM, och d&amp;aring; p&amp;aring; Microsoft SQL Server 2008 som g&amp;auml;ller, "&lt;a href="http://www.microsoft.com/learning/en/us/mcm-certification.aspx" target="_blank"&gt;MCM: SQL Server 2008&lt;/a&gt;". F&amp;ouml;r att klara dessa examineringar m&amp;aring;ste man ha dokumenterad fler&amp;aring;rig erfarenhet av produkten och extremt djupa kunskaper. Examineringen best&amp;aring;r av tv&amp;aring; delar, dels en teoretiskt test "Knowledge Exam" och dels en verklighetsbaserad labb "Lab Exam" d&amp;auml;r verkliga case simuleras och du handgripligen ska genomf&amp;ouml;ra de b&amp;auml;sta, mest rationella&amp;nbsp;och mest kostnadseffektiva l&amp;ouml;sningarna p&amp;aring; problemen. Man m&amp;aring;ste f&amp;ouml;rst klara det teoretiska testet och d&amp;auml;refter v&amp;auml;nta minst en m&amp;aring;nad f&amp;ouml;r att testet ska r&amp;auml;ttas och po&amp;auml;ngs&amp;auml;ttas, d&amp;auml;refter f&amp;aring;r man boka labben som &amp;ouml;vervakas manuellt. Klarar man sedan den &amp;auml;r man del av en ytterst liten grupp v&amp;auml;rlden &amp;ouml;ver. Om du d&amp;auml;remot missar ett av proven m&amp;aring;ste du v&amp;auml;nta minst tre m&amp;aring;nader innan du f&amp;aring;r f&amp;ouml;rs&amp;ouml;ka igen.&lt;/p&gt;&#xD;
&lt;p&gt;Lite andra certifieringar och utm&amp;auml;rkelser v&amp;auml;rda att n&amp;auml;mna i sammanhanget &amp;auml;r MCT, Microsoft Certified Trainer, som &amp;auml;r ett krav att inneha f&amp;ouml;r att f&amp;aring; leverera officiella Microsoft-kurser. Detta &amp;auml;r mer av en ackreditering snarare &amp;auml;n en certifiering. F&amp;ouml;r att f&amp;aring; bli MCT m&amp;aring;ste man f&amp;ouml;rst och fr&amp;auml;mst ha expertniv&amp;aring;certifiering inom det produktomr&amp;aring;de man fokuserar p&amp;aring;, sedan m&amp;aring;ste man inneha en tillb&amp;ouml;rlig certifiering inom pedagogik. Det h&amp;auml;r &amp;auml;r en certifiering man m&amp;aring;ste f&amp;ouml;rnya varje &amp;aring;r och samtidigt bibeh&amp;aring;lla en tillr&amp;auml;cklig h&amp;ouml;g niv&amp;aring; av n&amp;ouml;jda kursdeltagare. N&amp;auml;r du g&amp;aring;r p&amp;aring; en officiell Microsoft-kurs m&amp;aring;ste utbildaren vara dels MCT och dels certifierad, dvs om kursen har en motsvarande certifiering m&amp;aring;ste &amp;auml;ven utbildaren &amp;auml;ven klarat den examineringen. MVP, eller Microsoft Most Valuable Professional, &amp;auml;r inte en certifiering utan en utm&amp;auml;rkelse man kan tilldelas. Normalt brukar det inneb&amp;auml;ra att man &amp;auml;r ytterst exeptionell inom en viss del av en produkt, man bloggar om det, svarar p&amp;aring; fr&amp;aring;gor p&amp;aring; allehanda forum om det, man talar p&amp;aring; konferenser och anv&amp;auml;ndarf&amp;ouml;reningsm&amp;ouml;ten om det, och om man g&amp;ouml;r det s&amp;aring; bra och till den utstr&amp;auml;ckning att det utm&amp;auml;rker sig &amp;ouml;ver m&amp;auml;ngden s&amp;aring; man blir nominerad till utm&amp;auml;rkelsen och d&amp;auml;refter en review av en board p&amp;aring; Microsoft blir tilldelad utm&amp;auml;rkelsen kan man k&amp;auml;nna sig hedrad av att&amp;nbsp;tillh&amp;ouml;ra en liten skara.&lt;/p&gt;&#xD;
&lt;p&gt;N&amp;aring;gra av de certifieringar och utm&amp;auml;rkelser du kan finna bland oss h&amp;auml;r p&amp;aring; SQL Service:&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;MCDBA: SQL Server 2000&lt;/li&gt;&#xD;
&lt;li&gt;MCTS: SQL Server 2005 Database Administrator&lt;/li&gt;&#xD;
&lt;li&gt;MCITP: SQL Server 2005&amp;nbsp;Database Administrator&lt;/li&gt;&#xD;
&lt;li&gt;MCTS: SQL Server 2005 Database Developer&lt;/li&gt;&#xD;
&lt;li&gt;MCITP: SQL Server 2005&amp;nbsp;Database Developer&lt;/li&gt;&#xD;
&lt;li&gt;MCTS: SQL Server 2005 Business Intelligence&lt;/li&gt;&#xD;
&lt;li&gt;MCITP: SQL Server 2005 Business Intelligence&lt;/li&gt;&#xD;
&lt;li&gt;MCTS: SQL Server 2008&lt;/li&gt;&#xD;
&lt;li&gt;MCITP: SQL Server 2008 Data Platform&lt;/li&gt;&#xD;
&lt;li&gt;MCITP: SQL Server 2008 Database Developer&lt;/li&gt;&#xD;
&lt;li&gt;MCITP: SQL Server 2008 Business Intelligence&lt;/li&gt;&#xD;
&lt;li&gt;MCSA: SQL Server 2008&lt;/li&gt;&#xD;
&lt;li&gt;MCSA: SQL Server 2012&lt;/li&gt;&#xD;
&lt;li&gt;MCSE: Data Platform&lt;/li&gt;&#xD;
&lt;li&gt;MCSE: Business Intelligence&lt;/li&gt;&#xD;
&lt;li&gt;MCT&lt;/li&gt;&#xD;
&lt;li&gt;MVP: SQL Server&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;Har du fr&amp;aring;gor ang&amp;aring;ende certifieringar eller kurser &amp;auml;r du v&amp;auml;lkommen att h&amp;ouml;ra av dig.&lt;/p&gt;&#xD;
&lt;p&gt;Ha det bara b&amp;auml;st s&amp;aring; l&amp;auml;nge!&lt;/p&gt;&#xD;
&lt;pre&gt;Mattias Lind&lt;/pre&gt;&#xD;
&lt;pre&gt;Consultant, Trainer, Mentor &amp;amp; Speaker&lt;/pre&gt;&#xD;
&lt;pre&gt;MVP | MCT | MCSE | MCSA | MCITP | MCTS | MCDBA&lt;/pre&gt;</description><a10:updated>2013-02-27T07:18:04Z</a10:updated></item><item><guid isPermaLink="false">e54b8bee-4c34-44bf-a02f-2acb6b99e161</guid><link>http://sqlservice.se/sv/start/blogg/ny-forbattring-av-sql-server-2012.aspx?lang=sv</link><title>Ny förbättring av SQL Server 2012</title><description>&lt;p&gt;&amp;Auml;ven f&amp;ouml;r SQL Server 2012 finns nu en ny uppdatering i och med att en sk kumulativ upppdatering sl&amp;auml;ppts. Dock g&amp;auml;ller denna inte f&amp;ouml;r SQL Server 2012 SP1. Vi har nu kommit till uppdatering nummer 6 som inneh&amp;aring;ller alla f&amp;ouml;rb&amp;auml;ttringar sedan lanseringen av SQL Server 2012, men som sagt g&amp;auml;ller inte denna f&amp;ouml;r service pack 1 av SQL Server 2012.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2728897"&gt;Cumulative update package 6 for SQL Server 2012&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-02-25T20:56:11Z</a10:updated></item><item><guid isPermaLink="false">05483ca3-7873-4e85-9057-e9e423ceef1f</guid><link>http://sqlservice.se/sv/start/blogg/nya-uppdateringar-for-sql-server-2008-r2.aspx?lang=sv</link><title>Nya uppdateringar för SQL Server 2008 R2</title><description>&lt;p&gt;Nu finns m&amp;ouml;jlighet att ladda ner nya f&amp;ouml;rb&amp;auml;ttringar f&amp;ouml;r SQL Server 2008 R2 i och med att nya sk kumulativa uppdateringar sl&amp;auml;ppts f&amp;ouml;r denna version.&lt;/p&gt;&#xD;
&lt;p&gt;Observera att dessa &amp;auml;r olika beroende p&amp;aring; vilken service pack man har installerat och man m&amp;aring;ste v&amp;auml;lja r&amp;auml;tt version. Om man av n&amp;aring;gon anledning inte vet vilken SQL Server version man har installerat kan man t.ex. anv&amp;auml;nda denna SQL kod:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;&amp;nbsp;SELECT @@VERSION&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2797460"&gt;Cumulative update package 5 for SQL Server 2008 R2 SP2&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2812683"&gt;Cumulative update package 11 for SQL Server 2008 R2 SP1 &lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Som vanligt g&amp;auml;ller det att alltid testa innan man g&amp;ouml;r f&amp;ouml;r&amp;auml;ndringar i sin produktionsmilj&amp;ouml;, men man b&amp;ouml;r alltid kontrollera vilka f&amp;ouml;rb&amp;auml;ttringar som g&amp;ouml;rs&amp;nbsp;i dessa uppdateringar.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-02-25T20:55:18Z</a10:updated></item><item><guid isPermaLink="false">ec2e809b-8419-4b2d-a92b-a89478852850</guid><link>http://sqlservice.se/sv/start/blogg/a-sql-azure-tip-a-day-(18)--my-laptop-is-faster-than-sql-azure-.aspx?lang=sv</link><title>A SQL Azure tip a day (18) - My Laptop is faster than SQL AZURE ?!?</title><description>&lt;p&gt;EDIT: Also read this blogpost: &lt;a href="../sv/start/blogg/sql-azure-followup.aspx"&gt;http://sqlservice.se/sv/start/blogg/sql-azure-followup.aspx&lt;/a&gt; , that gives more context to the findings in this post.&lt;/p&gt;&#xD;
&lt;p&gt;Today we will take a look at the INSERT speed of &lt;a href="https://www.windowsazure.com/"&gt;SQL Azure&lt;/a&gt;, compared to my laptop. So I did the following on both my &lt;a href="http://reviews.cnet.com/laptops/hp-envy-17/4505-3121_7-34112582.html"&gt;HP ENVY i5 Laptop &lt;/a&gt;and 1 internal spinning disc and SQL Server 2008 R2, and my SQL Azure Web edition database.&lt;/p&gt;&#xD;
&lt;p&gt;I created 2 tables with clustered indexes:&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;CREATE TABLE [dbo].[TableTest]( [Int_Col] [int] IDENTITY(1,1) NOT NULL, [Varchar_Col] [varchar](50) NOT NULL, [Datetime_Col] [datetime] NOT NULL, [GUID_Col] [uniqueidentifier] NOT NULL )&#xD;
&#xD;
ALTER TABLE [dbo].[TableTest] ADD  CONSTRAINT [DF_TableTest_Varchar_Col]  DEFAULT ('Varchar_Col') FOR [Varchar_Col] ALTER TABLE [dbo].[TableTest] ADD  CONSTRAINT [DF_TableTest_Datetime_Col]  DEFAULT (getdate()) FOR [Datetime_Col]&#xD;
&#xD;
ALTER TABLE [dbo].[TableTest] ADD  CONSTRAINT [DF_TableTest_GUID_Col]  DEFAULT (newid()) FOR [GUID_Col]&#xD;
&#xD;
GO&#xD;
&#xD;
CREATE CLUSTERED INDEX [ix_tabletest] ON [dbo].[TableTest] ( [GUID_Col] ASC )&#xD;
&#xD;
WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)&#xD;
&#xD;
GO&#xD;
&#xD;
CREATE TABLE [dbo].[results]&#xD;
&#xD;
( [GUID] [uniqueidentifier] NOT NULL, [test] [varchar](50) NULL, [starttime] [datetime2](7) NULL, [endtime] [datetime2](7) NULL, [rownr] [bigint] NULL, [Runtime_MS]  AS (datediff(millisecond,[starttime],[endtime])), [Rows_pr_ms]  AS (isnull(CONVERT([decimal],[rownr],0)/datediff(millisecond,[starttime],[endtime]),(0))) ) GO&#xD;
&#xD;
CREATE CLUSTERED INDEX [ix_results] ON [dbo].[results] ( [GUID] ASC )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) GO CREATE TABLE [dbo].[guidtbl]( [GUID] [uniqueidentifier] NOT NULL )&#xD;
&#xD;
CREATE CLUSTERED INDEX [ix_guidtbl] ON [dbo].[guidtbl] ( [GUID] ASC )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) GO&#xD;
&lt;/pre&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Then I created A stored proc:&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;create proc [dbo].[insert_test] @rows int as &#xD;
&#xD;
SET NOCOUNT ON &#xD;
&#xD;
SET STATISTICS IO OFF &#xD;
&#xD;
SET STATISTICS TIME OFF &#xD;
&#xD;
truncate table guidtbl &#xD;
&#xD;
insert guidtbl (GUID) Values (NEWID()) &#xD;
&#xD;
TRUNCATE TABLE [dbo].[TableTest] &#xD;
&#xD;
Declare @GUID uniqueidentifier &#xD;
&#xD;
select @GUID = guid from guidtbl &#xD;
&#xD;
Insert results ([GUID], test, starttime) values (@GUID, 'INSERT_Test', getdate()) &#xD;
&#xD;
declare @i int &#xD;
&#xD;
select @i = 0 while @i &amp;lt; @rows &#xD;
&#xD;
begin &#xD;
&#xD;
INSERT INTO [dbo].[TableTest] ([Varchar_Col] ,[Datetime_Col] ,[GUID_Col]) VALUES (default ,default ,default) &#xD;
&#xD;
select @i = @i + 1 &#xD;
&#xD;
end &#xD;
&#xD;
Update results set endtime = getdate() where test = 'Insert_Test' and endtime IS NULL &#xD;
&#xD;
DECLARE @rownr int &#xD;
&#xD;
select @rownr =  count(*) from TableTest update results set rownr =  @rownr where test = 'Insert_Test' and rownr IS NULL&#xD;
&#xD;
 GO&#xD;
&lt;/pre&gt;&#xD;
&lt;p&gt;&lt;strong&gt;And then I executed it:&lt;/strong&gt; exec dbo.insert_test 100000&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;The results?&lt;/strong&gt;&amp;nbsp; After a few testruns the results table looks like this on SQL AZURE: select&amp;nbsp; * from results &lt;a href="../wp-content/uploads/2012/01/sqlazure.png"&gt;&lt;img class="alignnone size-full wp-image-2849" title="sqlazure" src="../ci.axd?sid=87d9f033-6eea-4ecb-b6f6-d0cba45bf09a&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="932" height="170" /&gt;&lt;/a&gt; &lt;strong&gt;And the results table on my laptop:&lt;/strong&gt; select&amp;nbsp; * from results &lt;a href="../wp-content/uploads/2012/01/laptop.png"&gt;&lt;img class="alignnone size-full wp-image-2848" title="laptop" src="../ci.axd?sid=0e0a1780-ab90-4a48-a112-1fcb1486f281&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="940" height="171" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;The conclusion?&lt;/strong&gt; My Laptop is faster than SQL Azure! Atleast when it comes to pure INSERT performance.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;The reason?&lt;/strong&gt; Obviously I can&amp;rsquo;t be 100% sure about why. But having repeated the test on several other servers, I have reached the following conclusion: The INSERT performance problems in SQL AZURE is likely caused by the underlying IO subsystem, particularly on the drive that holds the logfile, and by the fact that you have&amp;nbsp;3 redundant copies of your database. Using&amp;nbsp;&lt;a href="../okategoriserade/a-sql-azure-tip-a-day-16-what-are-you-waiting-for/"&gt;this script by H&amp;aring;kan Winther&lt;/a&gt;, I captured the following snapshots of what I am waiting for during the INSERT test: &lt;a href="../wp-content/uploads/2012/01/sqlazurewait1.png"&gt;&lt;img class="alignnone size-full wp-image-2851" title="sqlazurewait1" src="../ci.axd?sid=ccb92721-26c1-4de7-b853-fda2cc446b59&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="1041" height="144" /&gt;&lt;/a&gt; and &lt;a href="../wp-content/uploads/2012/01/sqlazurewait2.png"&gt;&lt;img class="alignnone size-full wp-image-2852" title="sqlazurewait2" src="../ci.axd?sid=153960fe-15a0-4f5d-bf93-12c1bb71af81&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="971" height="160" /&gt;&lt;/a&gt; &amp;nbsp; The results I have collected so far on other physical servers shows that SAN connected servers have a hard time getting more than about 1 INSERT per Millisecond. And the cause is that we wait for WRITELOG for about 0.8 milliseconds per row. The average wait time for WRITELOG on internal disks (Even when running on just a single laptop disc) is about 0.1 to 0.2 Milliseconds. Does this mean that my Laptop always are faster than SQL AZURE? Stay tuned, more tests are coming up :-)&lt;/p&gt;</description><a10:updated>2013-02-24T16:18:43Z</a10:updated></item><item><guid isPermaLink="false">3ce637fe-e415-416e-b588-0e3893fe1653</guid><link>http://sqlservice.se/sv/start/blogg/aston-tate-microsoft-sql-server-1-0-for-os-2.aspx?lang=sv</link><title>Aston Tate/Microsoft SQL Server 1.0 for OS/2</title><description>&lt;p&gt;&amp;Auml;r man riktigt insn&amp;ouml;ad p&amp;aring; SQL Server &amp;auml;r det givetvis intressant att veta hur det hela b&amp;ouml;rjade. F&amp;ouml;r min egen del var jag inte med helt fr&amp;aring;n b&amp;ouml;rjan, utan b&amp;ouml;rjade med version 4.21. Tur d&amp;aring; at det finns andra som var med, och har skrivit ned historien! Korta fakta i tabellform hittar du hos Microsoft i &lt;a href="http://gallery.technet.microsoft.com/SQL-Server-Version-History-20b0395b"&gt;detta lilla dokument&lt;/a&gt;. Men mer intressant &amp;auml;r att l&amp;auml;sa om Ron Soukup och Kalen Delaney's resa tillsammans med SQL Server, eller "Aston Tate/Microsoft SQL Server 1.0 for OS/2" som den f&amp;ouml;rsta versionen hette. Mer om dessa v&amp;auml;ldigt tidiga &amp;aring;r hittar du i &lt;a href="http://www.insidesqlserver.com/History%20of%20SQL%20Server.pdf"&gt;denna PDF&lt;/a&gt; p&amp;aring; Kalen Delaney's site &lt;a href="http://www.insidesqlserver.com/"&gt;http://www.insidesqlserver.com/&lt;/a&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-02-24T15:53:12Z</a10:updated></item><item><guid isPermaLink="false">be9cf07b-0066-4e02-883a-e64641b4f10c</guid><link>http://sqlservice.se/sv/start/blogg/multiple-instances-of-sql-server--memory-consideration.aspx?lang=sv</link><title>Multiple instances of SQL Server - memory consideration</title><description>&lt;p&gt;If you plan to run multiple instances of SQL server on the same server, you should plan on how you are going to share the memory between the instances. When you install a SQL server, you get some default settings and some of them are regarding memory. By defualt the "min memory server" setting is 0 and the "max memory setting" is unlimited. This is not a prefered&amp;nbsp;setting in a single instance installation and it is even worse for multiple instance installations.&lt;/p&gt;&#xD;
&lt;p&gt;In a single instance installation, SQL server and Windows server will compete of the memory resources as SQL server wants to allocate all memory.&lt;/p&gt;&#xD;
&lt;p&gt;In a multiple instance installations, you'll get multiple instances that is competing of the memory resources and all of the SQL instances wants to allocate all memory (based on the workload of cource).&lt;/p&gt;&#xD;
&lt;p&gt;If you have more memory than the workload of every SQL server instance, you probably don't see any problems. If you don't have enough memory, 1 or more instances have to release the memory in favour of another instance. This could be acceptable if the performance is not important in any of the SQL server instances.&lt;/p&gt;&#xD;
&lt;p&gt;When a SQL server instance have to release the memory, a message is written&amp;nbsp;to the SQL server log:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;A significant part of sql server process memory has been paged out. This may result in a performance degradation. Duration:&amp;nbsp;x seconds. Working set (KB): y, committed (KB): z, memory utilization: %.&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;If you see alot of this messages, your SQL server performance is suffering from memory deallocations.&lt;/p&gt;&#xD;
&lt;p&gt;To solve this, you should consider&amp;nbsp;to change the max server memory setting of all the SQL server instances. It can be changed in the&amp;nbsp;Server properties dialog&amp;nbsp;or by using T-SQL, but has to be done on every SQL server instance.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;h3&gt;Server properties&amp;nbsp;&lt;/h3&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=8cba267a-19b6-4ebc-853d-804767c9e5f7&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;h3&gt;T-SQL&lt;/h3&gt;&#xD;
&lt;p&gt;Open a new query window and write the following code to change your max server memory to a desired value and execute the code&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;sp_configure 'max server memory (MB)', '13000' -- change the value to your desired memory&#xD;
RECONFIGURE&lt;/pre&gt;&#xD;
&lt;pre class="prettyprint"&gt;&amp;nbsp;&lt;/pre&gt;&#xD;
&lt;p&gt;H&amp;aring;kan Winther&lt;br /&gt;COO / SQL Server consultant&lt;br /&gt;Twitter: @h_winther&lt;/p&gt;</description><a10:updated>2013-02-24T15:39:52Z</a10:updated></item><item><guid isPermaLink="false">913c4fa7-94ff-4781-bd4e-66a7c67c7c7b</guid><link>http://sqlservice.se/sv/start/blogg/sql-error-message--property-owner-is-not-available-for-database.aspx?lang=sv</link><title>SQL error message - Property Owner is not available for Database</title><description>&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;If you get the &amp;ldquo;Property Owner is not available for Database&amp;rdquo; error message when you try to show the properties of a database (right click on a database and click the &amp;ldquo;properties&amp;rdquo; menu), you somehow lost the login that is the owner of the database.&amp;nbsp; It could be the result of a database restore on another SQL server instance where the login is not created.&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Run the following code to see if any owner properties of the database is missing a login&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;-- check to see if owner is "unknown" for any database&#xD;
EXEC sp_helpdb&#xD;
&#xD;
&lt;/pre&gt;&#xD;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;The problem is easy to fix, copy the following code into a new query window, and press CTRL + SHIFT + M to open the template parameter dialog. Enter the databasename and the login you are going to use.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;-- fix the problem, press CTRL + SHIFT + M&#xD;
-- and type your dbname and loginname in the dialog&#xD;
-- and execute the code&#xD;
USE &amp;lt;dbname, sysname,&amp;gt;&#xD;
GO&#xD;
EXEC sp_changedwowner '&amp;lt;loginname, sysname, sa&amp;gt;'&#xD;
&#xD;
-- check to see if owner is "unknown" for any database&#xD;
EXEC sp_helpdb&lt;/pre&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-02-23T07:27:54Z</a10:updated></item><item><guid isPermaLink="false">9a4c6ee5-b567-49dc-991b-ebbe04ae618a</guid><link>http://sqlservice.se/sv/start/blogg/ssms-+-alter-table.aspx?lang=sv</link><title>SSMS + ALTER TABLE</title><description>&lt;p&gt;Jag anv&amp;auml;nder SQL Server Management Studio dagligen f&amp;ouml;r att utf&amp;ouml;ra diverse saker i de databasmilj&amp;ouml;er jag jobbar i. N&amp;auml;stan alltid g&amp;aring;r detta sm&amp;auml;rtfritt och den g&amp;ouml;r som jag f&amp;ouml;rv&amp;auml;ntar mig att den skall g&amp;ouml;ra.&lt;br /&gt;Ibland blir dock resultatet inte helt till bel&amp;aring;tenhet....som tex n&amp;auml;r man vill &amp;auml;ndra en befintlig tabell.&lt;/p&gt;&#xD;
&lt;p&gt;L&amp;aring;t oss titta p&amp;aring; ett exempel.&lt;br /&gt;Vi skapar en ny tabell:&lt;/p&gt;&#xD;
&lt;p&gt;CREATE TABLE&amp;nbsp;test( id int identity(1,1), col varchar(50));&lt;/p&gt;&#xD;
&lt;p&gt;Antag att vi nu vill &amp;auml;ndra p&amp;aring; kolumnl&amp;auml;ngden p&amp;aring; "col" till VARCHAR(100). Om vi nu beslutar oss f&amp;ouml;r att g&amp;ouml;ra detta i Management Studio s&amp;aring; &amp;ouml;ppnar vi tabellen i design l&amp;auml;ge, &amp;auml;ndrar kolumnl&amp;auml;ngden och skriptar ut f&amp;ouml;r&amp;auml;ndringen f&amp;ouml;r att se vad Management Studio egentligen hittar p&amp;aring; bakom kulisserna.&lt;/p&gt;&#xD;
&lt;p&gt;F&amp;ouml;ljande skript uppenbarar sig:&lt;/p&gt;&#xD;
&lt;p&gt;/* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/&lt;/p&gt;&#xD;
&lt;p&gt;BEGIN TRANSACTION &lt;br /&gt;SET QUOTED_IDENTIFIER ON &lt;br /&gt;SET ARITHABORT ON &lt;br /&gt;SET NUMERIC_ROUNDABORT OFF &lt;br /&gt;SET CONCAT_NULL_YIELDS_NULL ON &lt;br /&gt;SET ANSI_NULLS ON &lt;br /&gt;SET ANSI_PADDING ON &lt;br /&gt;SET ANSI_WARNINGS ON &lt;br /&gt;COMMIT&lt;/p&gt;&#xD;
&lt;p&gt;BEGIN TRANSACTION &lt;br /&gt;GO &lt;br /&gt;CREATE TABLE dbo.Tmp_test &amp;nbsp;( &amp;nbsp;id int NOT NULL IDENTITY (1, 1), &amp;nbsp;col varchar(100) NULL &amp;nbsp;)&amp;nbsp; ON [PRIMARY] &lt;br /&gt;GO &lt;br /&gt;ALTER TABLE dbo.Tmp_test SET (LOCK_ESCALATION = TABLE) &lt;br /&gt;GO &lt;br /&gt;SET IDENTITY_INSERT dbo.Tmp_test ON &lt;br /&gt;GO &lt;br /&gt;IF EXISTS(SELECT * FROM dbo.test)&amp;nbsp;&amp;nbsp;EXEC('INSERT INTO dbo.Tmp_test (id, col) &amp;nbsp;&amp;nbsp;SELECT id, col FROM dbo.test WITH (HOLDLOCK TABLOCKX)') &lt;br /&gt;GO &lt;br /&gt;SET IDENTITY_INSERT dbo.Tmp_test OFF &lt;br /&gt;GO &lt;br /&gt;DROP TABLE dbo.test &lt;br /&gt;GO &lt;br /&gt;EXECUTE sp_rename N'dbo.Tmp_test', N'test', 'OBJECT' &lt;br /&gt;GO &lt;br /&gt;COMMIT&lt;/p&gt;&#xD;
&lt;p&gt;Vi kan se att Management Studio f&amp;ouml;rst skapar en tempor&amp;auml;r tabell enl den nya definitionen, kopierar &amp;ouml;ver allt data, tar bort den gamla tabellen och d&amp;ouml;per till sist om den nya tabellen till r&amp;auml;tt namn.&lt;br /&gt;Detta k&amp;auml;nns onekligen som en omv&amp;auml;g, om vi hade gjort detta med TSQL ist&amp;auml;llet hade det blivit n&amp;aring;got enklare:&lt;/p&gt;&#xD;
&lt;p&gt;ALTER TABLE test ALTER COLUMN Col VARCHAR(100);&lt;/p&gt;&#xD;
&lt;p&gt;Har detta d&amp;aring; n&amp;aring;gon betydelse? Ja, om tabellen vi vill &amp;auml;ndra p&amp;aring; &amp;auml;r stor s&amp;aring; kan det bli v&amp;auml;ldigt mycket data som m&amp;aring;ste flyttas runt eller om tabellen vi vill &amp;auml;ndra tex &amp;auml;r replikerad s&amp;aring; kommer Managment Studios variant inte att fungera eftersom det faktiskt droppar tabellen medan ALTER TABLE... fungerar alldeles utm&amp;auml;rkt mot en replikerad tabell.&lt;/p&gt;&#xD;
&lt;p&gt;Jag vet att detta inte &amp;auml;r n&amp;aring;got nytt beteende hos Management Studio men icke desto mindre kan det vara n&amp;aring;got att ha i &amp;aring;tanke innan man b&amp;ouml;rjar &amp;auml;ndra i sina tabeller via designl&amp;auml;get.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-02-22T09:33:08Z</a10:updated></item><item><guid isPermaLink="false">7db30004-a2d5-46d9-9094-9bfd41eb9a88</guid><link>http://sqlservice.se/sv/start/blogg/tips-pa-bocker.aspx?lang=sv</link><title>Tips på böcker</title><description>&lt;p&gt;F&amp;ouml;rutom att g&amp;aring; utbildningar och f&amp;ouml;lja events finns ett gammalt s&amp;auml;tt att l&amp;auml;ra sig mer om SQL Server. N&amp;auml;mligen att l&amp;auml;sa b&amp;ouml;cker. M&amp;aring;nga bra b&amp;ouml;cker finns faktiskt att ladda ner gratis och det kan ocks&amp;aring; vara ett bra s&amp;auml;tt innan man eventuellt k&amp;ouml;per boken med riktigt papper. Dessutom finns det r&amp;auml;tt m&amp;aring;nga b&amp;ouml;cker om SQL Server 2012 som kan vara ett bra s&amp;auml;tt att se vilka m&amp;ouml;jligheter och f&amp;ouml;rdelar man har av denna senaste SQL Server version.&lt;/p&gt;&#xD;
&lt;p&gt;N&amp;aring;gra tips p&amp;aring; l&amp;auml;nkar d&amp;auml;r man kan hitta dessa b&amp;ouml;cker hittar man nedan:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://it-ebooks.info/tag/server/"&gt;http://it-ebooks.info/tag/server/&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.red-gate.com/community/books/"&gt;http://www.red-gate.com/community/books/&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2013-02-20T12:20:18Z</a10:updated></item><item><guid isPermaLink="false">31d2c755-91ee-4efa-9c55-01c158e10b9d</guid><link>http://sqlservice.se/sv/start/blogg/errors-in-the-olap-storage-engine-a-duplicate-attribute-key-has-been-found-when-processing-table---,-column---,-value-----the-attribute-is----.aspx?lang=sv</link><title>Errors in the OLAP storage engine: A duplicate attribute key has been found when processing: Table: '', Column: '', Value: ''. The attribute is ''.</title><description>&lt;p&gt;Alright, so you get this error when you process your dimension. You look carefully throug your data looking for duplicate values, and you find NOTHING!?! Recognize the situation?&lt;/p&gt;&#xD;
&lt;p&gt;I had a frustrating time last week trying to understand the reason for this (fairly straight forward) error message. I looked very carefully at the data rows and could see duplicates in my SELECT...GROUP BY statement, how is that even possible?! Well it turns out that the data set was in really poor condition. The strings (addresses from a web form) were not cleaned from strange characters, so I had strings with leading and following characters in tha range from 0x01 to 0x31 (mostly non printables; look in an ascii table), thank God for CAST(SUBSTRING(address,1,1) AS BINARY(2)) AND CAST(SUBSTRING(REVERSE(address),1,1 AS BINARY(2)). Now I am going to have a little chat with the web developers on how to verify web form data BEFORE shipping it off into the backend systems...&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;//Joakim&lt;/p&gt;</description><a10:updated>2013-02-17T22:21:58Z</a10:updated></item><item><guid isPermaLink="false">8a4d1aff-a24d-48c9-b6ba-4faf6a96ac86</guid><link>http://sqlservice.se/sv/start/blogg/antoher-type-of-sql-server-crash.aspx?lang=sv</link><title>Antoher type of SQL server crash</title><description>&lt;p&gt;Usually our blog posts are about how to improve SQL server, your skills and about different types of crashes, but this blog post is about another type of crash.&lt;/p&gt;&#xD;
&lt;p&gt;Do you remeber the&amp;nbsp;Astroid game back in early -90? Well I do!&amp;nbsp;You had a&amp;nbsp;small space ship (shaped as a triangle) and you had to avoid and destroy asteroids, if you didn't make it you crashed. It didn't have any fancy graphics like modern games.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;What has this to do with SQL server? Well, you probably heard about Red-Gate, and they have developed a product called Red-Gate Source Control, and someone at Red-Gate seemed to like the Asteroid game too much. Why do I think that? Well because someone have added the Asteroid game as an "easter egg" in the Source Control product!&lt;/p&gt;&#xD;
&lt;p&gt;If you have installed Red-Gate Source Control, you simply open the Source Control Gui, click the "Help" button, click "About&amp;nbsp;SQL Source Control" and wait a couple of minutes!&lt;/p&gt;&#xD;
&lt;p&gt;Personally I think they should spend more time in fixing defects and adding&amp;nbsp;requested featurs&amp;nbsp;in the product instead of adding features no one have requested and no one is willing to pay for, but thats my opinion. I know Microsft added a Doom easter egg in one of the early Excel versions, but why? Well, at least the developers could laugh at their work. :)&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;/H&amp;aring;kan Winther&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-02-14T08:10:48Z</a10:updated></item><item><guid isPermaLink="false">1f98c4d1-ca72-4b4d-9d72-1fb9239b54ed</guid><link>http://sqlservice.se/sv/start/blogg/optimera-c.aspx?lang=sv</link><title>Optimera C:</title><description>&lt;p&gt;En bra &amp;aring;tg&amp;auml;rd enligt v&amp;aring;ra erfarenheter &amp;auml;r att manuellt defragmentera c-disken, som normalt anv&amp;auml;nds f&amp;ouml;r installation av SQL Server innan man installerar SQL Server. &amp;nbsp;Dessutom b&amp;ouml;r man schemal&amp;auml;gga s&amp;aring; att defragmenteringen sker en g&amp;aring;ng per vecka f&amp;ouml;r samma disk. Som vi ser av bilden nedan s&amp;aring; blir man annars uppmanad att att g&amp;ouml;ra detta efter en tid. Dock skall man inte g&amp;ouml;ra detta f&amp;ouml;r &amp;ouml;vriga diskar som anv&amp;auml;nds f&amp;ouml;r SQL Servers&amp;nbsp;data- och loggfiler.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=b70c3dc5-c68c-47f9-8627-f2a763e78118&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Att schemal&amp;auml;gga detta &amp;auml;r v&amp;auml;ldigt enkelt,&amp;nbsp; genom att f&amp;ouml;rst v&amp;auml;lja dag f&amp;ouml;r defragmenteringen.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=75348d0a-12de-4daa-a269-849e52b7a463&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;D&amp;auml;refter v&amp;auml;ljer man diskarna som skall defragmenteras och allts&amp;aring; enbart c: i detta fall.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=818a61dd-e42a-4b91-91a2-080ce6c31952&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-02-11T07:28:57Z</a10:updated></item><item><guid isPermaLink="false">fb230720-763a-4960-a86e-a341a2165494</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-2012-sp1--sys-dm_db_stats_properties.aspx?lang=sv</link><title>SQL server 2012 sp1 - sys.dm_db_stats_properties</title><description>&lt;p&gt;It's been a while since my last blog post, due to a terrible cold that have forced me to bed, but now it's time for another blog post!&lt;/p&gt;&#xD;
&lt;p&gt;In SQL server 2012 service pack 1 there is a new function that will give you more details about the statistics. As you probably already know, the statistics are very important for the performance in SQL server. It's used by the optimizer to create an efficient execution plan. The new function can tell you if the statistics needs to be updated or if the sample rate is low.&lt;/p&gt;&#xD;
&lt;p&gt;You can use code like this:&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;SELECT&#xD;
	objectName		= obj.name,&#xD;
	statsName		= [stat].[name],&#xD;
	statsColumns	= colList.[NAMES],&#xD;
	[stat].[auto_created],&#xD;
	[stat].[user_created],&#xD;
	[stat].[no_recompute],&#xD;
	[stat].[has_filter],&#xD;
	[stat].[filter_definition],&#xD;
	[stat].[is_temporary],&#xD;
	[sp].[last_updated],&#xD;
	[sp].[rows],&#xD;
	[sp].[rows_sampled],&#xD;
	[sp].[steps],&#xD;
	[sp].[unfiltered_rows],&#xD;
	[sp].[modification_counter],&#xD;
	sampleRate = 1.0 * sp.[rows_sampled] / sp.[rows]&#xD;
FROM sys.objects AS obj&#xD;
INNER JOIN sys.stats stat&#xD;
	 ON stat.object_id = obj.object_id&#xD;
CROSS APPLY(&#xD;
	SELECT STUFF(col.NAME,1,1,'') &#xD;
	FROM (&#xD;
		SELECT ',' + c.[name] &#xD;
		FROM sys.[stats_columns] AS sc &#xD;
		INNER JOIN sys.[columns] AS c&#xD;
			ON [sc].[column_id] = [c].[column_id]&#xD;
			AND [sc].[object_id] = [c].[object_id]&#xD;
		WHERE &#xD;
			sc.[object_id] = stat.[object_id]&#xD;
			AND sc.[stats_id] = stat.[stats_id]&#xD;
		FOR XML PATH('')&#xD;
		) AS col(NAME)&#xD;
	) AS colList(NAMES)&#xD;
OUTER APPLY sys.dm_db_stats_properties(stat.object_id, stat.stats_id) AS sp&#xD;
WHERE&#xD;
	obj.[is_ms_shipped] = 0;&lt;/pre&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;If you missed my previous blog posts about statistics, you can find them here:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="../sv/start/blogg/sql-server-performance--death-by-bad-statistics.aspx"&gt;http://www.sqlservice.se/sv/start/blogg/sql-server-performance--death-by-bad-statistics.aspx&lt;/a&gt;&amp;nbsp;&lt;br /&gt;&lt;a href="../sv/start/blogg/sql-server-statistics--local-variables.aspx"&gt;http://www.sqlservice.se/sv/start/blogg/sql-server-statistics--local-variables.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="../sv/start/blogg/sql-server-statistics--memory-request.aspx"&gt;http://www.sqlservice.se/sv/start/blogg/sql-server-statistics--memory-request.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="../sv/start/blogg/sql-server-statistics--read-only-database.aspx"&gt;http://www.sqlservice.se/sv/start/blogg/sql-server-statistics--read-only-database.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="../sv/start/blogg/sql-server-statistics--table-variables.aspx"&gt;http://www.sqlservice.se/sv/start/blogg/sql-server-statistics--table-variables.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="../sv/start/blogg/sql-server-statistics--multicolumn-statistics.aspx"&gt;http://www.sqlservice.se/sv/start/blogg/sql-server-statistics--multicolumn-statistics.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Feel free to contact&amp;nbsp;any of other&amp;nbsp;SQL server consultants if you&amp;nbsp;wants to&amp;nbsp;know more about&amp;nbsp;SQL server and statistics.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Regards&lt;/p&gt;&#xD;
&lt;p&gt;/H&amp;aring;kan&amp;nbsp;Winther&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-02-10T20:45:15Z</a10:updated></item><item><guid isPermaLink="false">d0cf4a22-a4f3-4b17-83ae-92c462e9977e</guid><link>http://sqlservice.se/sv/start/blogg/change-tracking-for-the-non-enterprise-licensee.aspx?lang=sv</link><title>Change tracking for the non enterprise licensee</title><description>&lt;p&gt;Hi,&lt;/p&gt;&#xD;
&lt;p&gt;at the latest PASS conference i Seattle I took part in several sessions on change tracking, but was very disappointed that every single one was dedicated to the CDC technology of change tracking.&lt;/p&gt;&#xD;
&lt;p&gt;Even when I remarked that there is a easier AND cheaper solution available, the presenters did not seem to know about it. Thus, I had to hold "mini sessions" after the CDC sessions where I explained to some of the audience that Change Tracking (CT) is also available as a change tracking method. The advantage with this method is that it is available on all versions of SQL Server (whereas CDC does demand the Enterprise $$$ license). Also CT only tracks net changes to data, not the full state shifting that CDC tracks by reading tha transaction log. In the normal scenario where you want to UPDATE the changed data rows only (through a MERGE), you do not care about intermediate states of you data rows, and CDC could be considered an overkill for the output you need.&lt;/p&gt;&#xD;
&lt;p&gt;CT works just like adding that extra rowversion column but only you do not have to do it in the table itself, it is done through SQL Server hidden system tables, which means that you do not have to modify your (3rd party?) data model to make CT possible!! Very appealing indeed.&lt;/p&gt;&#xD;
&lt;p&gt;I will not present the details in CT here, just really emphasize that this solution exists, that it is available, and also that it is very easy to set up.&lt;/p&gt;&#xD;
&lt;p&gt;Read Books Online, you will be surprised!&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;/Joakim Nystr&amp;ouml;m&lt;/p&gt;</description><a10:updated>2013-02-10T18:27:09Z</a10:updated></item><item><guid isPermaLink="false">cce521c3-1cee-442c-8cf0-187807c00bb8</guid><link>http://sqlservice.se/sv/start/blogg/veckans-filmtips.aspx?lang=sv</link><title>Veckans filmtips!</title><description>&lt;p&gt;Har du lite tid &amp;ouml;ver ibland, till exempel n&amp;auml;r du sitter p&amp;aring; t&amp;aring;get, eller n&amp;auml;r du krupit upp i soffan framf&amp;ouml;r brasan en l&amp;ouml;rdagskv&amp;auml;ll? K&amp;auml;nner du f&amp;ouml;r att titta p&amp;aring; en riktigt bra film, som f&amp;aring;r dig att t&amp;auml;nka efter och utvecklas en liten bit? D&amp;aring; skall du surfa in p&amp;aring; &lt;a href="http://www.sqlug.se/sv-se/videos.aspx"&gt;http://www.sqlug.se/sv-se/videos.aspx&lt;/a&gt;&amp;nbsp;och botanisera i en imponerande lista &amp;ouml;ver inspelade h&amp;ouml;gklassiga Microsoft SQL Server f&amp;ouml;rel&amp;auml;sningar i &lt;a href="http://www.sqlug.se"&gt;SQLUG&lt;/a&gt;'s regi. &amp;Auml;r du en riktigt SQL Server n&amp;ouml;rd, s&amp;aring; &amp;auml;r kv&amp;auml;llen r&amp;auml;ddad :-)&lt;/p&gt;</description><a10:updated>2013-02-10T14:16:07Z</a10:updated></item><item><guid isPermaLink="false">479e5ee6-d67d-498a-9f9d-2ea13ee17971</guid><link>http://sqlservice.se/sv/start/blogg/ar-du-medlem-i-sqlug.aspx?lang=sv</link><title>Är du medlem i SQLUG?</title><description>&lt;p&gt;Bor du i Sverige? Jobbar du med Microsoft SQL Server? D&amp;aring; skall du sj&amp;auml;lvklart vara medlem i SQLUG, den &lt;a href="http://www.sqlug.se"&gt;Svenska anv&amp;auml;ndarf&amp;ouml;reningen f&amp;ouml;r SQL Server&lt;/a&gt;! Medlemskap &amp;auml;r gratis, liksom de ca 7-9 tr&amp;auml;ffarna som arrangeras i Stockholm, Malm&amp;ouml; och G&amp;ouml;teborg varje &amp;aring;r. Det &amp;auml;r dessutom ett bra tillf&amp;auml;lle att tr&amp;auml;ffa likasinnade SQL Server n&amp;ouml;rdar, och diskutera de stora viktiga fr&amp;aring;gorna i arbetslivet, som skillnaden mellan INNER och OUTER join, Table Scan och Index Seek eller varf&amp;ouml;r inte HASH Join vs Nested Loop?&lt;/p&gt;&#xD;
&lt;p&gt;Bli medlem idag genom att registrera dig &lt;a href="http://www.sqlug.se/Hem/tabid/78/ctl/Register/language/sv-SE/Default.aspx?returnurl=http%3a%2f%2fwww.sqlug.se%2fsv-se%2fhem.aspx"&gt;h&amp;auml;r&lt;/a&gt;!&lt;/p&gt;</description><a10:updated>2013-02-10T14:10:59Z</a10:updated></item><item><guid isPermaLink="false">8aed2d69-aa19-4ed5-80c3-c632bcf4e2c7</guid><link>http://sqlservice.se/sv/start/blogg/dbcc-cleantable.aspx?lang=sv</link><title>DBCC CLEANTABLE</title><description>&lt;p&gt;Antag att du har en tabell med bla en kolumn som &amp;auml;r av variabel l&amp;auml;ngd tex VARCHAR(), NVARCHAR(), VARBINARY osv...&lt;br /&gt;Om man nu tar bort variabel l&amp;auml;ngds kolumnen kan man f&amp;ouml;rv&amp;auml;nta sig att tabellen minskar i storlek. &lt;br /&gt;Vi testar.&lt;/p&gt;&#xD;
&lt;p&gt;Skapa en tabell: &lt;br /&gt;CREATE TABLE Test (ID INT IDENTITY(1,1), Col VARCHAR(MAX));&lt;/p&gt;&#xD;
&lt;p&gt;Vi fyller tabellen med data: &lt;br /&gt;INSERT INTO Test(Col) VALUES(REPLICATE('A', 1000)); &lt;br /&gt;GO 1000&lt;/p&gt;&#xD;
&lt;p&gt;Vi unders&amp;ouml;ker hur stor tabellen blivit: &lt;br /&gt;SELECT alloc_unit_type_desc, page_count, avg_page_space_used_in_percent, record_count &lt;br /&gt;FROM sys.dm_db_index_physical_stats( DB_ID('SQLService'),OBJECT_ID(N'Test'),NULL,NULL,'Detailed');&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=40db649b-637d-45b4-9fde-4a098862412c&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Ovan kan vi se att tabellen &amp;auml;r utspridd p&amp;aring; 150 data pages med ca 84% fyllnadsgrad.&lt;/p&gt;&#xD;
&lt;p&gt;Vi tar nu bort kolumnen "Col" f&amp;ouml;r att frig&amp;ouml;ra utrymme: &lt;br /&gt;ALTER TABLE Test DROP COLUMN Col;&lt;/p&gt;&#xD;
&lt;p&gt;En ny titt p&amp;aring; hur stor v&amp;aring;r tabell &amp;auml;r visar att det inte h&amp;auml;nt n&amp;aring;gonting, tabellen upptar fortfarande ca 84% av alla data pages.&lt;/p&gt;&#xD;
&lt;p&gt;F&amp;ouml;r att frig&amp;ouml;ra utrymmet m&amp;aring;ste man anv&amp;auml;nda sig av DBCC CLEANTABLE.&lt;/p&gt;&#xD;
&lt;p&gt;Vi k&amp;ouml;r: &lt;br /&gt;DBCC CLEANTABLE('DatabasNamn','Tabellnamn',0);&lt;/p&gt;&#xD;
&lt;p&gt;Om vi nu &amp;aring;terigen kontrollerar hur fyllnadsgraden ser ut f&amp;ouml;r v&amp;aring;r tabell visar det sig att den g&amp;aring;tt ner till ca 1%, vi har&amp;nbsp;s&amp;aring;ledes &amp;aring;terf&amp;aring;tt utrymmet f&amp;ouml;r den borttagna kolumnen.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=1bb82dff-dabf-4722-862e-d0a1da8ae249&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;</description><a10:updated>2013-02-08T13:12:36Z</a10:updated></item><item><guid isPermaLink="false">278b540c-b148-4d47-ad01-cc40538b0f00</guid><link>http://sqlservice.se/sv/start/blogg/varfor-vanta-till-hosten-.aspx?lang=sv</link><title>Varför vänta till hösten ?</title><description>&lt;p&gt;Som vi vet kommer SQL Pass Summit i &amp;aring;r g&amp;aring; av stapeln i Charlotte, North Carolina under oktober. Om man inte kan v&amp;auml;nta till dess finns under april&amp;nbsp;ett bra tillf&amp;auml;lle att l&amp;auml;ra sig &amp;auml;nnu mer om SQL Server. I Las Vegas g&amp;aring;r n&amp;auml;mligen SQLIntersection den 7/4 - 12/4 som &amp;auml;r sp&amp;auml;ckad med bra SQL Server talare som ni kan l&amp;auml;sa lite mer om &lt;a href="http://www.sqlskills.com/blogs/kimberly/"&gt;h&amp;auml;r&lt;/a&gt;. Mer information om SQLIntersection hittar ni &lt;a href="http://www.sqlintersection.com/"&gt;h&amp;auml;r&lt;/a&gt;, och d&amp;auml;r g&amp;ouml;r man &amp;auml;ven registrering.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-02-05T10:29:51Z</a10:updated></item><item><guid isPermaLink="false">d93899f7-bee2-4aaa-a3b0-6da15dd8c81d</guid><link>http://sqlservice.se/sv/start/blogg/till-forsvar-av-sql-server-express.aspx?lang=sv</link><title>Till försvar av SQL Server Express!</title><description>&lt;p&gt;Vi p&amp;aring; SQL Service brukar g&amp;auml;rna skriva och prata om f&amp;ouml;rdelarna med Enterprise Edition av Microsoft SQL Server, bland annat n&amp;auml;r det g&amp;auml;ller prestanda och tillg&amp;auml;nglighet. Men idag t&amp;auml;nkte jag g&amp;ouml;ra tv&amp;auml;rt om, genom att sl&amp;aring; ett slag f&amp;ouml;r SQL Server Express Edition. Varf&amp;ouml;r? Av den enkla anledning att den har en stor f&amp;ouml;rdel som inte de andra editions av SQL Server har: den &amp;auml;r gratis. (Ladda ned Microsoft SQL Server 2012 Express Edition h&amp;auml;r &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=29062"&gt;http://www.microsoft.com/en-us/download/details.aspx?id=29062&lt;/a&gt;)&lt;/p&gt;&#xD;
&lt;p&gt;S&amp;aring;, varf&amp;ouml;r anv&amp;auml;nder vi inte SQL Server Express i alla l&amp;auml;gen? Eller i alla fall oftare &amp;auml;n vad som verkar vara fallet idag? Dels beror det givetvis p&amp;aring; att viss funktionalitet &amp;auml;r begr&amp;auml;nsad, men &amp;auml;ven till stor del kanske p&amp;aring; v&amp;aring;r egen okunnighet och brist p&amp;aring; fantasi? De begr&amp;auml;nsningar Microsoft valt att s&amp;auml;tta p&amp;aring; Express Edition kan vi givetvis inte &amp;auml;ndra p&amp;aring;, men om vi k&amp;auml;nner till vilka de &amp;auml;r kan vi hitta p&amp;aring; andra l&amp;ouml;sningar, och i alla fall ha en m&amp;ouml;jlighet att utv&amp;auml;rdera om Express Edition kan vara l&amp;ouml;sningen p&amp;aring; n&amp;aring;gra, eller kanske m&amp;aring;nga, av de SQL Server plattformsval som vi g&amp;ouml;r.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;S&amp;aring;, vad &amp;auml;r d&amp;aring; de viktigaste begr&amp;auml;nsningarna?&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;SQL Server Agent saknas&lt;/p&gt;&#xD;
&lt;p&gt;SQL Profiler saknas&lt;/p&gt;&#xD;
&lt;p&gt;CPU: Max 1 CPU socket, eller 4 core&lt;/p&gt;&#xD;
&lt;p&gt;Minne: Max 1 GB f&amp;ouml;r Database Engine och 4 GB f&amp;ouml;r Reporting Services&lt;/p&gt;&#xD;
&lt;p&gt;Databasstorlek: Max 10 GB&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Men, det finns &amp;auml;ven en hel del som faktisk &amp;Auml;R inkluderat i Express Edition, som du kanske inte k&amp;auml;nde till:&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Full Text Search inklusive Semantic Search&lt;/p&gt;&#xD;
&lt;p&gt;Windows Server Core support&lt;/p&gt;&#xD;
&lt;p&gt;Du kan k&amp;ouml;ra upp till 50 instanser av Express Edition p&amp;aring; en server&lt;/p&gt;&#xD;
&lt;p&gt;St&amp;ouml;d f&amp;ouml;r Contained Databases&lt;/p&gt;&#xD;
&lt;p&gt;Change Tracking&lt;/p&gt;&#xD;
&lt;p&gt;Dedicated Admin Connection&lt;/p&gt;&#xD;
&lt;p&gt;SysPrep Support&lt;/p&gt;&#xD;
&lt;p&gt;Powershell Support&lt;/p&gt;&#xD;
&lt;p&gt;CLR Integration&lt;/p&gt;&#xD;
&lt;p&gt;Filetable&lt;/p&gt;&#xD;
&lt;p&gt;Reporting Services&lt;/p&gt;&#xD;
&lt;p&gt;Management Studio&lt;/p&gt;&#xD;
&lt;p&gt;St&amp;ouml;d f&amp;ouml;r Spatiala (Geografiska) data och Index&lt;/p&gt;&#xD;
&lt;p&gt;Extended Events&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Workarounds f&amp;ouml;r begr&amp;auml;nsningar&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Problemet med den saknade SQL Server Agenten&lt;/p&gt;&#xD;
&lt;p&gt;Om man vill k&amp;ouml;ra produktionsdatabaser i SQL Server Express Edition, vill man ju givetvis ta backuper, underh&amp;aring;lla index och statistik samt k&amp;ouml;ra DBCC checkdb. Alt detta kan man g&amp;ouml;ra (Till exempel med Ola Hallengrens script &lt;a href="http://ola.hallengren.com"&gt;Http://ola.hallengren.com&lt;/a&gt; ) men problemet &amp;auml;r att avsaknad av SQL Server Agent g&amp;ouml;r det lite knepigare att schemal&amp;auml;gga underh&amp;aring;llet. Det finns flera olika l&amp;ouml;sningar p&amp;aring; det, varav den enklaste &amp;auml;r att schemal&amp;auml;gga MCD script i Windows via Scheduled Tasks. Dessa script ropar d&amp;aring; l&amp;auml;mpligen p&amp;aring; stored procedures via SQLCMD.exe. Ett elegantare s&amp;auml;tt beskrivs h&amp;auml;r &lt;a href="http://www.sqlteam.com/article/scheduling-jobs-in-sql-server-express"&gt;http://www.sqlteam.com/article/scheduling-jobs-in-sql-server-express&lt;/a&gt; och best&amp;aring;r i att schemal&amp;auml;gga med hj&amp;auml;lp av SQL Server Service Broker och Conversion Timers Det finns &amp;auml;ven en gratis utility p&amp;aring; CodePlex, som shcemal&amp;auml;gger backup och underh&amp;aring;ll vid hj&amp;auml;lp av sqlmaint.exe h&amp;auml;r: &lt;a href="http://expressmaint.codeplex.com/"&gt;http://expressmaint.codeplex.com/&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;SQL Profiler d&amp;aring;?&lt;/p&gt;&#xD;
&lt;p&gt;Givetvis vill man ibland titta in under huven &amp;auml;ven p&amp;aring; SQL Server Express, men ingen SQL Profiler f&amp;ouml;ljer med. Det b&amp;auml;sta &amp;auml;r d&amp;aring; om man faktiskt vill an&amp;auml;nda Profiler, &amp;auml;r att helt enkelt anv&amp;auml;nda Profiler fr&amp;aring;n en annan installation av SQL Server Standard eller Enterprise till exempel. Men man kan faktiskt anv&amp;auml;nda Extended Events, &amp;auml;ven om det kan vara lite klurigt att komma ig&amp;aring;ng med. Och &amp;auml;ven DBCC INPUTBUFFER kan ju l&amp;ouml;sa vissa enkla uppgifter.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Jag hoppas att detta kan ge inspiration till att anv&amp;auml;nda SQL Server f&amp;ouml;r typer av uppgifter d&amp;auml;r du idag kanske anv&amp;auml;nder MySQl, Access eller liknande produkter, till exempel p&amp;aring; grund av priset. Vi p&amp;aring; SQL Service hj&amp;auml;lper dig givetvis g&amp;auml;rna!&lt;/p&gt;&#xD;
&lt;p&gt;Mer information om SQL Server Express Edition (Och &amp;auml;ven de andra Editions):&lt;/p&gt;&#xD;
&lt;p&gt;Books Online for SQL Server 2012 &lt;a href="http://msdn.microsoft.com/en-us/library/ms130214.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms130214.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Compute Capacity Limits by Edition of SQL Server &lt;a href="http://msdn.microsoft.com/en-us/library/ms143760.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms143760.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Editions and Components of SQL Server 2012 &lt;a href="http://msdn.microsoft.com/en-us/library/ms144275.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms144275.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Features Supported by the Editions of SQL Server 2012 &lt;a href="http://msdn.microsoft.com/en-us/library/cc645993.aspx"&gt;http://msdn.microsoft.com/en-us/library/cc645993.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Maximum Capacity Specifications for SQL Server &lt;a href="http://msdn.microsoft.com/en-us/library/ms143432.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms143432.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-02-03T16:35:03Z</a10:updated></item><item><guid isPermaLink="false">6eca20c9-1274-461d-987d-e416bd438c51</guid><link>http://sqlservice.se/sv/start/blogg/snart-dags-for-24-hours-of-pass.aspx?lang=sv</link><title>Snart dags för 24 Hours of PASS</title><description>&lt;p&gt;Som vi skrivit om tidigare kommer det att g&amp;aring; en BI konferens den 10-12/4 i Chicago. Inf&amp;ouml;r den kommer det som inf&amp;ouml;r vanliga PASS Summit finnas m&amp;ouml;jligt att f&amp;aring; ett smakprov av de &amp;nbsp;sessioner som kommer h&amp;aring;llas p&amp;aring; denna BI konferens. Detta kommer idag den&amp;nbsp; 30/1 med start kl 14:00 av tolv sessioner. Dessa kommer sedan g&amp;aring; i repris och finnas tillg&amp;auml;ngliga 12 timmar senare. Mer information om detta och registreringen f&amp;ouml;r att f&amp;ouml;lja dessa sessioner g&amp;ouml;r man &lt;a href="http://www.24hoursofpass.com/"&gt;h&amp;auml;r&lt;/a&gt;.&lt;/p&gt;</description><a10:updated>2013-01-30T11:06:40Z</a10:updated></item><item><guid isPermaLink="false">9a7c045c-cc5b-498a-8d72-47e64448debd</guid><link>http://sqlservice.se/sv/start/blogg/gratis-utbildning-under-24-timmar-.aspx?lang=sv</link><title>Gratis utbildning under 24 timmar !</title><description>&lt;p&gt;Passa p&amp;aring; detta tillf&amp;auml;lle att prova p&amp;aring; Pluralsights utbildningar som man denna m&amp;aring;nad kan nyttja gratis under 24 timmar. F&amp;ouml;r SQL Server s&amp;aring; finns det f&amp;ouml;r n&amp;auml;rvarande 24 kurser. Registrering g&amp;ouml;r man &lt;a href="http://blog.pluralsight.com/2013/01/17/see-what-everyones-talking-about-get-a-free-pluralsight-day-pass/"&gt;h&amp;auml;r&lt;/a&gt;, och observera att detta erbjudande endast g&amp;auml;ller innan 31/1 -13.&lt;/p&gt;</description><a10:updated>2013-01-29T20:10:41Z</a10:updated></item><item><guid isPermaLink="false">46fca6c7-db16-4a2c-88a8-30cefdda0e32</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-2012-sp1-cu2-released.aspx?lang=sv</link><title>SQL Server 2012 SP1 CU2 released</title><description>&lt;p&gt;Recently, SQL Server 2012 Servicepack 1 Cumulative Update 2 was released. And unlike some CU's this one has quite som extra functionality in it, not just bugfixes. The goodies released are:&lt;/p&gt;&#xD;
&lt;p&gt;Sysprep support for almost all features and tools, wich I have written more about &lt;a href="../sv/start/blogg/sysprep-support-in-sql-server-2012.aspx"&gt;here&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;The option to backup and restore databases directly to and from Windows Azure Blob Storage, read more &lt;a href="http://support.microsoft.com/kb/2792921/en-us?fr=1"&gt;here&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;More info about SQL 2012 SP1 CU2 can be found &lt;a href="http://support.microsoft.com/kb/2790947"&gt;here&lt;/a&gt;, but beware, it seems to be automatically "translated" into your local language, and can be quite hard on the eyes because of that :-)&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-01-27T16:13:05Z</a10:updated></item><item><guid isPermaLink="false">609dceb6-0228-4ec0-af1e-2f10c915d21a</guid><link>http://sqlservice.se/sv/start/blogg/sysprep-support-in-sql-server-2012.aspx?lang=sv</link><title>Sysprep support in SQL Server 2012</title><description>&lt;p&gt;If you install a lot of servers, you are probably aware of a tool called Sysprep, that is used to take an windows installation and remove all specific information related to servername, SID's and so on. That allows you to take a snapshot of that image, and replicate it to many servers, and only have to run a shourt setup to type in the information specific to the particular server you are installing. That saves a lot of time during installation.&lt;/p&gt;&#xD;
&lt;p&gt;It has been possible to "Sysprep" an installation of SQL Server for some time (Read more &lt;a href="../sv/start/blogg/sysprepping-sql-server.aspx"&gt;here&lt;/a&gt;), but not all features. Starting with SQL Server 2012 ServicePack 1 Cumulative Update 2, sysprep support in now extended to all features and tools. Just about the only thing that is not supported, is failover clustering.&lt;/p&gt;&#xD;
&lt;p&gt;The process starts with installing Windows (obviously), and then installing a slipstreamed SQL Server SP1 CU2. Slipstreaming is not done by means of the Product Update feature of the setup program (Read more &lt;a href="http://msdn.microsoft.com/en-us/library/hh231670.aspx"&gt;here&lt;/a&gt;). But instead of doing a normal install, you go to the Advanced tab, and select "Image preparation of a stand-alone instance of SQL Server" That will install SQL Server binaries, but not do any configuration. Then you sysprep your server. Now you have a template that you can use and reuse. After installing the template on a server, and completing the Windows mini setup, you can move on to configure SQL Server. This is easily done by clicking on a shortcut in the Start menu specifically made for that purpose, and entering the configuration details.&lt;/p&gt;&#xD;
&lt;p&gt;If you install a lot of SQL Servers, this can save you quite a lot of time.&lt;/p&gt;&#xD;
&lt;p&gt;Read more about Sysprep of Microsoft SQL Server &lt;a href="http://technet.microsoft.com/en-US/library/ee210754.aspx"&gt;here&lt;/a&gt; and &lt;a href="http://technet.microsoft.com/en-US/library/ee210754.aspx"&gt;here&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-01-27T15:59:51Z</a10:updated></item><item><guid isPermaLink="false">02dd4791-94bb-4334-8816-25ef9a180929</guid><link>http://sqlservice.se/sv/start/blogg/nya-uppdateringar-for-sql-server-2008.aspx?lang=sv</link><title>Nya uppdateringar för SQL Server 2008</title><description>&lt;p&gt;Innan jul kom nya uppdateringar f&amp;ouml;r SQL Server och nu &amp;auml;r det dags igen. Denna g&amp;aring;ng f&amp;ouml;r SQL Server 2008 och SP3. Vi har nu kommit till kumulativa uppdateringen nr 9 f&amp;ouml;r den installationen, allts&amp;aring; enbart SQL Server 2008 SP3&lt;/p&gt;&#xD;
&lt;p&gt;Den hittar man nedan, och nu har man l&amp;ouml;st 9 fel t.ex.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #ff0000;"&gt;FIX: Incorrect result is returned when you query an indexed view by using the NOEXPAND hint in SQL Server 2008&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2799883"&gt;SQL Server 2008 Service Pack 3 Cumulative Update 9&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Som vanligt g&amp;auml;ller det att alltid testa innan man g&amp;ouml;r f&amp;ouml;r&amp;auml;ndringar i sin produktionsmilj&amp;ouml;, och d&amp;aring; f&amp;ouml;rst&amp;nbsp;t.ex. i sin testmilj&amp;ouml;.&lt;/p&gt;</description><a10:updated>2013-01-26T16:41:58Z</a10:updated></item><item><guid isPermaLink="false">372a6209-5022-41d1-8883-cc7082c0ffbb</guid><link>http://sqlservice.se/sv/start/blogg/certificate-expiry-date.aspx?lang=sv</link><title>Certificate expiry date</title><description>&lt;p&gt;If you have a Database Mirroring setup or use Service Broker you may use certificates for endpoint authentication.&lt;/p&gt;&#xD;
&lt;p&gt;To create a certificate run:&lt;br /&gt;CREATE CERTIFICATE [SQLService] ENCRYPTION BY PASSWORD = 'YourStrongPassword' WITH SUBJECT = 'SQLService certified certificate'&lt;/p&gt;&#xD;
&lt;p&gt;When you run this a certificate is created. &lt;br /&gt;If we query sys.certificates and take a look at what we created we can see the following:&lt;/p&gt;&#xD;
&lt;p&gt;select name, pvt_key_encryption_type_desc, start_date, expiry_date,is_active_for_begin_dialog from sys.certificates where name = 'SQLService'&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=85595909-e4b2-4ea4-a87d-68467b890f88&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;What we can see here is that our certificate is created and that we have a start date and expiry date. Since i didn't set these when i created the certificate it's created with default values which is the same start date as when i created it and the expiry date is one year later.&lt;/p&gt;&#xD;
&lt;p&gt;It might come as a surprise when your certificate suddenly has expired and your endpoints stops working and your database mirroring stops, not a very pleasant feeling.&lt;/p&gt;&#xD;
&lt;p&gt;So one thing to keep in mind is that whenever you create a new certificate make sure you set the expiry date.&lt;/p&gt;</description><a10:updated>2013-01-25T13:03:06Z</a10:updated></item><item><guid isPermaLink="false">e74bdf46-c94e-4715-8e0b-c497978ddea2</guid><link>http://sqlservice.se/sv/start/blogg/dax-in-the-bi-tabular-model.aspx?lang=sv</link><title>DAX in the BI Tabular Model</title><description>&lt;p&gt;Det spr&amp;aring;k vi har att anv&amp;auml;nda i &lt;strong&gt;SQL Server Data Tools&lt;/strong&gt; och nya &lt;strong&gt;Tabular model projects&lt;/strong&gt; heter som bekant &lt;strong&gt;DAX&lt;/strong&gt;, Data Analysis Expressions. Sedan n&amp;aring;gra dagar finns det m&amp;ouml;jlighet att ladda ner ett whitepaper samt gott om exempel p&amp;aring; hur detta spr&amp;aring;k anv&amp;auml;nds.&lt;/p&gt;&#xD;
&lt;p&gt;Detta hittar man h&amp;auml;r:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=28572&amp;amp;utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed%3A+MicrosoftDownloadCenter+%28Microsoft+Download+Center%29#tm"&gt;http://www.microsoft.com/en-us/download/details.aspx?id=28572&amp;amp;utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed%3A+MicrosoftDownloadCenter+%28Microsoft+Download+Center%29#tm&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-01-25T11:05:10Z</a10:updated></item><item><guid isPermaLink="false">bf9dabf2-b29f-499c-8375-5599181a66b8</guid><link>http://sqlservice.se/sv/start/blogg/the-maximum-systemgenerated-unique-value-for-a-duplicate-group-was-exceeded.aspx?lang=sv</link><title>The maximum system-generated unique value for a duplicate group was exceeded  </title><description>&lt;p&gt;Meddelandet nedan ser man inte s&amp;aring; ofta, tack och lov. Dock har jag nu st&amp;ouml;tt p&amp;aring; det.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #ff0000;"&gt;Msg 666, Level 16, State 2, The maximum system-generated unique value for a duplicate group was exceeded for index with partition ID 72057594604617728. Dropping and re-creating the index may resolve this; otherwise, use another clustering key.&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Detta intr&amp;auml;ffade i en gigantisk tabell, partitionerad p&amp;aring; period (&amp;aring;r + m&amp;aring;nad). Det inneb&amp;auml;r ett klustrat index p&amp;aring; i det h&amp;auml;r fallet enbart period, som f&amp;ouml;rst&amp;aring;s inte &amp;auml;r ett unikt v&amp;auml;rde. Allts&amp;aring; m&amp;aring;ste SQL Server l&amp;auml;gga p&amp;aring; en sk &lt;strong&gt;Uniqueifier&lt;/strong&gt; f&amp;ouml;r att det klustrade indexet skall bli unikt.&lt;/p&gt;&#xD;
&lt;p&gt;Om detta kan man l&amp;auml;sa mer &lt;a href="http://robboek.com/2009/02/13/sql-server-uniqueifier-values-and-the-number-of-the-beast/"&gt;h&amp;auml;r&lt;/a&gt; och som framg&amp;aring;r d&amp;auml;r och fr&amp;aring;n Books Online :&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;If the clustered index is not created with the UNIQUE property, the Database Engine automatically adds a 4-byte uniqueifier column to the table. When it is required, the Database Engine automatically adds a uniqueifier value to a row to make each key unique. This column and its values are used internally and cannot be seen or accessed by users.&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Som framg&amp;aring;tt av l&amp;auml;nken ovan s&amp;aring; finns det en maxgr&amp;auml;ns f&amp;ouml;r 4 294 967 296 innan man skall f&amp;aring; detta meddelandet. Fr&amp;aring;gan kommer d&amp;aring;, "Har vi n&amp;aring;tt denna gr&amp;auml;ns och vilken partition &amp;auml;r det egentligen som sp&amp;ouml;kar ?".&lt;/p&gt;&#xD;
&lt;p&gt;Med hj&amp;auml;lp av denna fr&amp;aring;ga ser man f&amp;ouml;r vilken partition som vi n&amp;aring;tt maxgr&amp;auml;nsen :&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;&amp;nbsp;SELECT &#xD;
           p.partition_number AS [PartitionNumber],&#xD;
           p.data_compression_desc AS [DataCompression],&#xD;
           prv.value AS [RightBoundaryValue],&#xD;
           fg.name AS [FileGroupName],&#xD;
           CAST(p.rows AS float) AS [RowCount],&#xD;
           p.object_id,&#xD;
           p.partition_id,&#xD;
           idx.name AS Index_name&#xD;
           &#xD;
FROM&#xD;
           sys.tables AS tbl&#xD;
           INNER JOIN sys.indexes AS idx ON &#xD;
		idx.object_id = tbl.object_id AND &#xD;
		idx.type_desc = 'CLUSTERED'&#xD;
           INNER JOIN sys.partitions AS p ON &#xD;
		p.object_id=CAST(tbl.object_id AS int) AND &#xD;
		p.index_id=idx.index_id&#xD;
           INNER JOIN sys.indexes AS indx ON &#xD;
		p.object_id = indx.object_id AND &#xD;
		p.index_id = indx.index_id&#xD;
           LEFT OUTER JOIN sys.destination_data_spaces AS dds ON &#xD;
		dds.partition_scheme_id = indx.data_space_id and &#xD;
		dds.destination_id = p.partition_number&#xD;
           LEFT OUTER JOIN sys.partition_schemes AS ps ON &#xD;
		ps.data_space_id = indx.data_space_id&#xD;
           LEFT OUTER JOIN sys.partition_range_values AS prv ON &#xD;
		prv.boundary_id = p.partition_number and &#xD;
		prv.function_id = ps.function_id&#xD;
           LEFT OUTER JOIN sys.filegroups AS fg ON  &#xD;
		fg.data_space_id = dds.data_space_id or &#xD;
		fg.data_space_id = indx.data_space_id&#xD;
&lt;/pre&gt;&#xD;
&lt;p&gt;Detta visar att v&amp;aring;r felande partition inneh&amp;aring;ller ca 700 000 rader och &amp;auml;r allts&amp;aring; l&amp;aring;ngt fr&amp;aring;n maxgr&amp;auml;nsen p&amp;aring; 4 294 967 296.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;F&amp;ouml;rsta testen&lt;/strong&gt; f&amp;ouml;r att fixa detta problem &amp;auml;r att enbart bygga om den felande partitionen f&amp;ouml;r att tj&amp;auml;na tid.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;ALTER INDEX [indexnamn] ON [dbo].[tabellnamn] REBUILD PARTITION = partitionsnr&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Detta hj&amp;auml;lper inte.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;N&amp;auml;sta test&lt;/strong&gt; &amp;auml;r att bygga om hela det klustrade indexet.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;ALTER INDEX [indexnamn] ON [dbo].[tabellnamn] REBUILD PARTITION = ALL&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Tyv&amp;auml;rr hj&amp;auml;lper inte detta heller.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Till slut kommer h&amp;auml;r l&amp;ouml;sningen&lt;/strong&gt;, som inneb&amp;auml;r att man anv&amp;auml;nder en temptabell f&amp;ouml;r att flytta allt data fr&amp;aring;n partitionen, t&amp;ouml;mma dessa i orginaltabellen f&amp;ouml;r att till slut l&amp;auml;sa tillbaka allt.&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;SELECT *&#xD;
INTO tmp_201212&#xD;
FROM Fact&#xD;
WHERE Period = 201212&#xD;
 &#xD;
DELETE&#xD;
FROM Fact&#xD;
WHERE Period = 201212&#xD;
 &#xD;
INSERT INTO Fact&#xD;
(...)&#xD;
SELECT *&#xD;
FROM tmp_201212&#xD;
&lt;/pre&gt;</description><a10:updated>2013-01-25T07:42:29Z</a10:updated></item><item><guid isPermaLink="false">df259afb-03ab-4184-b3c5-b1b6b07bda5b</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-performance--missing-indexes.aspx?lang=sv</link><title>SQL Server performance - missing indexes</title><description>&lt;p&gt;As you already know by now, indexes are very important for SQL server performance, and finding the best indexes can be hard and time consuming. There are some tools that can help you or make things even worse. Some of the tools you can use are included in the SQL server platform, like:&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;Database engine tuning advisor&lt;/li&gt;&#xD;
&lt;li&gt;Missing index DMV:s&lt;/li&gt;&#xD;
&lt;li&gt;Estimated / Actual Execution plan&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;They all have capabilities to give you suggestions of indexes, but they also have their issues. I will not describe these features in detail, but if you use these tools to implement all the suggested indexes you can even decrease the performance. They give you suggestions and you still have to test the performance before and after.&lt;/p&gt;&#xD;
&lt;table border="1" cellspacing="0" cellpadding="0"&gt;&#xD;
&lt;tbody&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td valign="top" width="201"&gt;&#xD;
&lt;p&gt;Tool&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td valign="top" width="201"&gt;&#xD;
&lt;p&gt;Benefit&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td valign="top" width="201"&gt;&#xD;
&lt;p&gt;Concern&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td valign="top" width="201"&gt;&#xD;
&lt;p&gt;Database Tuning &amp;nbsp; advisor&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td valign="top" width="201"&gt;&#xD;
&lt;p&gt;Give you good &amp;nbsp; suggestions&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td valign="top" width="201"&gt;&#xD;
&lt;p&gt;-Uses a lot of &amp;nbsp; resources&lt;/p&gt;&#xD;
&lt;p&gt;-Give you a lot of &amp;nbsp; similar indexes&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td valign="top" width="201"&gt;&#xD;
&lt;p&gt;Missing indexes&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td valign="top" width="201"&gt;&#xD;
&lt;p&gt;Give you good &amp;nbsp; suggestions based on execution plans from the cache&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td valign="top" width="201"&gt;&#xD;
&lt;p&gt;Give you a lot of &amp;nbsp; similar indexes&lt;/p&gt;&#xD;
&lt;p&gt;Gives you suggestion &amp;nbsp; of indexes that already exists because one of the columns need a different &amp;nbsp; sort order, but there is no suggestion of the sort order&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td valign="top" width="201"&gt;&#xD;
&lt;p&gt;Estimated or Actual &amp;nbsp; Execution plan&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td valign="top" width="201"&gt;&#xD;
&lt;p&gt;Give you the &amp;nbsp; suggestion of index of the query you are running right now&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td valign="top" width="201"&gt;&#xD;
&lt;p&gt;Doesn&amp;rsquo;t display all &amp;nbsp; the missing indexes for the query and you have to implement the index and &amp;nbsp; execute one more time to get the next suggestion.&lt;/p&gt;&#xD;
&lt;p&gt;The index suggestion &amp;nbsp; is not displayed for the actual statement that needs the index&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;/tbody&gt;&#xD;
&lt;/table&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;There is a connect item for the missing index DMV, please vote for it at :&lt;/p&gt;&#xD;
&lt;p&gt;The problem with the estimated or actual execution plan is that you can only see one suggestion at the time and it&amp;rsquo;s not correlated with the statement.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;img src="../ci.axd?sid=fd95675d-019a-496d-8a24-5e1ca19b6337&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;In SQL server 2012 you can get all the missing indexes in the estimated or actual execution plan GUI, but not in SQL server 2008. BUT you can find all the missing indexes in the execution plan XML, just right click the exection plan and click the &amp;ldquo;Show Execution Plan XML&amp;rdquo; menu item, search the XML for MissingIndex and you&amp;rsquo;ll find all of them! It&amp;rsquo;s only a GUI issue, all the information is in the XML plan.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;img src="../ci.axd?sid=8278bd67-1b08-4314-aac8-efbe37cc9561&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;How can you use this information? Well, if you now how to write some XQueries you can actually list all the missing indexes with the SQL statement attached. With this list you can investigate your index based on the statement that needs it. You can actually query the cache for all execution plans that have missing index suggestions, but beware, it is a heavy query that can cause performance issues during the execution. &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;The best solution is to pick the worst performing queries from the cache by using the sys.dm_exec_procedure_stats DMV and store the result in a temp table with an XML index.&lt;/p&gt;&#xD;
&lt;p&gt;Using XML in SQL server can be tricky unless you are very skilled in XQuery and I would like to help you a little bit to get started. In the following code, I have removed some interesting statements for other interesting information in the XML plan.&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;/*&#xD;
&#xD;
SELECT  top 10 OBJECT_NAME([ps].[object_id], [ps].[database_id]), DB_NAME(database_id), *&#xD;
FROM    sys.dm_exec_procedure_stats ps&#xD;
CROSS APPLY sys.dm_exec_query_plan(ps.plan_handle) qp&#xD;
order by ps.[last_logical_reads] desc&#xD;
&#xD;
*/&#xD;
&#xD;
CREATE PROCEDURE DBO.[spCheckSP](@dbName sysname, @schemaName sysname, @procedureName sysname)&#xD;
AS&#xD;
  -- +----------------------------------------------------------------------------------------------------------------&#xD;
  -- ! O b j e c t                                            [ADMIN].[spCheckSP}&#xD;
  -- ! R e t u r n s                                          INT&#xD;
  -- ! P a r a m e t e r s           Name, DataType, Description&#xD;
  -- + =========================================================================================&#xD;
  -- !                                                                                             @dbName                                           sysname&#xD;
  -- !                                                                                             @schemaName                          sysname&#xD;
  -- !                                                                                             @procedureName                       sysname&#xD;
  -- + ---------------------------------------------------------------------------------------------------------------&#xD;
  -- ! O b j e c t i v e    &#xD;
  -- + ---------------------------------------------------------------------------------------------------------------&#xD;
  -- !   S A M P L E&#xD;
  -- !                                                                     EXEC [ADMIN].[spCheckSP] 'AdventureWorks2008R2', 'Sales', 'uspGetBillOfMaterials'&#xD;
  -- + ---------------------------------------------------------------------------------------------------------------&#xD;
  -- ! H i s t o r y                                                       Date                    Who         What&#xD;
  -- +========== ===== =========================================================================&#xD;
  -- !                                                                     2011-01-26  HAWI            Initial version ...&#xD;
  -- + ---------------------------------------------------------------------------------------------------------------&#xD;
&#xD;
SET NOCOUNT ON;&#xD;
 &#xD;
&#xD;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED&#xD;
            DECLARE @objectName SYSNAME = @dbName + '.' + @schemaName + '.' + @procedureName&#xD;
            SELECT ProcedureName = @objectName;&#xD;
 &#xD;
&#xD;
           SELECT&#xD;
                         query_plan = CONVERT(XML,qp.query_plan),&#xD;
                         ps.*&#xD;
            INTO #tmpPlan&#xD;
            FROM sys.dm_exec_procedure_stats ps&#xD;
            CROSS APPLY sys.dm_exec_query_plan(ps.plan_handle) qp&#xD;
            WHERE OBJECT_ID = OBJECT_ID(@objectName)&#xD;
            AND database_id = DB_ID(@dbName);&#xD;
 &#xD;
&#xD;
            SELECT * FROM [#tmpPlan];&#xD;
 &#xD;
&#xD;
 &#xD;
&#xD;
            ----------------------------------------------------------------------------------------------------------------&#xD;
            -- get missing index stats&#xD;
            ----------------------------------------------------------------------------------------------------------------&#xD;
            WITH XMLNAMESPACES (DEFAULT 'http://schemas.microsoft.com/sqlserver/2004/07/showplan')&#xD;
            ,cteMissingIndexes&#xD;
            AS (&#xD;
                          SELECT tp.query_plan --, cp.usecounts&#xD;
                          FROM #tmpPlan tp  &#xD;
                          WHERE tp.query_plan.exist('//MissingIndex')=1&#xD;
            )&#xD;
            SELECT&#xD;
                         databaseName             = stmt.value('(.//MissingIndex/@Database)[1]', 'sysname'),&#xD;
                         [schemaName]             = stmt.value('(.//MissingIndex/@Schema)[1]', 'sysname'),&#xD;
                         [tableName]                          = stmt.value('(.//MissingIndex/@Table)[1]', 'sysname'),&#xD;
                         sql_text                                          = stmt.value('(@StatementText)[1]', 'VARCHAR(4000)'),&#xD;
                         impact                                            = stmt.value('(.//MissingIndexGroup/@Impact)[1]', 'FLOAT'),&#xD;
                         stmt.query('for $group in .//ColumnGroup&#xD;
                                       for $column in $group/Column&#xD;
                                       where $group/@Usage="EQUALITY"&#xD;
                                       return string(&lt;a href="mailto:$column/@Name"&gt;$column/@Name&lt;/a&gt;)&#xD;
                                       ').value('.', 'varchar(max)') AS equality_columns&#xD;
                          ,stmt.query('for $group in .//ColumnGroup&#xD;
                                       for $column in $group/Column&#xD;
                                       where &lt;a href="mailto:$group/@Usage=&amp;quot;INEQUALITY"&gt;$group/@Usage="INEQUALITY&lt;/a&gt;"&#xD;
                                       return string(&lt;a href="mailto:$column/@Name"&gt;$column/@Name&lt;/a&gt;)&#xD;
                                       ').value('.', 'varchar(max)') AS inequality_columns&#xD;
                          ,stmt.query('for $group in .//ColumnGroup&#xD;
                                       for $column in $group/Column&#xD;
                                       where &lt;a href="mailto:$group/@Usage=&amp;quot;INCLUDE"&gt;$group/@Usage="INCLUDE&lt;/a&gt;"&#xD;
                                       return string(&lt;a href="mailto:$column/@Name"&gt;$column/@Name&lt;/a&gt;)&#xD;
                                       ').value('.', 'varchar(max)') AS include_columns&#xD;
                          ,pmi.query_plan&#xD;
            FROM cteMissingIndexes pmi&#xD;
                          CROSS APPLY pmi.query_plan.nodes('//StmtSimple') AS qp(stmt)&#xD;
            WHERE stmt.exist('.//MissingIndex/ColumnGroup[@Usage="EQUALITY"]')=1 OR stmt.exist('.//MissingIndex/ColumnGroup[@Usage="INEQUALITY"]')=1&#xD;
            UNION ALL&#xD;
            SELECT&#xD;
                         databaseName             = stmt.value('(.//MissingIndex/@Database)[1]', 'sysname'),&#xD;
                         [schemaName]             = stmt.value('(.//MissingIndex/@Schema)[1]', 'sysname'),&#xD;
                         [tableName]                          = stmt.value('(.//MissingIndex/@Table)[1]', 'sysname'),&#xD;
                         sql_text                                          = stmt.value('(@StatementText)[1]', 'VARCHAR(4000)'),&#xD;
                         impact                                            = stmt.value('(.//MissingIndexGroup/@Impact)[1]', 'FLOAT'),&#xD;
                         stmt.query('for $group in .//ColumnGroup&#xD;
                                       for $column in $group/Column&#xD;
                                       where &lt;a href="mailto:$group/@Usage=&amp;quot;EQUALITY"&gt;$group/@Usage="EQUALITY&lt;/a&gt;"&#xD;
                                       return string(&lt;a href="mailto:$column/@Name"&gt;$column/@Name&lt;/a&gt;)&#xD;
                                       ').value('.', 'varchar(max)') AS equality_columns&#xD;
                          ,stmt.query('for $group in .//ColumnGroup&#xD;
                                       for $column in $group/Column&#xD;
                                       where &lt;a href="mailto:$group/@Usage=&amp;quot;INEQUALITY"&gt;$group/@Usage="INEQUALITY&lt;/a&gt;"&#xD;
                                       return string(&lt;a href="mailto:$column/@Name"&gt;$column/@Name&lt;/a&gt;)&#xD;
                                       ').value('.', 'varchar(max)') AS inequality_columns&#xD;
                          ,stmt.query('for $group in .//ColumnGroup&#xD;
                                       for $column in $group/Column&#xD;
                                       where &lt;a href="mailto:$group/@Usage=&amp;quot;INCLUDE"&gt;$group/@Usage="INCLUDE&lt;/a&gt;"&#xD;
                                       return string(&lt;a href="mailto:$column/@Name"&gt;$column/@Name&lt;/a&gt;)&#xD;
                                       ').value('.', 'varchar(max)') AS include_columns&#xD;
                          ,pmi.query_plan&#xD;
            FROM cteMissingIndexes pmi&#xD;
                          CROSS APPLY pmi.query_plan.nodes('//StmtCond') AS qp(stmt)&#xD;
            WHERE stmt.exist('.//MissingIndex/ColumnGroup[@Usage="EQUALITY"]')=1 OR stmt.exist('.//MissingIndex/ColumnGroup[@Usage="INEQUALITY"]')=1;&#xD;
 &#xD;
&lt;/pre&gt;&#xD;
&lt;p&gt;As you can see, you need to query two different nodes (StmtSimple and StmtCond) to get all the missing indexes. The result might look something like this when you pass the name of a stored procedure into this procedure I gave you.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=689c049a-73c9-4673-bd3c-72d4557a2216&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;In this case, I have to statements that need an index each and I can investigate the query to see if I need to change something in the query or if I should create the index. The Impact is an estimate on how many percent improvement the index would give you, but it should be handled as a guess based and it is based on statistics. (read my other blog posts about statistics to understand why this not to be trusted.)&lt;/p&gt;&#xD;
&lt;p&gt;If you give me positive feedback (on twitter or as a comment) of the blog post, I&amp;rsquo;ll consider to post some other blog posts with other interesting parts of the XML plan and queries to extract it.&lt;/p&gt;&#xD;
&lt;p&gt;/H&amp;aring;kan Winther&lt;br /&gt;twitter: @h_winther&lt;/p&gt;</description><a10:updated>2013-01-24T12:56:33Z</a10:updated></item><item><guid isPermaLink="false">e3a9c74c-700f-4029-8550-072c2deb909e</guid><link>http://sqlservice.se/sv/start/blogg/new-update-for-redgate-sql-source-control.aspx?lang=sv</link><title>New update for Red-Gate SQL Source Control</title><description>&lt;p&gt;Red-Gate released a new update for SQL Source Control with some improvements.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;New in SQL Source Control 3.1.0:&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;&lt;strong&gt;Shared Model Improvements.&lt;/strong&gt; A more reliable and less resource-intensive method for giving the username for changes in the shared model.&lt;/li&gt;&#xD;
&lt;li&gt;&lt;strong&gt;Support for TFS 2012, including Team Foundation Service.&lt;/strong&gt; Link databases to TFS 2012 servers, including those hosted at tfs.visualstudio.com (formerly tfspreview.com).&lt;/li&gt;&#xD;
&lt;li&gt;&lt;strong&gt;Support for Vault 6.&lt;/strong&gt; Link databases to Vault 6 Standard and Vault 6 Pro servers.&lt;/li&gt;&#xD;
&lt;li&gt;&lt;strong&gt;Commit and Get Latest database comparision options.&lt;/strong&gt;&lt;/li&gt;&#xD;
&lt;li&gt;&lt;strong&gt;Bug fixes.&lt;/strong&gt;&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;The update can be downloaded from &lt;a href="http://www.red-gate.com/updatecontrols/details?etc=627127226&amp;amp;guid=d13a9ba7-c46d-491f-9aad-69ff2fbc046b&amp;amp;update=463"&gt;http://www.red-gate.com/updatecontrols/details?etc=627127226&amp;amp;guid=d13a9ba7-c46d-491f-9aad-69ff2fbc046b&amp;amp;update=463&lt;/a&gt;&amp;nbsp;or from inside the SQL Source Contol GUI.&lt;/p&gt;</description><a10:updated>2013-01-22T09:25:39Z</a10:updated></item><item><guid isPermaLink="false">fbbb24d5-50f3-4769-8525-6e83b4a2103f</guid><link>http://sqlservice.se/sv/start/blogg/free-sql-server-tablediff-tool.aspx?lang=sv</link><title>Free SQL Server tablediff tool</title><description>&lt;p&gt;Sometimes you need to compare the schema or contents of two tables. There are many good tools for that available, but you might be a little surprised to find out that there is actually a free tool for that included with &lt;a href="http://www.microsoft.com/sql"&gt;Microsoft SQL Server&lt;/a&gt;. It is command line based, and the file to run is called Tablediff.exe. It is located in the C:\Program Files\Microsoft SQL Server\110\COM\ folder (For SQL Server 2012 that is).&lt;/p&gt;&#xD;
&lt;p&gt;Basically it can compare 2 tables, both the schema and the data. And it can log errors to file or table, and even give you a SQL Server scriptfile that you can run on the destination database to make the changes needed for the 2 tables to be identical if any differences should be found.&lt;/p&gt;&#xD;
&lt;p&gt;A simple syntax example, that compares the sysjobshistory table in MSDB between SQLSERVER1 and SQLSERVER2 SQL Server instances. It does not specify any login information, so it will run with the Windows account of the logged on account execution it. And if differences are found, a script will be created in c:\temp\tablediff.sql that will make the destination database identical to the source database:&amp;nbsp;&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;&lt;strong&gt;"C:\Program Files\Microsoft SQL Server\110\COM\tablediff.exe" -sourceserver SQLSERVER1 -sourcedatabase msdb -sourceschema dbo -sourcetable sysjobhistory -destinationserver SQLSERVER2 -destinationdatabase msdb -destinationschema dbo -destinationtable sysjobhistory -f c:\temp\tablediff.sql&lt;/strong&gt;&lt;/pre&gt;&#xD;
&lt;p&gt;It can for example be used to check for differences in replicated tables, but that only works if you replicate all columns or else the schemas of the two tables are so different that you get an error.&lt;/p&gt;&#xD;
&lt;p&gt;The full documentation of Tablediff.exe can be found &lt;a href="http://msdn.microsoft.com/en-us/library/ms162843(v=sql.110).aspx"&gt;here&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2013-01-20T14:19:03Z</a10:updated></item><item><guid isPermaLink="false">dd41391e-e3ea-4e16-bd5d-5ee569ead84e</guid><link>http://sqlservice.se/sv/start/blogg/analyze-query-in-database-engine-tuning-advisor.aspx?lang=sv</link><title>Analyze Query in Database Engine Tuning Advisor</title><description>&lt;p&gt;Ett av verktygen som l&amp;auml;nge har f&amp;ouml;ljt med till SQL Server &amp;auml;r "Database Tuning Advisor" eller DTA som man oftare s&amp;auml;ger. Det vanligaste s&amp;auml;tter man anv&amp;auml;nder DTA p&amp;aring; &amp;auml;r att&amp;nbsp;f&amp;ouml;rst skapa en tracefil och sedan anv&amp;auml;nda denna, f&amp;ouml;r att i slut&amp;auml;ndan f&amp;aring; en lista p&amp;aring; rekommendationer samt skript genererade. Det avsl&amp;ouml;jar sig ganska snabbt om man har f&amp;ouml;rs&amp;ouml;kt anv&amp;auml;nda detta verktyg f&amp;ouml;r att optimera sin milj&amp;ouml; eftersom alla nya &amp;auml;ndringar f&amp;aring;r en viss namnstandard som vi kommer se l&amp;auml;ngre ned.&lt;/p&gt;&#xD;
&lt;p&gt;F&amp;ouml;rutom en tracefil g&amp;aring;r det ocks&amp;aring; att markera en sql-fr&amp;aring;ga, klicka h&amp;ouml;ger mus och sedan v&amp;auml;lja menyalternativet "&lt;strong&gt;Analyze Query in Database Engine Tuning Advisor&lt;/strong&gt;" f&amp;ouml;r att anv&amp;auml;nda DTA.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=59ebfbfb-18af-42dc-8e80-03e8b775dd5e&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Tyv&amp;auml;rr &amp;auml;r inte detta verktyg vidare smart och kan st&amp;auml;lla till det rej&amp;auml;lt, som jag visar av detta exempel.&lt;/p&gt;&#xD;
&lt;p&gt;Jag har en befintlig fr&amp;aring;ga som returnerar 201 rader och ger detta resultat:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Table 'Fact_Demo'. Scan count 4, logical reads 53393 ... ...&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;&amp;nbsp;SQL Server Execution Times: &amp;nbsp;&amp;nbsp; CPU time = 890 ms,&amp;nbsp; elapsed time = 977 ms.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;DTA ger rekommendationen att skapa ett nytt index samt en m&amp;auml;ngd uppdatering av statistiken f&amp;ouml;r tabellen ovan dvs Fact_Demo.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=2421e7f2-e6f5-496d-91f7-f186b40738f4&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;CREATE NONCLUSTERED INDEX [_dta_index_Fact__demo_10_1655676946__K1_K11_K13_K3_K2_K19_K10_&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;K17_K4_K18_K14_K15_K20_K23_24_25_26] ON [dbo].[Fact_demo] ( &amp;nbsp;[Col1] ASC, &amp;nbsp;[Col2] ASC, &amp;nbsp;[Col3] ASC, &amp;nbsp;[Col4] ASC, &amp;nbsp;[Col5] ASC, &amp;nbsp;[Col6] ASC, &amp;nbsp;[Col7] ASC, &amp;nbsp;[Col8] ASC, &amp;nbsp;[Col9] ASC, &amp;nbsp;[Col10] ASC, &amp;nbsp;[Col11] ASC, &amp;nbsp;[Col12] ASC, &amp;nbsp;[Col13] ASC, &amp;nbsp;[Col14] ASC ) INCLUDE ( [Col15], [Col16], [Col17] ) WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [Demo]&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Efter ha implementerat alla &amp;auml;ndringar som DTA f&amp;ouml;resl&amp;aring;r s&amp;aring; f&amp;aring;r jag nu detta resultat n&amp;auml;r jag k&amp;ouml;r fr&amp;aring;gan igen:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Table 'Fact_Demo'. Scan count 406, logical reads 158390 ... ...&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;&amp;nbsp;SQL Server Execution Times: &amp;nbsp;&amp;nbsp; CPU time = 60466 ms,&amp;nbsp; elapsed time = 64033 ms.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Detta inneb&amp;auml;r en klar f&amp;ouml;rs&amp;auml;mring p&amp;aring; ungef&amp;auml;r &lt;strong&gt;65&lt;/strong&gt; g&amp;aring;nger efter ha litat blint p&amp;aring; detta verktyg och inte riktigt vad man ville :-).&lt;/p&gt;&#xD;
&lt;p&gt;B&amp;auml;ttre &amp;auml;r d&amp;aring; att l&amp;auml;ra sig om hur man optimerar sin milj&amp;ouml; ist&amp;auml;llet f&amp;ouml;r att lita blint s&amp;aring;dana h&amp;auml;r verktyg och&amp;nbsp;ett s&amp;auml;tt &amp;auml;tt g&amp;ouml;ra detta &amp;auml;r f&amp;ouml;rst&amp;aring;s att &lt;a href="http://www.sqlservice.se/sv/start/kontakta-oss.aspx"&gt;kontakta oss&lt;/a&gt;.&lt;/p&gt;&#xD;
&lt;p&gt;Vi ser alltf&amp;ouml;r ofta n&amp;auml;mligen en m&amp;auml;ngd index med namn som b&amp;ouml;rjar med "_dta_index..." och dessa &amp;auml;r troligen inte de mest optimala som vi har sett av exemplet ovan.&lt;/p&gt;</description><a10:updated>2013-01-18T14:33:49Z</a10:updated></item><item><guid isPermaLink="false">c2c3b6b3-84e2-4d93-9ac7-2c69524ddb09</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-certifieringar.aspx?lang=sv</link><title>SQL Server certifieringar</title><description>&lt;p&gt;Snart &amp;auml;r det f&amp;ouml;r sent att certfiera sig p&amp;aring; SQL Server 2008. Den 31/7 2013 upph&amp;ouml;r n&amp;auml;mligen m&amp;ouml;jligheten att ta nedanst&amp;aring;ende certfieringar, s&amp;aring; det &amp;auml;r h&amp;ouml;g tid att redan nu b&amp;ouml;rja planera f&amp;ouml;r detta om man har detta som m&amp;aring;l, och det har vi f&amp;ouml;rst&amp;aring;s p&amp;aring; SQL Service.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Microsoft Certified Technology Specialist (MCTS):&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;MCTS: &lt;a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-432"&gt;70-432&lt;/a&gt; Implementation and Maintenance&lt;/li&gt;&#xD;
&lt;li&gt;MCTS: &lt;a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-433"&gt;70-433&lt;/a&gt; Database Development&lt;/li&gt;&#xD;
&lt;li&gt;MCTS: &lt;a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-448"&gt;70-448&lt;/a&gt; Business Intelligence Development and Maintenance&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Microsoft Certified IT Professional (MCITP)&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;MCITP: Database Administrator 2008&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;PRO: &lt;a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-450"&gt;70-450&lt;/a&gt; Designing, Optimizing and Maintaining a Database Server Infrastructure Using Microsoft SQL Server 2008&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp; MCITP: Database Developer 2008&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;PRO: &lt;a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-451"&gt;70-451&lt;/a&gt; Designing Database Solutions and Data Access Using Microsoft SQL Server 2008&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;MCITP: Business Intelligence Developer 2008&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;PRO: &lt;a href="http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-452"&gt;70-452&lt;/a&gt; Designing a Business Intelligence Infrastructure Using Microsoft SQL Server 2008&lt;/li&gt;&#xD;
&lt;/ul&gt;</description><a10:updated>2013-01-18T14:32:20Z</a10:updated></item><item><guid isPermaLink="false">efcfcac6-2ae3-4753-b476-efdc8cb882d7</guid><link>http://sqlservice.se/sv/start/blogg/databaser-i-ssms-object-explorer.aspx?lang=sv</link><title>Databaser i SSMS Object Explorer</title><description>&lt;p&gt;Antag att du har ett databashotell med ett flertal olika kunder. I detta scenario vill man s&amp;auml;kerligen begr&amp;auml;nsa r&amp;auml;ttigheterna f&amp;ouml;r de olika kunderna s&amp;aring; att de bara har tillg&amp;aring;ng till sin egen databas.&lt;br /&gt;Man kan skapa login f&amp;ouml;r anv&amp;auml;ndaren och tilldela beh&amp;ouml;righet i de databaser som &amp;auml;r aktuella. Detta fungerar fint, anv&amp;auml;ndaren kan logga in i Management Studio och kommer bara &amp;aring;t just de databaser som d&amp;auml;r vi tilldelat r&amp;auml;ttigheter.&lt;/p&gt;&#xD;
&lt;p&gt;Men anv&amp;auml;ndaren kan ju fortfarande se alla andra databaser i Management Studio Object Explorer, hur &amp;aring;tg&amp;auml;rdar vi det? &lt;br /&gt;I ett databashotell med m&amp;aring;nga olika kunder kanske man inte vill visa tex hur m&amp;aring;nga databaser som finns eller namnen p&amp;aring; de andra databaserna etc.&lt;/p&gt;&#xD;
&lt;p&gt;F&amp;ouml;r att begr&amp;auml;nsa vad en anv&amp;auml;ndare kan se i Management Studio Object Explorer kan man k&amp;ouml;ra f&amp;ouml;ljande: &lt;br /&gt;Antag att jag har en databas som heter SQLService och ett login som heter SQLService med begr&amp;auml;nsade r&amp;auml;ttigheter.&lt;/p&gt;&#xD;
&lt;p&gt;DENY VIEW ANY DATABASE TO [SQLService];&lt;/p&gt;&#xD;
&lt;p&gt;Om jag nu loggar in i Management Studio med mitt login (SQLService) och expanderar databastr&amp;auml;det kan jag inte se n&amp;aring;gon databas, bara systemdatabaserna master och tempdb. &lt;br /&gt;EX:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=f13af5ad-9e42-4bc6-ad7c-b3b1fcb477eb&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Trots att jag har beh&amp;ouml;righet i databasen kan jag allts&amp;aring; inte se den. Provar nu att s&amp;auml;tta min anv&amp;auml;ndare som databas&amp;auml;gare: &lt;br /&gt;&lt;br /&gt;ALTER AUTHORIZATION ON DATABASE::SQLService TO SQLService;&lt;/p&gt;&#xD;
&lt;p&gt;Nu kan jag se min egen databas och ingen annan. &lt;br /&gt;EX:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=c6bccf74-7f23-4066-9c68-d2244315c499&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Denna l&amp;ouml;sning &amp;auml;r v&amp;auml;l inte helt hundraprocentig, att s&amp;auml;tta om databas&amp;auml;gare till n&amp;aring;got annat &amp;auml;n sa kanske inte &amp;auml;r &amp;ouml;nskv&amp;auml;rt ur alla synvinklar. Man hade hoppats p&amp;aring; att detta kunde var implementerat lite b&amp;auml;ttre, finns &amp;auml;ven ett connect item anslaget av v&amp;aring;r Svenske hj&amp;auml;lte Erland Sommarskog:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=273830"&gt;http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=273830&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2013-01-18T11:39:15Z</a10:updated></item><item><guid isPermaLink="false">b0a97c1e-0953-470a-9101-ba07d185c8b2</guid><link>http://sqlservice.se/sv/start/blogg/sql-server--the-curse-of-heaps.aspx?lang=sv</link><title>SQL Server - the curse of heaps </title><description>&lt;p&gt;A HEAP in SQL Server is a table without a clustered index, and in this blog post I'll show you the curse of heaps. Run the code below and take a look at the record_count and page_count for each result:&lt;/p&gt;&#xD;
&lt;p&gt;-- create a table with a large char column to create as many pages as records, just for the demonstration&lt;br /&gt;CREATE TABLE dbo.HeapCurse(id INT IDENTITY(1,1), BigChar CHAR(4096));&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;SELECT 'CREATED', ips.[record_count], ips.[page_count] ,[ips].[avg_record_size_in_bytes]&lt;br /&gt;FROM sys.dm_db_index_physical_stats(DB_ID(), OBJECT_ID('HeapCurse'), NULL, NULL, 'DETAILED') ips;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;INSERT INTO dbo.HeapCurse (BigChar)&lt;br /&gt;SELECT TOP 1000 'H&amp;aring;kan Winther'&lt;br /&gt;FROM sys.columns c1 CROSS APPLY sys.columns c2;&lt;/p&gt;&#xD;
&lt;p&gt;SELECT 'INSERTED', ips.[record_count], ips.[page_count],[ips].[avg_record_size_in_bytes]&lt;br /&gt;FROM sys.dm_db_index_physical_stats(DB_ID(), OBJECT_ID('HeapCurse'), NULL, NULL, 'DETAILED') ips;&lt;/p&gt;&#xD;
&lt;p&gt;DELETE FROM dbo.[HeapCurse];&lt;/p&gt;&#xD;
&lt;p&gt;SELECT 'DELETED', ips.[record_count], ips.[page_count], [ips].[avg_record_size_in_bytes]&lt;br /&gt;FROM sys.dm_db_index_physical_stats(DB_ID(), OBJECT_ID('HeapCurse'), NULL, NULL, 'DETAILED') ips;&lt;/p&gt;&#xD;
&lt;p&gt;INSERT INTO dbo.HeapCurse (BigChar)&lt;br /&gt;SELECT TOP 1000 'H&amp;aring;kan Winther'&lt;br /&gt;FROM sys.columns c1 CROSS APPLY sys.columns c2;&lt;/p&gt;&#xD;
&lt;p&gt;DELETE FROM dbo.[HeapCurse] WITH(TABLOCK);&lt;/p&gt;&#xD;
&lt;p&gt;SELECT 'DELETED WITH TABLOCK', ips.[record_count], ips.[page_count], [ips].[avg_record_size_in_bytes]&lt;br /&gt;FROM sys.dm_db_index_physical_stats(DB_ID(), OBJECT_ID('HeapCurse'), NULL, NULL, 'DETAILED') ips;&lt;/p&gt;&#xD;
&lt;p&gt;INSERT INTO dbo.HeapCurse (BigChar)&lt;br /&gt;SELECT TOP 1000 'H&amp;aring;kan Winther'&lt;br /&gt;FROM sys.columns c1 CROSS APPLY sys.columns c2;&lt;/p&gt;&#xD;
&lt;p&gt;TRUNCATE TABLE dbo.[HeapCurse];&lt;/p&gt;&#xD;
&lt;p&gt;SELECT 'TRUNCATED', ips.[record_count], ips.[page_count], [ips].[avg_record_size_in_bytes]&lt;br /&gt;FROM sys.dm_db_index_physical_stats(DB_ID(), OBJECT_ID('HeapCurse'), NULL, NULL, 'DETAILED') ips;&lt;/p&gt;&#xD;
&lt;p&gt;DROP TABLE DBO.[HeapCurse];&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Did you expect this result? As you can see in this results, the pages in the heap is not deallocated when you delete the records, and they can't be reused by another table. This results in 8kb pages that are like "living dead" (Zombies), they will stay there in the&amp;nbsp;table and haunt your storage solution.&amp;nbsp;In this case, I lost 8192kb space until I&amp;nbsp;finally killed the Zombies.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;As you could see, by using&amp;nbsp;the TABLOCK hint when you deleted the records most of the pages are deallocated, but not all of them. To really&amp;nbsp;deallocate all pages, you need use one of the following methods:&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;truncate the table&lt;/li&gt;&#xD;
&lt;li&gt;create a clustered index and then drop the index&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;The second option is more time consuming, but you don't need to delete all records.&lt;/p&gt;&#xD;
&lt;p&gt;Of course, the best option is to create a clustered index and keep it, but if you really think you have a good argument for using a HEAP, drop the clustered index.&lt;/p&gt;&#xD;
&lt;p&gt;/H&amp;aring;kan Winther&lt;/p&gt;</description><a10:updated>2013-01-16T08:59:51Z</a10:updated></item><item><guid isPermaLink="false">48339e32-fe9b-4385-a2b6-53ac4b455f42</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-statistics--local-variables.aspx?lang=sv</link><title>SQL Server statistics - local variables</title><description>&lt;p&gt;If you have been following my blog serie about SQL server statistics, you have seen how statistics is used by the sql optimizer to create an execution plan. When the statistics is used in the wrong way, you'll end up with a bad execution plan.&lt;/p&gt;&#xD;
&lt;p&gt;This blog post is about another scenario when the statistics is not used correct. You can try this code in the AdventureWorks database:&lt;/p&gt;&#xD;
&lt;p&gt;SET &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;STATISTICS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;IO &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ON&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;SELECT&lt;br /&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;soh&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[sod]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[sod]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderDetailID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[sod]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[CarrierTrackingNumber]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[sod]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[OrderQty]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[sod]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[ProductID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[sod]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SpecialOfferID]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;FROM &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[Sales]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderHeader] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;AS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;soh&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;INNER &lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;JOIN &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[Sales]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderDetail] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;AS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;sod&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;ON &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[soh]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[sod]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderID]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;WHERE &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;soh&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;OrderDate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'2008-07-31'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;DECLARE &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;@orderDate &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;DATE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'2008-07-31'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;SELECT&lt;br /&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;soh&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[sod]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[sod]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderDetailID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[sod]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[CarrierTrackingNumber]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[sod]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[OrderQty]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[sod]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[ProductID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[sod]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SpecialOfferID]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;FROM &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[Sales]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderHeader] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;AS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;soh&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;INNER &lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;JOIN &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[Sales]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderDetail] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;AS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;sod&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;ON &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[soh]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[sod]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderID]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;WHERE &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;soh&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[OrderDate]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;@orderDate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;SET &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;STATISTICS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;IO &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;OFF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;If you look at the execution plan for these queries, they look exactly the same, but the estimated cost for the first one is higher than the&amp;nbsp;second one.&amp;nbsp;BUT if you look closer, you'll see that there is a difference in "estimated number of records". In the first execution plan actual and estimated&amp;nbsp;number of records are equal, but not in the second execution plan&amp;nbsp;where estimated are less than&amp;nbsp;actual.&lt;/p&gt;&#xD;
&lt;p&gt;Is this a&amp;nbsp;problem? Well.... YES&amp;nbsp;it is!&amp;nbsp;If the table would have been big, you might have got a bad execution plan and SQL engine wouldn't have aquired enough memory for the query.&lt;/p&gt;&#xD;
&lt;p&gt;Is the first query actually more expensive than the second one? In this case, no. The cost is based on the estimated number of records and the first one did a much better estimate than the second on.&lt;/p&gt;&#xD;
&lt;p&gt;Why is the estimated incorrect in the second query? Values of local variables are not known in compile time when the execution plan is created, only in runtime and that leaves SQL server&amp;nbsp;guessing.&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-01-15T21:51:48Z</a10:updated></item><item><guid isPermaLink="false">4b450e8e-73e0-4b73-9552-ed4e9997d01c</guid><link>http://sqlservice.se/sv/start/blogg/24-hours-of-pass.aspx?lang=sv</link><title>24 Hours of PASS</title><description>&lt;p&gt;Som vi skrivit om &lt;a href="http://www.sqlservice.se/sv/start/blogg/new-conference-series-from-pass.aspx"&gt;tidigare&lt;/a&gt; kommer det att g&amp;aring; en BI konferens den 10-12/4 i Chicago. Inf&amp;ouml;r den kommer det som inf&amp;ouml;r vanliga PASS Summit finnas m&amp;ouml;jligt att f&amp;aring; ett smakprov av de &amp;nbsp;sessioner som kommer h&amp;aring;llas p&amp;aring; denna BI konferens. Detta kommer ske den 30/1 med start kl 14:00 av tolv sessioner. Dessa kommer sedan g&amp;aring; i repris och finnas tillg&amp;auml;ngliga 12 timmar senare.&lt;/p&gt;&#xD;
&lt;p&gt;Allting startar med Alberto Ferrari och "PowerPivot for Excel 2013 in Action".&lt;/p&gt;&#xD;
&lt;p&gt;Mer information hittar ni h&amp;auml;r: &lt;a href="http://www.24hoursofpass.com/"&gt;http://www.24hoursofpass.com/&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-01-15T07:52:02Z</a10:updated></item><item><guid isPermaLink="false">37950049-53bf-4522-adc7-9eda2272f886</guid><link>http://sqlservice.se/sv/start/blogg/byta-databasnamn.aspx?lang=sv</link><title>Byta databasnamn</title><description>&lt;p&gt;Att namnge sin databas p&amp;aring; ett vettigt s&amp;auml;tt &amp;auml;r sj&amp;auml;lvklart f&amp;ouml;r de flesta. Det underl&amp;auml;ttar. Dock s&amp;aring; kan man ibland beh&amp;ouml;va &amp;auml;ndra namnet av olika anledningar, inget konstigt med det.&lt;/p&gt;&#xD;
&lt;p&gt;Att &amp;auml;ndra namn p&amp;aring; databasen &amp;auml;r inte sv&amp;aring;rt, bara att anv&amp;auml;nda sig av sp_renamedb.&lt;/p&gt;&#xD;
&lt;p&gt;Ex: EXEC master..sp_renamedb 'GammaltNamn','NyttNamn'&lt;/p&gt;&#xD;
&lt;p&gt;Databasen har nu f&amp;aring;tt ett nytt namn och allt &amp;auml;r frid och fr&amp;ouml;jd...eller? Nej, vi har bara &amp;auml;ndrat namnet p&amp;aring; sj&amp;auml;lva databasen inte dess fysiska filnamn. Varf&amp;ouml;r &amp;auml;r detta viktigt, &amp;auml;r det viktigt...?&lt;/p&gt;&#xD;
&lt;p&gt;Jag tycker nog att man inte b&amp;ouml;r slarva med detta. F&amp;ouml;r en tid sedan var jag hos en kund och flyttade en massa databaser fr&amp;aring;n en server till en annan. Det visade sig r&amp;auml;tt snabbt att man d&amp;ouml;pt om de flesta av databaserna men inte tagit hand om de fysiska filnamnen. Nu var det s&amp;aring; att det redan fanns databaser p&amp;aring; min m&amp;aring;lserver med samma fysiska filnamn som de databaser jag h&amp;ouml;ll p&amp;aring; att flytta vilket resulterade i att min restore inte gick igenom pga att filnamnen var upptagna.&lt;/p&gt;&#xD;
&lt;p&gt;Om man hade tagit hand om filnamnen samtidigt som man d&amp;ouml;pte om databaserna hade detta inte varit ett problem. Detta g&amp;auml;ller &amp;auml;ven om man tex g&amp;ouml;r restore p&amp;aring; en databas med ett nytt namn.&lt;/p&gt;&#xD;
&lt;p&gt;Att &amp;auml;ndra de fysiska filnamnen &amp;auml;r inte heller sv&amp;aring;rt.&lt;/p&gt;&#xD;
&lt;p&gt;Ex: &lt;br /&gt;ALTER DATABASE [DatabasNamn] MODIFY FILE (NAME=N'GammaltNamn', FILENAME=N'NyttNamn') &lt;br /&gt;GO &lt;br /&gt;ALTER DATABASE [DatabasNamn] MODIFY FILE (NAME=N'GammaltNamn_log', FILENAME=N'NyttNamn_log') &lt;br /&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;Efter detta m&amp;aring;ste man ta databasen offline, d&amp;ouml;pa om filerna,&amp;nbsp;och sedan ta&amp;nbsp;databasen online igen.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #ff0000;"&gt;Edit:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #ff0000;"&gt;H&amp;auml;r blev det en liten tankevurpa av mig. Precis som Thomas skriver i sin kommentar s&amp;aring; kan man visst ha samma logiska filnamn p&amp;aring; databaserna, jag menade s&amp;aring;klart de Fysiska filnamnen, inget annat! R&amp;auml;tt skall vara r&amp;auml;tt. Inl&amp;auml;gget &amp;auml;r nu &amp;auml;ndrat f&amp;ouml;r att spegla detta.&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2013-01-14T14:34:36Z</a10:updated></item><item><guid isPermaLink="false">ab784cb7-0a7c-458c-91dd-08d4ba68236b</guid><link>http://sqlservice.se/sv/start/blogg/new-conference-series-from-pass.aspx?lang=sv</link><title>New conference series from PASS!</title><description>&lt;p&gt;&lt;span style="font-family: andale mono,times; font-size: small;"&gt;If you haven&amp;acute;t noticed already, you BI people out there in the wild should really take a look at the PASS organizations new Business Intelligence conference series (to be?). It is called &lt;em&gt;PASS Business Analytics Conference&lt;/em&gt; and it will premiere in Chicago already in April (10-12th). For those of you who want to dig deeper into the world of data mining it should hold a wealth of good information!&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-family: andale mono,times; font-size: small;"&gt;Find it here: &lt;a href="http://www.passbaconference.com/"&gt;http://www.passbaconference.com/&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-family: andale mono,times; font-size: small;"&gt;Be there &lt;em&gt;and&lt;/em&gt; be square (cube - really&amp;nbsp;:)&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-family: andale mono,times; font-size: small;"&gt;//Joakim&lt;/span&gt;&lt;/p&gt;</description><a10:updated>2013-01-13T22:00:40Z</a10:updated></item><item><guid isPermaLink="false">ad98d070-db14-4312-91cd-68ec9b6d2177</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-2008-r2-error--using--dbghelp-dll--version--4-0-5-.aspx?lang=sv</link><title>SQL Server 2008 R2 Error: 'Using 'dbghelp.dll' version '4.0.5'</title><description>&lt;p&gt;Just a quick note on this, in case there are people out there scratcing their heads over the errormessage "Using 'dbghelp.dll' version '4.0.5'" showing up over and over again in the SQL Server Errorlog for no apparent reason.&lt;/p&gt;&#xD;
&lt;p&gt;It can show up for many reasons of course, since it is written to the errorlog when sqldumper.exe is used. In many cases, this is then an indication of something bad going on in your system.&lt;/p&gt;&#xD;
&lt;p&gt;But, then again, if you see it all the time for no good reason, it is msot likely related to an Extended Event script, specifically one referencing the dmv sys.fn_xe_file_target_read_file wich is used to read the results from Extended Events. And in that case, there is nothing to worry about, you can safely ignore the message&lt;/p&gt;</description><a10:updated>2013-01-11T17:20:40Z</a10:updated></item><item><guid isPermaLink="false">d50b1d1a-c08c-4a67-ba5f-f434a7ad19c3</guid><link>http://sqlservice.se/sv/start/blogg/nya-forbattringar-for-sql-server-2008-r2-sp2.aspx?lang=sv</link><title>Nya förbättringar för SQL Server 2008 R2 SP2</title><description>&lt;p&gt;Stadigt utvecklas SQL Server och m&amp;aring;nga &amp;auml;r det som anv&amp;auml;nder just SQL Server 2008 R2. F&amp;ouml;r oss som g&amp;ouml;r det &amp;auml;r det d&amp;auml;rf&amp;ouml;r viktigt att kontrollera de f&amp;ouml;rb&amp;auml;ttringar och buggar som man l&amp;ouml;st fr&amp;aring;n Microsofts utvecklingsteam och sedan avg&amp;ouml;ra om man skall installera dessa f&amp;ouml;rb&amp;auml;ttringar.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Helt nyligen har man sl&amp;auml;ppt nya uppdateringar f&amp;ouml;r SQL Server 2008 R2 och SP2 som man hittar nedan.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2777358"&gt;Cumulative update package 4 for SQL Server 2008 R2 SP2 &lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Som vanligt g&amp;auml;ller det att alltid testa innan man g&amp;ouml;r f&amp;ouml;r&amp;auml;ndringar i sin produktionsmilj&amp;ouml;.&lt;/p&gt;</description><a10:updated>2013-01-08T13:19:28Z</a10:updated></item><item><guid isPermaLink="false">3af77fbd-daec-472f-b84a-b8da7cfa74ba</guid><link>http://sqlservice.se/sv/start/blogg/ny-uppdatering-for-sql-server-2012.aspx?lang=sv</link><title>Ny uppdatering för SQL Server 2012</title><description>&lt;p&gt;Just innan &amp;aring;rsskiftet kom ytterligare en f&amp;ouml;rb&amp;auml;ttring f&amp;ouml;r SQL Server 2012 RTM. Denna g&amp;auml;ller allts&amp;aring; inte f&amp;ouml;r SQL Server 2012 SP1.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2777772"&gt;SQL Server 2012 RTM Cumulative Update 5 &lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Som vanligt g&amp;auml;ller det att alltid testa innan man g&amp;ouml;r f&amp;ouml;r&amp;auml;ndringar i sin produktionsmilj&amp;ouml;.&lt;/p&gt;</description><a10:updated>2013-01-08T13:15:38Z</a10:updated></item><item><guid isPermaLink="false">c70c62a4-e228-4213-9fad-c5cc61175943</guid><link>http://sqlservice.se/sv/start/blogg/ny-uppdatering-for-sql-server-2008-r2-sp1.aspx?lang=sv</link><title>Ny uppdatering för SQL Server 2008 R2 SP1 </title><description>&lt;p&gt;M&amp;aring;nga &amp;auml;r de uppdateringar som kommit just innan &amp;aring;rsskiftet. S&amp;aring; gjordes &amp;auml;ven f&amp;ouml;r SQL Server R2 SP1. Nu finns det ju &amp;auml;ven SP2 f&amp;ouml;r SQL Server 2008 R2, som man f&amp;ouml;rst&amp;aring;s b&amp;ouml;r anv&amp;auml;nda. V&amp;auml;ljer man &amp;auml;nd&amp;aring; att ligga kvar med SP1 s&amp;aring; b&amp;ouml;r man kontrollera dessa f&amp;ouml;rb&amp;auml;ttringar som nu f&amp;aring;tt sin l&amp;ouml;sning och sedan avg&amp;ouml;ra om man skall installera denna uppdatering.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2783135"&gt;SQL Server 2008 R2 SP1 Cumulative Update 10 &lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Som vanligt g&amp;auml;ller det att alltid testa innan man g&amp;ouml;r f&amp;ouml;r&amp;auml;ndringar i sin produktionsmilj&amp;ouml;.&lt;/p&gt;</description><a10:updated>2013-01-08T13:12:52Z</a10:updated></item><item><guid isPermaLink="false">011589eb-757b-419d-8b6a-05d6d695f538</guid><link>http://sqlservice.se/sv/start/blogg/hash-table,-parallelism-and-cursor-performance-in-practice.aspx?lang=sv</link><title>Hash table, parallelism and Cursor performance in practice</title><description>&lt;p&gt;This Christmas my kids finally showed some interest in Lego and I got the opportunity to practice Hash tables, parallelism and cursors in reality. I saved all my Lego from my childhood to be able to pass them on to my kids. It&amp;rsquo;s more than 20&amp;nbsp;000 pieces (records) stored in one single box (like a table in SQL server) with the measure 70x40x40cm. The pieces are unsorted like a hash table without a clustered index, well, without any index at all.&lt;/p&gt;&#xD;
&lt;p&gt;The building instructions are very sequential, like a cursor, you have to get piece X from the box and connect to your construction before you continue to next step. In this case, my kid wanted to build a Bionicle fortress and to build it we need to get approximately 500 pieces and complete more than 50 steps.&lt;/p&gt;&#xD;
&lt;p&gt;Every piece (record) we need to get from the box (table) has some attributes (columns) that have to match, like color, size and shape, so we have to scan the pieces in the box to find the matching piece.&lt;/p&gt;&#xD;
&lt;p&gt;As you already figured out, the pieces are unsorted and can be anywhere in the box. For every piece we need to get, we have to scan all the pieces until we find the right one. In the worst case, we need to iterate through all 20&amp;nbsp;000 pieces &amp;gt;500 times. We can illustrate this with this pseudo code:&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;DECLARE curr CURSOR LOCAL FAST_FORWARD FOR &lt;br /&gt;SELECT size, color, shape FROM [building instruction]&lt;/p&gt;&#xD;
&lt;p&gt;OPEN curr&lt;/p&gt;&#xD;
&lt;p&gt;DECLARE @size VARCHAR(10)&lt;br /&gt;DECLARE @color VARCHAR(20)&lt;br /&gt;DECLARE @shape VARCHAR(50)&lt;/p&gt;&#xD;
&lt;p&gt;FETCH NEXT FROM curr INTO @size, @color, @shape&lt;/p&gt;&#xD;
&lt;p&gt;WHILE @@FETCH_STATUS&amp;nbsp;= 0&lt;br /&gt;BEGIN&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT TOP 1 Piece FROM legoBox&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE size=@size AND color=@color AND &lt;a href="mailto:shape=@shape"&gt;shape=@shape&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FETCH NEXT FROM curr INTO @size, @color, @shape&lt;br /&gt;END&lt;br /&gt;CLOSE curr&lt;br /&gt;DEALLOCATE curr&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;The fun part with lego is not the search part, it&amp;rsquo;s the building part and to keep my joy for my kid we divided the work between us. He is the client requesting pieces, and I had to act as SQL engine.&lt;/p&gt;&#xD;
&lt;p&gt;When the client requested a piece, I had only one choice as the data is unsorted:&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Scan the box and stop when I found the piece, and keep doing this until all requests are handled&lt;/p&gt;&#xD;
&lt;p&gt;As you can see, this can be time consuming, due to the number of requests.&lt;/p&gt;&#xD;
&lt;p&gt;Well, I actually had a second choice. I could pick up pieces in chunks (data pages), sort them, keep them in my workspace (cache) and scan the workspace (cache) on subsequent requests. The sort phase of this approach is time consuming, but could save some time on subsequent requests.&lt;/p&gt;&#xD;
&lt;p&gt;The problem with the second approach is that the sort is time consuming and my workspace (cache) is limited and when I run out of workspace, I have to put the pieces (records) back into the box (table).&lt;/p&gt;&#xD;
&lt;p&gt;Do I have another option? Well, I could try to use some kind of qualified guessing and pick up pieces that I might need (read ahead). This can save some time, but consumes workspace with pieces that I might need.&lt;/p&gt;&#xD;
&lt;p&gt;I did try to use more kids (worker threads) to run the scan of the box in parallel to reduce the time, but the amount of work wasn&amp;rsquo;t evenly spread between the kids and me so one worker completed the scan faster than the others and had to wait for the rest of the worker (cxpacket waits) until the piece was found. The problem still exists, I have to scan the complete box for every piece that we needed.&lt;/p&gt;&#xD;
&lt;p&gt;The best option would have been to pick up all the pieces, sort them and stored them sorted in another box. That could save time depending on how I sort them. If I would give all pieces a unique number (a fictive key) and sort them by the number I wouldn&amp;rsquo;t save much time as I need to get them depending on the attributes:&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Color&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Shape&lt;/p&gt;&#xD;
&lt;p&gt;If I sort them based on the attributes I save a lot of time as I can to a quick seek (index seek) for every individual piece that the client requests, but I still get 500 requests.&lt;/p&gt;&#xD;
&lt;p&gt;The best option would be sorting them based on the Lego number, then I could get all the pieces I need for the building instruction into the workspace. As all 500 pieces fits in the workspace, I only need to scan the workspace, not seek as the pieces are not sorted by attributes.&lt;/p&gt;&#xD;
&lt;p&gt;Actually, the absolute best option would be sorting the pieces based on attributes and store all pieces for a construction in separate boxes (partitions). In this case I only need to seek for my piece in a subset of pieces (partition elimination). This will only take a fraction of the original time.&lt;/p&gt;&#xD;
&lt;p&gt;The problem with the last two options are that I haven&amp;rsquo;t stored the Lego number along with my pieces.&lt;/p&gt;&#xD;
&lt;p&gt;Conclusion:&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; It is time consuming to scan unsorted data over and over again&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; It is time consuming to sort the data, avoid doing it when you get your data&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Parallelism is good when the amount of work is evenly spread&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Iterations like cursors are time consuming&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Fetching sorted data can be really fast, depending on how the data is sorted&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Partitioning can increase the performance a lot, depending on the partitioning key&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Design your data model wisely from the beginning.&lt;/p&gt;&#xD;
&lt;p&gt;Recommendation for SQL server:&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Always create at least a clustered&amp;nbsp; index for tables that contains more than just a few records&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Choose the clustered index wisely, a fictive key (like an identity column) doesn&amp;rsquo;t help you in your search as you never search for the fictive number&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Don&amp;rsquo;t waste your clustered index on columns you never use in filtering&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The clustered index need to be as narrow as possible as it is included in any other non clustered index.&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Create additional non clustered indexes to cover other search criteria&lt;/p&gt;&#xD;
&lt;p&gt;Some people recommends using a narrow and ever incrementing column as the clustered index, like an identity column, but that might cause you some trouble with:&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Key lookups, due to the fact that you never search the fictive key&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Hot spots in the last data page, as all data should be placed in the last page&lt;/p&gt;&#xD;
&lt;p&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Statistics that are out of date as 20% of the table has to be changed before the statistics are auto updated.&lt;/p&gt;&#xD;
&lt;p&gt;On the other hand, if you don&amp;rsquo;t use an incrementing column you end up with page splits and fragmentation of the index.&lt;/p&gt;&#xD;
&lt;p&gt;To be able to tune your database for best performance you need to know your data and how it&amp;rsquo;s going to be used.&lt;/p&gt;</description><a10:updated>2013-01-07T14:25:18Z</a10:updated></item><item><guid isPermaLink="false">e2b39f13-986b-4aa1-bc42-7e4e8df2a3a6</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-statistics--memory-request.aspx?lang=sv</link><title>SQL Server statistics - memory request</title><description>&lt;p&gt;In my previous blog post, I covered some issues with incorrect statistics and in this post I&amp;rsquo;ll present another issue. The optimizer is using the statistics to choose an execution plan that is as good as possible, but it also uses the row counts in the statistics to request memory for the query.&lt;/p&gt;&#xD;
&lt;p&gt;If the row count is higher than the actual number of records, the optimizer tells the SQL engine to request more memory than necessary, with possible memory exhaustion as a result.&lt;/p&gt;&#xD;
&lt;p&gt;But the worst case is when the row count is to low, because then the SQL engine will not request enough memory to process the query. SQL engine will not request more memory and the data will be spilled to tempdb.&lt;/p&gt;&#xD;
&lt;p&gt;If you are running a slow query, you can investigate the memory request for that query by using the following code:&lt;/p&gt;&#xD;
&lt;p&gt;SELECT&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[session_id],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[request_id],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[start_time],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[status],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [dest].[text],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [deqp].[query_plan],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[user_id],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[wait_type],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[wait_time],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[last_wait_type],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[wait_resource],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[percent_complete],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[estimated_completion_time],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[cpu_time],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[total_elapsed_time],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[reads],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[writes],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[logical_reads],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[row_count],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [der].[granted_query_memory],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [deqmg].[session_id],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [deqmg].[dop],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [deqmg].[request_time],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [deqmg].[grant_time],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [deqmg].[requested_memory_kb],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [deqmg].[granted_memory_kb],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [deqmg].[required_memory_kb],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [deqmg].[used_memory_kb],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [deqmg].[max_used_memory_kb],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [deqmg].[query_cost],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [deqmg].[timeout_sec],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [deqmg].[wait_order],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [deqmg].[is_next_candidate],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [deqmg].[wait_time_ms],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [deqmg].[ideal_memory_kb]&lt;br /&gt;FROM sys.[dm_exec_requests] AS der&lt;br /&gt;CROSS APPLY sys.[dm_exec_sql_text](der.[sql_handle]) AS dest&lt;br /&gt;CROSS APPLY sys.[dm_exec_query_plan]([der].[plan_handle]) AS deqp&lt;br /&gt;LEFT&amp;nbsp;JOIN sys.[dm_exec_query_memory_grants] AS deqmg ON&lt;br /&gt;der.[session_id] = [deqmg].[session_id]&lt;br /&gt;AND [der].[request_id] = [deqmg].[request_id]&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;If the max_used_memory_kb is much less the requested_memory_kb, then the optimizer over estimates the row count and requests more memory than needed.&lt;/p&gt;&#xD;
&lt;p&gt;The requested_memory can be forced to use more than whats necessary by changing the &amp;ldquo;min memory by query (kb)&amp;rdquo; by using this command:&lt;/p&gt;&#xD;
&lt;p&gt;EXEC sp_configure 'min memory per query (KB)',2048&lt;br /&gt;RECONFIGURE&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;The default is 1024, but it might be worth changing if you know for sure that most of your queries requires a lot more and you have plenty of RAM.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;If you have performance issues, feel free to contact any of our SQL server experts and we will help you.&lt;/p&gt;</description><a10:updated>2012-12-31T11:40:22Z</a10:updated></item><item><guid isPermaLink="false">91c6100c-006d-4a17-a99b-a61162755167</guid><link>http://sqlservice.se/sv/start/blogg/check-progress-of-rollback.aspx?lang=sv</link><title>Check progress of rollback </title><description>&lt;p&gt;In SQL server, you can klii an active process using the command KILL &amp;lt;SPID&amp;gt; causing it to roll back any in flight transactions. And if you have killed a process, you can check the progress of the rollback by running KILL &amp;lt;SPID&amp;gt; WITH STATUSONLY. But sometimes, for various reasons (&lt;a href="http://serverfault.com/questions/58583/cant-see-progress-of-rolling-back-spid-with-kill-with-statusonly" target="_blank"&gt;example&lt;/a&gt;), SQL Server does not return any status information even if sp_who2 and Activity Monitor shows that the SPID status is KILLED/ROLLBACK.&lt;/p&gt;&#xD;
&lt;p&gt;What I find tends to work every time however, it the following little query that you can run instead:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;select session_id, percent_complete , last_wait_type , wait_resource, wait_time, wait_type&amp;nbsp; from sys.dm_exec_requests where status = 'rollback'&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;In addition to the rollback percent complete, it gives you some info about if and what the process is waiting for, in case you feel it is taking a long time, and you want to investigate that.&lt;/p&gt;&#xD;
&lt;p&gt;As usual, feel free to &lt;a href="../sv/start/kontakta-oss.aspx"&gt;contact us&lt;/a&gt; if you have SQL server questions, needs or problems!&lt;/p&gt;</description><a10:updated>2012-12-28T13:22:00Z</a10:updated></item><item><guid isPermaLink="false">e150d540-0fd4-4e3c-82c8-5b690fc66485</guid><link>http://sqlservice.se/sv/start/blogg/proposed-improvement-in-tsql-join-syntax.aspx?lang=sv</link><title>Proposed improvement in T-SQL JOIN syntax</title><description>&lt;p&gt;I have a proposal to enhance the T-SQL JOIN syntax, to simplify writing joins that use an existing PK/FK relationship.&lt;/p&gt;&#xD;
&lt;p&gt;The examples in this post uses the Adventureworks2012 database, and the [HumanResources].[Employee] and [Person].[Person] (Some parts edited out of CREATE scripts for readability)&lt;/p&gt;&#xD;
&lt;p&gt;OBS: This is regged as a CONNECT item, and if you think this is a good idea, you can vote for it here:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="https://connect.microsoft.com/SQLServer/feedback/details/773543/proposed-improvement-in-t-sql-join-syntax"&gt;https://connect.microsoft.com/SQLServer/feedback/details/773543/proposed-improvement-in-t-sql-join-syntax&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;-- Start Setup script&lt;/p&gt;&#xD;
&lt;p&gt;SET ANSI_NULLS ON GO&lt;/p&gt;&#xD;
&lt;p&gt;SET QUOTED_IDENTIFIER ON GO&lt;/p&gt;&#xD;
&lt;p&gt;CREATE TABLE [HumanResources].[Employee]&lt;/p&gt;&#xD;
&lt;p&gt;( &amp;nbsp;[BusinessEntityID] [int] NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[NationalIDNumber] [nvarchar](15) NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[LoginID] [nvarchar](256) NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[OrganizationNode] [hierarchyid] NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[OrganizationLevel]&amp;nbsp; AS ([OrganizationNode].[GetLevel]()), &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[JobTitle] [nvarchar](50) NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[BirthDate] [date] NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[MaritalStatus] [nchar](1) NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[Gender] [nchar](1) NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[HireDate] [date] NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[SalariedFlag] [dbo].[Flag] NOT NULL,&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;[VacationHours] [smallint] NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[SickLeaveHours] [smallint] NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[CurrentFlag] [dbo].[Flag] NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[rowguid] [uniqueidentifier] NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[ModifiedDate] [datetime] NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;CONSTRAINT [PK_Employee_BusinessEntityID]&lt;/p&gt;&#xD;
&lt;p&gt;PRIMARY KEY CLUSTERED ( &amp;nbsp;[BusinessEntityID] ASC )WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF) )&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;ALTER TABLE [HumanResources].[Employee]&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WITH CHECK ADD&amp;nbsp; CONSTRAINT [FK_Employee_Person_BusinessEntityID] FOREIGN KEY([BusinessEntityID])&lt;/p&gt;&#xD;
&lt;p&gt;REFERENCES [Person].[Person] ([BusinessEntityID])&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;ALTER TABLE [HumanResources].[Employee] CHECK CONSTRAINT [FK_Employee_Person_BusinessEntityID]&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;CREATE TABLE [Person].[Person]&lt;/p&gt;&#xD;
&lt;p&gt;( &amp;nbsp;[BusinessEntityID] [int] NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[PersonType] [nchar](2) NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[NameStyle] [dbo].[NameStyle] NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[Title] [nvarchar](8) NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[FirstName] [dbo].[Name] NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[MiddleName] [dbo].[Name] NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[LastName] [dbo].[Name] NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[Suffix] [nvarchar](10) NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[EmailPromotion] [int] NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[AdditionalContactInfo] [xml](CONTENT [Person].[AdditionalContactInfoSchemaCollection]) NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[Demographics] [xml](CONTENT [Person].[IndividualSurveySchemaCollection]) NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[rowguid] [uniqueidentifier] ROWGUIDCOL&amp;nbsp; NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[ModifiedDate] [datetime] NOT NULL, &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;CONSTRAINT [PK_Person_BusinessEntityID]&lt;/p&gt;&#xD;
&lt;p&gt;PRIMARY KEY CLUSTERED ( &amp;nbsp;[BusinessEntityID] ASC )&lt;/p&gt;&#xD;
&lt;p&gt;WITH (PAD_INDEX&amp;nbsp; = OFF, STATISTICS_NORECOMPUTE&amp;nbsp; = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS&amp;nbsp; = ON, ALLOW_PAGE_LOCKS&amp;nbsp; = ON) ON [PRIMARY] ) ON [PRIMARY]&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;-- End Setup Script&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Now, normally you would write a join like this:&lt;/p&gt;&#xD;
&lt;p&gt;USE AdventureWorks2012;&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;SELECT * FROM HumanResources.Employee AS e &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;INNER JOIN Person.Person AS p &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;ON e.BusinessEntityID = p.BusinessEntityID&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;What I propose is a simple improvement in syntax, that makes use of the informationa already contained in the datamodel, namely the foreign key relationship between the two tables. The syntax cold then look like the following:&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;-- Full syntax&lt;/p&gt;&#xD;
&lt;p&gt;USE AdventureWorks2012;&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;SELECT * FROM HumanResources.Employee AS e &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;INNER JOIN Person.Person AS p &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;ON REFERENCE&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;-- Short Syntax&lt;/p&gt;&#xD;
&lt;p&gt;USE AdventureWorks2012;&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;SELECT * FROM HumanResources.Employee AS e &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;INNER JOIN Person.Person AS p &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;ON REF&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;The idea would be that this would save time writing queries, and be more safe in case of a FK/PK column rename, or Foreign Key redefinition, as the query would still be valid, and not need to be updated, if the datamodel changes in this way. SQL Server should look up the actual definition of the FK relationship at compiletime, to obtain exact information of wich columns to use for the join. This would only work for joins of EQUAL (=) type,&amp;nbsp; not for NOT EQUAL (&amp;lt;&amp;gt;), LARGER THAN (&amp;gt;), SMALLER THAN (&amp;lt;)and so on.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-12-21T13:28:35Z</a10:updated></item><item><guid isPermaLink="false">f5ebe049-0c19-4280-b315-ac4e781964ce</guid><link>http://sqlservice.se/sv/start/blogg/multiple-nulls-in-a-unique-constraint.aspx?lang=sv</link><title>Multiple nulls in a unique constraint</title><description>&lt;p&gt;Today I tried to earn some points at &lt;a href="http://www.sqlservercentral.com/Questions"&gt;http://www.sqlservercentral.com/Questions&lt;/a&gt;&amp;nbsp;by answer the "question of the day" and I learned something new, or at least I haven't thougt about it before. In SQL Server 2008 and later you can actually create a unique constraint that can contain multiple NULL values. This can be useful if you need to have unique values as long as the value is know.&lt;/p&gt;&#xD;
&lt;p&gt;It can be solved by filtered index, try the sample below.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;USE [TEST] GO&lt;br /&gt;CREATE TABLE [dbo].[tbl_test]( [id] [int] ) ON [PRIMARY]&lt;br /&gt;GO&lt;br /&gt;CREATE UNIQUE NONCLUSTERED INDEX UNCI_test ON [dbo].[tbl_test](id) &lt;br /&gt;WHERE id IS NOT NULL &lt;br /&gt;GO &lt;br /&gt;--======================================= &lt;br /&gt;insert into [dbo].[tbl_test] values(1)--success &lt;br /&gt;insert into [dbo].[tbl_test] values(2)--success &lt;br /&gt;insert into [dbo].[tbl_test] values(NULL)--success &lt;br /&gt;insert into [dbo].[tbl_test] values(NULL)--success &lt;br /&gt;insert into [dbo].[tbl_test] values(2)--error [Cannot insert duplicate key row in object 'dbo.tbl_test' with unique index 'NCI_test'.]&lt;br /&gt;GO &lt;br /&gt;select * from [dbo].[tbl_test] &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-12-20T14:34:29Z</a10:updated></item><item><guid isPermaLink="false">a3edce94-2410-4320-a8a5-f61fc2518dae</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-statistics--read-only-database.aspx?lang=sv</link><title>SQL Server statistics - read only database</title><description>&lt;p&gt;The default setting for auto create statistics is on in SQL server, and this setting enables the SQL engine to create column statistics as needed by the optimizer, BUT statistics are not created if the database is read only. Of course, that makes sense, but you might get terrible performance if you don't have the statistics.&lt;/p&gt;&#xD;
&lt;p&gt;If you intend to set the database to read only, make sure you create the statistics you need before you set the datase in read only, otherwise, the sql optimizer may choose a bad plan based on "guestimates".&lt;/p&gt;</description><a10:updated>2012-12-18T22:28:22Z</a10:updated></item><item><guid isPermaLink="false">3f155ee6-4559-41da-ab3e-fe734df331e1</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-statistics--table-variables.aspx?lang=sv</link><title>SQL server statistics - table variables</title><description>&lt;p&gt;Statistics are very important for the SQL query optimizer and is used for estimating number of records returned by a query. If the difference between estimated number of records and actual number of records are too big, the optimizer may choose a bad plan, with heavy performance loss as a result.&lt;/p&gt;&#xD;
&lt;p&gt;A common problem with statistics are caused by table variables, because SQL server doesn't have statistics for table variables. As SQL server is using a cost based optimization and statistics are a crucial factor for the cost estimation, there has to be an estimated number of records.&lt;/p&gt;&#xD;
&lt;p&gt;How is that solved? Well, SQL server is using 1 as estimated number of records, even if there are millions of records! Run the following query with "include actual qeuery plan" on and take a look at the estimaded vs actual number of records by hovering the mouse over the scan operator. You can also take a look at the io statistics in the message window. There&amp;nbsp;is a big&amp;nbsp;difference between the logical reads.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;DECLARE &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;@orderDetails &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;TABLE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;( &lt;br /&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;SalesOrderID &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;INT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;, &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderDetailID] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;, &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[OrderQty] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;SMALLINT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;, &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;CarrierTrackingNumber &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;NVARCHAR&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;25&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;) &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;)&lt;/p&gt;&#xD;
&lt;p&gt;INSERT &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;INTO &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;@orderDetails&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;( &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;SalesOrderID&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderDetailID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[OrderQty]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[CarrierTrackingNumber] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;) &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;SELECT &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;sod&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;sod&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderDetailID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[sod]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[OrderQty]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;sod&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[CarrierTrackingNumber] &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;FROM &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[Sales]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderDetail] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;AS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;sod &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;WHERE &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;sod&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[OrderQty]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;SELECT &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[od]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[od]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderDetailID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[od]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[OrderQty]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[od]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[CarrierTrackingNumber] &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;FROM &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;@orderDetails &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;AS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;od &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;WHERE [OrderQty]&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;SET &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;STATISTICS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;IO &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ON&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;; &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;SET &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;STATISTICS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;TIME &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ON&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;SELECT &lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;* &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;FROM &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[Sales]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderHeader] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;AS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;soh &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;INNER &lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;JOin &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;a&gt;@orderDetails&lt;/a&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;od &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;ON &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[soh]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[od]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderID] &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;WHERE od &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[OrderQty]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;SELECT &lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;* &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;FROM &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[Sales]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderHeader] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;AS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;soh &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;INNER &lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;JOIN &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[Sales]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderDetail] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;AS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;od &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;ON &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[soh]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderID]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[od]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SalesOrderID] &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;WHERE od&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[OrderQty]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;1 &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;SET &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;STATISTICS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;IO &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;OFF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;; &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;SET &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;STATISTICS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;TIME &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;OFF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;The solution:&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Avoid&amp;nbsp;using table variables for temp tables if they are likely to contain more than a few rows. As a rule of thumb, use temporary tables, rather than table variables, for temp tables with more than 100 rows.&lt;/p&gt;</description><a10:updated>2012-12-18T20:52:07Z</a10:updated></item><item><guid isPermaLink="false">1df2960f-6962-4420-a63f-7c01fb80e276</guid><link>http://sqlservice.se/sv/start/blogg/ratt-datatyp-.aspx?lang=sv</link><title>Rätt datatyp ?</title><description>&lt;p&gt;Om man ser en databas som inneh&amp;aring;ller "felaktiga" datatyper, s&amp;aring; kan man st&amp;auml;lla sig denna fr&amp;aring;ga "Har detta n&amp;aring;gon p&amp;aring;verkan ?". Vad som menas med "felaktiga" datatyper kan man f&amp;ouml;rst&amp;aring;s diskutera, men normalt sett pratar vi om att datatyperna &amp;auml;r on&amp;ouml;digt "vida" och tar upp on&amp;ouml;dig plats. Normalt sett har man inte alltid m&amp;ouml;jlighet att testa detta, &amp;nbsp;men h&amp;auml;r kommer nu ett fall som visar vilken p&amp;aring;verkan detta g&amp;ouml;r. M&amp;aring;nga av tabellerna&amp;nbsp;som ligger till grund f&amp;ouml;r denna&amp;nbsp;j&amp;auml;mf&amp;ouml;relse inneh&amp;aring;ller kolumner av datatypen float som om inte annat defineras inneb&amp;auml;r 15 decimaler och en storlek av 8 bytes. Eftersom jag vet att h&amp;auml;r f&amp;ouml;rekommer inga decimaler &amp;nbsp;&amp;auml;ndrar jag datatyperna till integer f&amp;ouml;r samtliga kolumner som har float, vilket ist&amp;auml;llet inneb&amp;auml;r 4 bytes per kolumn.&lt;/p&gt;&#xD;
&lt;p&gt;Detta g&amp;ouml;r denna skillnad i en fr&amp;aring;ga mot n&amp;aring;gra av dessa tabeller :&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=68efa9ba-3523-4680-805e-558306b7fad2&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;Den f&amp;ouml;rsta delen &amp;auml;r allts&amp;aring; d&amp;auml;r datatyperna &amp;auml;nnu inneh&amp;aring;ller float, medan det andra visar samma datam&amp;auml;ngd, samma data men med datatypen integer. Detta ger en f&amp;ouml;rb&amp;auml;ttring p&amp;aring; 7 g&amp;aring;nger, b&amp;auml;ttre CPU-tid och som ni ser ocks&amp;aring; andra skillnader n&amp;auml;r det g&amp;auml;ller kostnaderna. Det &amp;auml;r allts&amp;aring; enormt viktigt att verkligen v&amp;auml;lja r&amp;auml;tt datatyp och inte slentrianm&amp;auml;ssigt v&amp;auml;lja varchar(50) till alla kolumner, som &amp;auml;r &amp;auml;nnu v&amp;auml;rre &amp;auml;n detta exempel.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=f23990c5-5a8a-4b9a-aeaa-d12079008e8c&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-12-18T07:29:25Z</a10:updated></item><item><guid isPermaLink="false">b32e0d27-8df8-4b40-9d03-3e789ee38fbd</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-statistics--multicolumn-statistics.aspx?lang=sv</link><title>SQL Server statistics - multicolumn statistics</title><description>&lt;p&gt;As you already know, in SQL server performance is depending on correct statistics. The optimizer in SQL engine uses the statistics to create execution plans, and if the statistics are incorrect or out of date, the optimizer is misguided, with inefficient execution plans.&lt;/p&gt;&#xD;
&lt;p&gt;The statistics are auto created by default when you are using a filter on a column or when you create an index, BUT did you know that multicolumn statistics are not created automatically? Well, for multi column indexes, the statistics are created.&lt;/p&gt;&#xD;
&lt;p&gt;Well, how does that affect you and your performance? For some cases it will not affect you at all, like when the tables are small and your T-SQL statements are simple, but if you have large tables and lots of joins etc, you might wonder why everything is so slow.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;After some investigations you find an execution plans that is running slow and by looking at some of the access methods of the plan you find a big difference in estimated vs actual number of rows.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;img src="../ci.axd?sid=701c82f4-4161-48fc-98c6-4d94074f52fb&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;After running sp_updatestats, the estimates are still wrong, why? Well the optimizer looks&amp;nbsp;at two different single column statistics and makes an incorrect estimate.&lt;/p&gt;&#xD;
&lt;p&gt;Try this sample:&lt;/p&gt;&#xD;
&lt;p&gt;-- create a table --&lt;/p&gt;&#xD;
&lt;p&gt;CREATE &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;TABLE &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[dbo]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[StatsTest]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[ID] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[int] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;IDENTITY&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;) &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;NOT &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;NULL,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[User]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[varchar]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;50&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;NULL,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[Company]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[varchar]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;50&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;NULL,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;CONSTRAINT &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[PK_dbo.StatsTest]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;PRIMARY &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;KEY &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;CLUSTERED&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;(&lt;br /&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[ID] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ASC&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;)&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;WITH &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;PAD_INDEX&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;OFF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;STATISTICS_NORECOMPUTE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;OFF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;IGNORE_DUP_KEY&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;OFF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ALLOW_ROW_LOCKS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ON&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ALLOW_PAGE_LOCKS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ON&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ON&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[PRIMARY]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;)&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ON&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[PRIMARY]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;-- insert some values --&lt;br /&gt;INSERT &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;INTO &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[dbo]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[StatsTest]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[user]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[company]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;VALUES&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'H&amp;aring;kan Winther'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'SQL Service'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;GO &lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;10000 --add 10000 records&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;-- insert some values --&lt;br /&gt;INSERT &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;INTO &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[dbo]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[StatsTest]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[user]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[company]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;VALUES&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'H&amp;aring;kan Winther1'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'SQL Service'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;GO &lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;10000&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;-- insert some values --&lt;br /&gt;INSERT &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;INTO &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[dbo]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[StatsTest]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[user]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[company]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;VALUES&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'H&amp;aring;kan Winther'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'SQL Service1'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;GO &lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;10000&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;DBCC&amp;nbsp;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;DROPCLEANBUFFERS&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;DBCC &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;FREEPROCCACHE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;-- select some data --&lt;br /&gt;SELECT &lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;* &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;FROM&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[dbo]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[StatsTest]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;WHERE [USER]&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'H&amp;aring;kan Winther1'&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;AND &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Company&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'SQL Service'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;-- check the stats to see if we got a multi column stats --&lt;br /&gt;SELECT &lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;OBJECT_NAME&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[S]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[object_id]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;s&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;c&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[S]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[auto_created]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;FROM &lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[stats] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;AS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;S&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;INNER &lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;JOI N&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[stats_columns]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;AS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;SC&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;ON &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[S]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[object_id]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SC]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[object_id]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;AND &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[S]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[stats_id]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SC]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[stats_id]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;INNER &lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;JOIN &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;columns &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;c&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;ON &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;sc&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[object_id]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;c&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[object_id]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;AND &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;sc&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[column_id]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;c&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[column_id]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;WHERE &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;s&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[object_id]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;OBJECT_ID&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'dbo.StatsTest'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;-- create statistics manually --&lt;br /&gt;CREATE &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;STATISTICS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;myStats&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ON&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;StatsTest&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[user]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Company&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;DBCC &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;DROPCLEANBUFFERS&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;DBCC &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;FREEPROCCACHE&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;-- select from the table again --&lt;br /&gt;SELECT &lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;* &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;FROM &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[dbo]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[StatsTest]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;WHERE [USER] &lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'H&amp;aring;kan Winther'&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;AND &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Company&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'SQL Service1'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;-- check the stats to see if we got a multi column stats --&amp;nbsp;&lt;br /&gt;SELECT &lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;OBJECT_NAME&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[S]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[object_id]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;s&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;c&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[S]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[auto_created]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;FROM &lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[stats] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;AS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;S&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;INNER &lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;JOIN &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[stats_columns] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;AS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;SC&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;ON &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[S]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[object_id]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SC]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[object_id]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;AND &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[S]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[stats_id]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[SC]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[stats_id]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;INNER &lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;JOIN &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008000; font-family: Consolas; font-size: x-small;"&gt;columns &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;c&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;ON &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;sc&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[object_id]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;c&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[object_id]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;AND &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;sc&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[column_id]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;c&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[column_id]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;WHERE &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;s&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[object_id]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;OBJECT_ID&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'dbo.StatsTest'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;DBCC &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;SHOW_STATISTICS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'dbo.StatsTest'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'myStats'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;　&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;DROP TABLE &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;StatsTest&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;As you can see, the estimates are more correct when you have a multicolumn statistics&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;You have two options to solve this problem, the best option is to create a multicolumn index. &lt;br /&gt;Another options is to create multicolumn statistics&lt;/p&gt;&#xD;
&lt;p&gt;If you want to know more, feel fre to contact any of our SQL serrver experts and we will help up.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-12-12T22:36:15Z</a10:updated></item><item><guid isPermaLink="false">d4b0e97e-769d-43f4-9d74-d8892fbdce52</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-performance--death-by-power-options.aspx?lang=sv</link><title>SQL Server performance - death by power options</title><description>&lt;p&gt;If your SQL server isn't constantly busy you might experience&amp;nbsp;unpredictible performance. Why? Well, you might have missed the small detail in Windows, the power options. The default setting for power option in Windows is "balanced power", and that setting is forcing the hardware, like CPU and storage&amp;nbsp;to throttle down to save power when the system is less busy!&lt;/p&gt;&#xD;
&lt;p&gt;To make things even worse, if you are using Windows Server 2008R2, you have some new power saving options, &amp;ldquo;core parking&amp;rdquo; (temporarily suspending certain cores) and &amp;ldquo;tick skipping&amp;rdquo; (extended idle and sleep states).&lt;/p&gt;&#xD;
&lt;p&gt;If you care more about performance and less about the environment, you should change the power option to "High performance".&lt;/p&gt;&#xD;
&lt;p&gt;Why is the default setting, balanced power? I may only guess, but a default action when installing a SQL server should be changing the option, not only in Windows but also in BIOS if the BIOS have support for power saving.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=51f52805-4dd5-4317-8e98-c0175712fb66&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;You can read more about the power option death at:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.brentozar.com/archive/2010/10/sql-server-on-powersaving-cpus-not-so-fast/"&gt;http://www.brentozar.com/archive/2010/10/sql-server-on-powersaving-cpus-not-so-fast/&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.sqlskills.com/blogs/paul/post/are-your-cpus-running-slowly-tool-tip-and-survey.aspx"&gt;http://www.sqlskills.com/blogs/paul/post/are-your-cpus-running-slowly-tool-tip-and-survey.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.bradmcgehee.com/2010/07/windows-os-power-saving-feature-directly-affects-cpu-performance/"&gt;http://www.bradmcgehee.com/2010/07/windows-os-power-saving-feature-directly-affects-cpu-performance/&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;or if you are living in the virtual world, read this:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;amp;cmd=displayKC&amp;amp;externalId=1018206"&gt;http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;amp;cmd=displayKC&amp;amp;externalId=1018206&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-12-08T00:24:42Z</a10:updated></item><item><guid isPermaLink="false">7d76d3a0-ad9a-4ab8-97cd-ea4b93ee6313</guid><link>http://sqlservice.se/sv/start/blogg/nya-utbildningsmojligheter.aspx?lang=sv</link><title>Nya utbildningsmöjligheter</title><description>&lt;p&gt;I morgon torsdag 6/12 mellan kl 17-23 finns m&amp;ouml;jlighet att l&amp;auml;ra sig mer om Performance n&amp;auml;r det g&amp;auml;ller SQL Server. Under dessa tider g&amp;aring;r n&amp;auml;mligen sex stycken sessioner i detta viktiga &amp;auml;mne i ett mini "24 Hours of PASS".&lt;/p&gt;&#xD;
&lt;p&gt;Vilka sessionerna &amp;auml;r och mer information hittar ni h&amp;auml;r:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://performance.sqlpass.org/2012Palooza.aspx"&gt;http://performance.sqlpass.org/2012Palooza.aspx&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-12-05T07:09:30Z</a10:updated></item><item><guid isPermaLink="false">0a4af0f5-6d9f-43a4-a4e3-ac379422a1d9</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-central-question-of-the-day-challenge.aspx?lang=sv</link><title>SQL Server Central Question of the day challenge</title><description>&lt;p&gt;At &lt;a href="http://www.sqlservercentral.com/Questions"&gt;http://www.sqlservercentral.com/Questions&lt;/a&gt;&amp;nbsp;you can test your knowledge and improve you skills by trying to answer the "question a day". It takes no more than 5 minutes a day to answer a question and you earn points if you answer correct. Some questions are really tricky and not too obvious.&lt;/p&gt;&#xD;
&lt;p&gt;This is a fun and powerful way of learning something new. Personally I have earned 2024 points and are at position 143. This week I challenged all my collegues to answer at least&amp;nbsp;1 question a day during 2013 and the collegue that earn most points during the next year will earn a price. The points will be counted from 2013-01-01 to 2013-12-31 to make sure&amp;nbsp;everyone has the same&amp;nbsp;oppertunity.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;In this challenge, everyone is a winner.&lt;/p&gt;&#xD;
&lt;p&gt;Take the chance and challenge your collegues during 2013 and have fun while you learn.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;/H&amp;aring;kan Winther&lt;/p&gt;</description><a10:updated>2012-12-04T22:51:49Z</a10:updated></item><item><guid isPermaLink="false">d8acc2ac-e5c5-4827-83cb-e252865df20c</guid><link>http://sqlservice.se/sv/start/blogg/sql-server--death-by-mountpoints.aspx?lang=sv</link><title>SQL Server - death by mountpoints</title><description>&lt;p&gt;This is another blog post in the Death by series, but has nothing to do with performance. Well,&amp;nbsp;the case that led to this blog post&amp;nbsp;had to do with performance in the first place, as the drive&amp;nbsp;where&amp;nbsp;tempdb resided was super slow with average disk read time&amp;nbsp;aboce 350ms.&amp;nbsp;In this blog post I&amp;rsquo;ll cover the death of a SQL server instance by moving the tempdb to a new location, like in this case at the root of a mount point.&lt;/p&gt;&#xD;
&lt;p&gt;Last week a client of mine had to move the tempdb to a larger volume, and he sent me a script for verification and everything seemed fine.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #0000ff;"&gt;USE&lt;/span&gt; master;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #0000ff;"&gt;ALTER DATABASE&lt;/span&gt; tempdb&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;MODIFY FILE&lt;/span&gt; (NAME=&lt;span style="color: #ff0000;"&gt;'tempdev'&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;FILENAME&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;'i:\Temp_mountpoint\tempdb.mdf'&lt;/span&gt;); &lt;br /&gt;&lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;ALTER DATABASE&lt;/span&gt; tempdb &lt;br /&gt;&lt;span style="color: #0000ff;"&gt;MODIFY FILE&lt;/span&gt; (NAME='&lt;span style="color: #ff0000;"&gt;templog&lt;/span&gt;', &lt;span style="color: #0000ff;"&gt;FILENAME&lt;/span&gt;='&lt;span style="color: #ff0000;"&gt; i:\Temp_mountpoint\tempdb.ldf'&lt;/span&gt;); &lt;br /&gt;&lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;A couple of minutes later he ran the script and restarted the SQL server instance running on a 4 node cluster. After a couple of minutes I tried to connect to the instance to make sure everything worked as expected. To my surprise the instance was still not running, and after another couple of minutes I knew something was terribly wrong.&lt;/p&gt;&#xD;
&lt;p&gt;The SQL server instance was failing during the startup and in the eventlog there were a couple of error messages, like:&lt;/p&gt;&#xD;
&lt;p&gt;CREATE FILE encountered operating system error 5(failed to retrieve text for this error. Reason: 15100) while attempting to open or create the physical file 'I:\tempdb_mountpoint\tempdb.mdf'.&lt;/p&gt;&#xD;
&lt;p&gt;Could not create tempdb. You may not have enough disk space available. Free additional disk space by deleting other files on the tempdb drive and then restart SQL Server. Check for additional errors in the event log that may indicate why the tempdb files could not be initialized.&lt;/p&gt;&#xD;
&lt;p&gt;Well there were plenty of space available in the new volume and the SQL service account was granted full access to the directory. The first error message is complaining about &amp;ldquo;access is denied&amp;rdquo; and the second about &amp;ldquo;not enough disk space&amp;rdquo;, what&amp;rsquo;s going on here?&lt;/p&gt;&#xD;
&lt;p&gt;I started the instance with minimal configuration by using:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;Sqlserver.exe -s name_of_instance -f&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Then I logged on as administrator in the instance, created a new file for tempdb data and one for the log. The files appeared in file explorer, so the SQL server account could create new files appearantly!&lt;/p&gt;&#xD;
&lt;p&gt;I created a sub directory beneath the root of the mount point, moved the files to the sub directory and restarted the instance without minimal configuration and everything worked just fine.&lt;/p&gt;&#xD;
&lt;p&gt;This behavior felt strange and I couldn&amp;rsquo;t came up with a logical explanation so after some searching the Internet, I found this connect item:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/569895/installation-of-sql-server-2008-r2-on-mount-points-fails"&gt;http://connect.microsoft.com/SQLServer/feedback/details/569895/installation-of-sql-server-2008-r2-on-mount-points-fails&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;It turned out to be a bug in the Windows API when using mount points!&lt;/p&gt;&#xD;
&lt;p&gt;If you want to know more about SQL server, feel free to contact any of our SQL server experts.&lt;/p&gt;&#xD;
&lt;p&gt;/H&amp;aring;kan Winther&lt;/p&gt;</description><a10:updated>2012-12-02T22:13:35Z</a10:updated></item><item><guid isPermaLink="false">02e9d9a7-87e1-47ae-b553-eb218810a5cb</guid><link>http://sqlservice.se/sv/start/blogg/ssas-compare.aspx?lang=sv</link><title>SSAS Compare</title><description>&lt;p&gt;H&amp;auml;r kommer ett&amp;nbsp;tips p&amp;aring; bra verktyg fr&amp;aring;n Red Gate, n&amp;auml;mligen helt nya &lt;strong&gt;SSAS Compare&lt;/strong&gt;. Som namnet antyder anv&amp;auml;nds det f&amp;ouml;r att hitta skillnader mellan tv&amp;aring; SSAS milj&amp;ouml;er. Detta &amp;auml;r version 1.0 och just nu &amp;auml;r den helt gratis. Vi &amp;aring;terkommer senare n&amp;auml;r vi har utv&amp;auml;rderat det mera, men vid f&amp;ouml;rsta testerna ser det ok ut. Som ni ser av bilderna nedan s&amp;aring; liknar det "SQL Compare" som anv&amp;auml;nds flitigt av oss som jobbar med&amp;nbsp;SQL Server databaser. "SSAS Compare" skall allts&amp;aring;&amp;nbsp;anv&amp;auml;ndas p&amp;aring; samma s&amp;auml;tt f&amp;ouml;r att skripta ut skillnader.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.red-gate.com/labs/free-tools/ssas-compare"&gt;http://www.red-gate.com/labs/free-tools/ssas-compare&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=66b4b7a4-15a0-485f-a029-58e2e5a0bc72&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=36dbcfea-39ff-4673-b407-11ee41170494&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-11-30T11:27:33Z</a10:updated></item><item><guid isPermaLink="false">913acdc7-3c8e-4063-8d51-bda3fe32d4e4</guid><link>http://sqlservice.se/sv/start/blogg/nya-forbatringar-for-sql-server-2012-sp1.aspx?lang=sv</link><title>Nya förbätringar för SQL Server 2012 SP1</title><description>&lt;p&gt;Det k&amp;auml;ndes som alldeles nyss vi fick SP1 f&amp;ouml;r SQL Server 2012. Den lanserades ju under PASS Summit den 7 november och Ted Kummerts dragning. Nu &amp;auml;r det i alla fall ytterligare f&amp;ouml;rb&amp;auml;ttring tillg&amp;auml;ngliga f&amp;ouml;r&amp;nbsp;SQL Server 2012 d&amp;aring; n&amp;auml;stan 50 stycken f&amp;ouml;rb&amp;auml;ttringar/fixar blivit &amp;aring;tg&amp;auml;rdade f&amp;ouml;r SP 1. Som vanligt b&amp;ouml;r man alltid f&amp;ouml;rst studera vilka f&amp;ouml;rb&amp;auml;ttringarna &amp;auml;r, avg&amp;ouml;ra om man skall installera dem och i s&amp;aring; fall f&amp;ouml;rst&amp;aring;s g&amp;ouml;ra det f&amp;ouml;rst i sin testmilj&amp;ouml; innan man g&amp;aring;r till produktion.&lt;/p&gt;&#xD;
&lt;p&gt;En av dessa f&amp;ouml;rb&amp;auml;ttringar &amp;auml;r denna och vem vill inte ha denna r&amp;auml;tt i sin milj&amp;ouml; ?&amp;nbsp;:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;FIX: Incorrect results when you run a parallel query that uses a columnstore index in SQL Server 2012.&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;When you run a parallel query in Microsoft SQL Server 2012, you may receive incorrect results. This problem occurs if the following conditions are true:&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;&amp;bull;The query runs against a partitioned table that has a columnstore index.&lt;/li&gt;&#xD;
&lt;li&gt;&amp;bull;The query uses an aggregate function over the columnstore index.&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2765331"&gt;Cumulative update package 1 for SQL Server 2012 Service Pack 1 &amp;nbsp; &lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-11-24T07:33:39Z</a10:updated></item><item><guid isPermaLink="false">5199872b-dc2c-4678-ad87-08a00f5d52ec</guid><link>http://sqlservice.se/sv/start/blogg/ny-uppdatering-for-sql-server-2008-sp3.aspx?lang=sv</link><title>Ny uppdatering för SQL Server 2008 SP3</title><description>&lt;p&gt;Helt nyligt har man fr&amp;aring;n Microsoft sl&amp;auml;ppt f&amp;ouml;rb&amp;auml;ttringar f&amp;ouml;r SQL Server 2008 och SP3. Som alltid b&amp;ouml;r man studera vilka f&amp;ouml;rb&amp;auml;ttringarna &amp;auml;r och sedan avg&amp;ouml;ra om man skall installera dem. Dock b&amp;ouml;r man f&amp;ouml;rst&amp;aring;s g&amp;ouml;ra det f&amp;ouml;rst i sin testmilj&amp;ouml; innan man g&amp;aring;r till produktion.&lt;/p&gt;&#xD;
&lt;p&gt;Nu finns det det ju en orsak till att man sl&amp;auml;pper dessa uppdateringar, och se nedan en av f&amp;ouml;rb&amp;auml;ttringarna eller r&amp;auml;ttare sagt buggfix'en.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;FIX: Incorrect result is returned when you query an indexed view by using the NOEXPAND hint in SQL Server 2008&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Consider the following scenario:&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;&amp;bull;You create an indexed view for two tables that have a foreign key reference in Microsoft SQL Server 2008.&lt;/li&gt;&#xD;
&lt;li&gt;&amp;bull;You update the base tables of the indexed view.&lt;/li&gt;&#xD;
&lt;li&gt;&amp;bull;You run a query against the indexed view that uses the NOEXPAND hint.&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;In this scenario, you receive an incorrect result.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2771833"&gt;Cumulative update package 8 for SQL Server 2008 Service Pack 3 &lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-11-24T07:10:22Z</a10:updated></item><item><guid isPermaLink="false">00e95772-cf2b-4a79-b2ef-af82d0553931</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-2012-sp1.aspx?lang=sv</link><title>SQL Server 2012 SP1</title><description>&lt;p&gt;Som vanligt vill man alltid lansera n&amp;aring;got "till massorna" vid PASS Summit som nu g&amp;aring;r av stapeln i Seattle. Detta innebar i &amp;aring;r service pack 1 f&amp;ouml;r SQL Server 2012. Denna har varit ganska v&amp;auml;ntad l&amp;auml;nge d&amp;aring; man sl&amp;auml;ppt CTP i flera omg&amp;aring;ngar. Nu finns den i alla fall tillg&amp;auml;nglig f&amp;ouml;r nedl&amp;auml;ddning som man hittar &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=35575"&gt;h&amp;auml;r&lt;/a&gt; och den best&amp;aring;r av n&amp;auml;rmare 60 r&amp;auml;ttningar sedan RTM versionen.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-11-23T07:52:53Z</a10:updated></item><item><guid isPermaLink="false">963bb187-d554-450c-80f3-d5d3097ed01e</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-performance--death-by-xp_cmdshell.aspx?lang=sv</link><title>SQL Server performance - Death by xp_cmdshell</title><description>&lt;p&gt;In SQL server there is an extended procedure, called xp_cmdshell, which you can use to execute commands and programs outside the SQL server process. It can be useful if you need to do something that is not supported by the T-SQL language, like secure copy, BUT there are some major risks attached to the use of xp_cmdshell. Personally, I am not a frient of xp_cmdshell.&lt;/p&gt;&#xD;
&lt;p&gt;Besides the security risk there is another risk that may strike you like lightning. What happens if you are using xp_cmdshell within a procedure called from SQL agent and the program you execute throws an error that can&amp;rsquo;t be caught by xp_xmdshell.&lt;/p&gt;&#xD;
&lt;p&gt;Assume you are using xp_cmdshell to execute secure copy and the program can&amp;rsquo;t find the path specified. Xp_cmdshell will wait for a response from secure copy, but secure copy doesn&amp;rsquo;t send a response and xp_cmdshell will wait for a long, long, long time. That's what happened to a client recently.&lt;/p&gt;&#xD;
&lt;p&gt;When you finally realize that you have a process that is hung, the first thing you probably will try is to kill the process. But what will happen? If you kill a process with a transaction, SQL server will roll back the transaction, but how in the world are going to roll back a transaction with a failing external program!?&lt;/p&gt;&#xD;
&lt;p&gt;Now you have a process (spid) that is stuck in the middle of a restore, and the worst part is that any locks acquired on rows, pages or tables are not released.&lt;/p&gt;&#xD;
&lt;p&gt;Assume that no locks are acquired and you can live with the stuck process for a while, until you can restart the SQL service instance. What happens with the SQL Agent job that called the procedure in the first place? Well, you can&amp;rsquo;t restart the job, because SQL Agent job is still running.&lt;/p&gt;&#xD;
&lt;p&gt;How do you solve this issue? The most obvious, is to avoid the issue in the first place.&lt;/p&gt;</description><a10:updated>2012-11-23T07:49:09Z</a10:updated></item><item><guid isPermaLink="false">8db4fcd8-287a-41bf-b083-895e9f4e0ead</guid><link>http://sqlservice.se/sv/start/blogg/arets-upplevelse-i-repris-.aspx?lang=sv</link><title>Årets upplevelse i repris ?</title><description>&lt;p&gt;Ett tips om man missade n&amp;aring;gon session fr&amp;aring;n &amp;aring;rets nyss avslutade PASS Summit &amp;auml;r att helt enkelt ladda ned dessa. Detta &amp;auml;r nu m&amp;ouml;jligt &lt;a href="http://www.sqlpass.org/summit/2012/Sessions/BuildSchedule.aspx"&gt;h&amp;auml;r&lt;/a&gt;. F&amp;ouml;r er som inte hade m&amp;ouml;jlighet att vara p&amp;aring; plats i Seattle eller somnade fr&amp;aring;n n&amp;aring;gon lives&amp;auml;ndning finns det &amp;auml;nnu m&amp;ouml;jlighet att k&amp;ouml;pa dessa p&amp;aring; ett USB. Mer uppgifter om detta hittar ni &lt;a href="http://archive.pass.bethereglobal.com/shop/"&gt;h&amp;auml;r&lt;/a&gt;.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-11-21T06:55:47Z</a10:updated></item><item><guid isPermaLink="false">80c0ad0f-27c9-45ee-9a54-f07c038b3d98</guid><link>http://sqlservice.se/sv/start/blogg/sql-rally-nordic-2012.aspx?lang=sv</link><title>SQL Rally Nordic 2012</title><description>&lt;p&gt;F&amp;ouml;r oss som missade SQL Rally Nordic i K&amp;ouml;penhamn tidigare i &amp;aring;r finns det&amp;nbsp;det m&amp;ouml;jligt att lyssna och se de sessioner som var&amp;nbsp;under dessa dagar i &amp;nbsp;mars. Detta kan man g&amp;ouml;ra &lt;a href="http://www.sqlpass.org/sqlrally/2012/nordic/Agenda/VideoRecordings.aspx"&gt;h&amp;auml;r&lt;/a&gt; och massor av godbitar finns, t.ex. Conor Cunningham med "SQL Server 2012 Query Optimizer deep dive".&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-11-20T15:36:10Z</a10:updated></item><item><guid isPermaLink="false">91a41bf8-e317-401a-8295-c410aa1c43cb</guid><link>http://sqlservice.se/sv/start/blogg/fullstandig-sql-server-management-studio-med-sql-server-2012-sp1.aspx?lang=sv</link><title>Fullständig SQL Server Management Studio med SQL Server 2012 SP1</title><description>&lt;p&gt;I samband med att Microsoft sl&amp;auml;ppte Service Pack 1 f&amp;ouml;r SQL Server 2012, kom en god nyhet f&amp;ouml;r er som anv&amp;auml;nder SQL Server Express. Fr&amp;aring;n och med 2012 SP1 kommer den fulla versionen av SSMS att ligga med om man k&amp;ouml;r SQL Server Express With Tools, SQL Server Express COMP, SQL Server Express with Advanced Services eller SQL Server Management Studio Express.&lt;/p&gt;&#xD;
&lt;p&gt;Det finns &amp;auml;ven en hel del annat att gl&amp;auml;djas &amp;ouml;ver, i form av till exempel m&amp;ouml;jligheten att migrera&amp;nbsp;en AlwaysOn Availability group fr&amp;aring;n ett kluster till ett annat och selektiva XML index. Mer information om SQL Server 2012 SP1 hittar du h&amp;auml;r: &lt;a href="http://msdn.microsoft.com/en-us/library/bb500435"&gt;http://msdn.microsoft.com/en-us/library/bb500435&lt;/a&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-11-16T14:11:38Z</a10:updated></item><item><guid isPermaLink="false">9e95ecd6-81ac-4b2a-b4f7-d00602bf2cea</guid><link>http://sqlservice.se/sv/start/blogg/pass-summit-2013.aspx?lang=sv</link><title>PASS Summit 2013</title><description>&lt;p&gt;Efter 5 &amp;aring;r i Seattle kommer PASS Summit f&amp;ouml;rflyttas till &amp;ouml;stkusten n&amp;auml;sta &amp;aring;r, n&amp;auml;mligen Charlotte, NC vilket inneb&amp;auml;r lite kortare flygresa f&amp;ouml;r oss svenskar och bara 6 timmars tidskillnad :-). Tydligen kommer man ha basen f&amp;ouml;r PASS Summit i Seattle &amp;auml;ven&amp;nbsp;i framtiden med tanke p&amp;aring; n&amp;auml;rheten till Microsoft i Redmond och med j&amp;auml;mna mellanrum f&amp;ouml;rl&amp;auml;gga det till andra platser f&amp;ouml;r att f&amp;aring; med sig &amp;auml;nnu mer deltagare. I &amp;aring;r samlades n&amp;auml;stan 4000 personer fr&amp;aring;n 57 l&amp;auml;nder och &amp;auml;ven om den st&amp;ouml;rsta gruppen &amp;auml;r amerikaner s&amp;aring; vi var inte s&amp;aring; f&amp;aring; svenskar vilket &amp;auml;r kul och att s&amp;aring; pass m&amp;aring;nga insett att detta Nr 1 n&amp;auml;r det g&amp;auml;ller utbildning/konferens n&amp;auml;r det g&amp;auml;ller SQL Server. N&amp;auml;sta &amp;aring;rs datum &amp;auml;r 14-18 oktober och som vanligt tj&amp;auml;nar man p&amp;aring; att boka tidigt och detta kan man g&amp;ouml;ra &lt;a href="http://www.sqlpass.org/summit/2013/default.aspx"&gt;h&amp;auml;r&lt;/a&gt;.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-11-16T07:34:54Z</a10:updated></item><item><guid isPermaLink="false">a8b173fc-2a12-4c9c-80e7-f43f5b3294f9</guid><link>http://sqlservice.se/sv/start/blogg/hekaton-sql-server-mystery-revealed.aspx?lang=sv</link><title>Hekaton SQL Server mystery revealed!</title><description>&lt;p&gt;As some of you might remember, I published this &lt;a href="../sv/start/blogg/sql-server-mystery-hekaton-tables-and-hekaton-procedures.aspx"&gt;http://sqlservice.se/sv/start/blogg/sql-server-mystery-hekaton-tables-and-hekaton-procedures.aspx&lt;/a&gt; blogpost back in June, when I stumbled upon a mysterious reference inside SQL Server to something called Hekaton.&lt;/p&gt;&#xD;
&lt;p&gt;Well, it is no longer a mystery, as Microsoft has just announced (More details here: &lt;a href="http://blogs.technet.com/b/dataplatforminsider/archive/2012/11/08/breakthrough-performance-with-in-memory-technologies.aspx"&gt;http://blogs.technet.com/b/dataplatforminsider/archive/2012/11/08/breakthrough-performance-with-in-memory-technologies.aspx&lt;/a&gt;) the In Memory technology Hekaton to be released in the next major version of SQL Server. There is not a lot of public information available yet apart from that blogpost, but from what I have seen and heard&amp;nbsp;so far, it seems very exiting, and we could be standing on the edge of the next big leap in database technology.&lt;/p&gt;&#xD;
&lt;p&gt;The key points to take away from now is&lt;/p&gt;&#xD;
&lt;p&gt;- Hekaton is for high voulme OLTP solutions&lt;/p&gt;&#xD;
&lt;p&gt;- It is built in to the SQL Server product, and accessed using standard T-SQL, menaning it is (almost) transparent to your applications&lt;/p&gt;&#xD;
&lt;p&gt;- Hekaton tables are all in memory, but you can choose to persist the data&lt;/p&gt;&#xD;
&lt;p&gt;- Persistence is done in an optimized way (sequential data write) and indexes are never persisted&lt;/p&gt;&#xD;
&lt;p&gt;- Hekaton stored procedures are T-SQL procedures that are compiled into native code to run very much faster&lt;/p&gt;&#xD;
&lt;p&gt;- Scale Up is provided by taking away all locking and latching. ACID is provided trough versioning&lt;/p&gt;&#xD;
&lt;p&gt;- This is just the beginning, more cool improvements to Hekaton are already in the making !!&lt;/p&gt;&#xD;
&lt;p&gt;We can hope for a public CTP in the summer of 2013, and a RTM during 2014. But as usual, there are no guarantees that those dates will hold in the end.&lt;/p&gt;</description><a10:updated>2012-11-09T00:47:54Z</a10:updated></item><item><guid isPermaLink="false">aff97c88-2120-4adb-b7e0-7d36a2d6fa91</guid><link>http://sqlservice.se/sv/start/blogg/pass-summit-2012--dag-2.aspx?lang=sv</link><title>PASS Summit 2012 - Dag 2</title><description>&lt;p&gt;Som v&amp;auml;ntat n&amp;auml;stan blev det en v&amp;auml;ldigt bra g&amp;aring;rdag med Peter Myers och heldagssessionen om SSAS 2012. Har &amp;auml;r ju en v&amp;auml;lk&amp;auml;nd och uppskattad &amp;nbsp;talare med bra planering av sin tid och m&amp;aring;nga av hans olika sessioner g&amp;aring;r ju ladda ned t.ex. denna: &lt;a href="http://channel9.msdn.com/posts/SQL11UPD06-REC-01"&gt;http://channel9.msdn.com/posts/SQL11UPD06-REC-01&lt;/a&gt;.&lt;/p&gt;&#xD;
&lt;p&gt;Vi var ca 200 personer i lokalen och uppskattningsvis &amp;auml;r det ca 1600 som kommer till dessa tv&amp;aring; dagar med f&amp;ouml;rkonferenserna. Av dessa &amp;auml;r det faktiskt r&amp;auml;tt stor del svenskar vilket f&amp;ouml;rst&amp;aring;s &amp;auml;r kul. Sj&amp;auml;lva sessionen gick igenom de olika alternativ man nu har med SQL Server 2012 och Peter byggde samma l&amp;ouml;sning med gamla "Multidimensional Mode" fast&amp;auml;n nytt namn, &amp;nbsp;och nya "Tabular Mode". Av hela dagen tog bara "Tabular-l&amp;ouml;sningen" 1/3 del av dagen att utveckla och dema, j&amp;auml;mf&amp;ouml;rt med gamla s&amp;auml;ttet att bygga kuber tog minst dubbetlt s&amp;aring; l&amp;auml;nge. M&amp;auml;rkligt nog kom de flest fr&amp;aring;gor p&amp;aring; gamla s&amp;auml;ttet som borde varit v&amp;auml;lk&amp;auml;nt j&amp;auml;mf&amp;ouml;rt med det nya. Som vanligt beror det sedan p&amp;aring; m&amp;aring;nga faktorer vilket s&amp;auml;tt man sedan v&amp;auml;ljer f&amp;ouml;r att utveckla BI-l&amp;ouml;sningar. Dock &amp;auml;r det ju r&amp;auml;tt troligt att de flesta nya l&amp;ouml;sningar kommer bli med "Tabular Mode" eftersom det g&amp;aring;r s&amp;aring; mycket fortare, &amp;auml;r l&amp;auml;ttaresom vi s&amp;aring;g&amp;nbsp;och v&amp;aring;rt gamla s&amp;auml;tt faktiskt funnit r&amp;auml;tt l&amp;auml;nge nu &amp;auml;ven om det har sina f&amp;ouml;rdelar t.ex "Translation" vilket inte &amp;auml;nnu finns bl a.&lt;/p&gt;</description><a10:updated>2012-11-07T14:37:25Z</a10:updated></item><item><guid isPermaLink="false">e1d14ff4-9bf0-49e8-bc5e-8c04f0ec8809</guid><link>http://sqlservice.se/sv/start/blogg/pass-summit-2012.aspx?lang=sv</link><title>PASS Summit 2012</title><description>&lt;p&gt;S&amp;aring; har det &amp;aring;ter blivit dags f&amp;ouml;r PASS Summit, och som de senaste &amp;aring;ren i Settle. St&amp;ouml;rsta sk&amp;auml;let till just Seattle &amp;auml;r n&amp;auml;rheten till Microsoft i Redmond och det &amp;auml;r ju inget d&amp;aring;ligt sk&amp;auml;l. Som i fjol inleds veckan med tv&amp;aring; heldagssessioner innan det "riktiga" programmet drar ig&amp;aring;ng p&amp;aring; allvar. Sj&amp;auml;lv hade jag inte m&amp;ouml;jlighet till dag 1, men nu &amp;auml;r det dag 2 som g&amp;auml;ller och f&amp;ouml;r mig med Peter Myers och "Zero to BI Semantic Model with SQL Server 2012", som handlar om de val och m&amp;ouml;jligheter man har att utveckla BI-l&amp;ouml;sningar med SQL Server 2012. Troligtvis kommer denna dag handla mycket om "Tabular Model" som &amp;auml;r den stora nyheten i SQL Server 2012 Analysis Services, men mer om detta senare.&lt;/p&gt;&#xD;
&lt;p&gt;Den enda nackdelen med just Seattle &amp;auml;r avst&amp;aring;ndet hit f&amp;ouml;r oss nordbor, men ett bra s&amp;auml;tt att f&amp;ouml;rdriva tiden och f&amp;ouml;rbereda sig f&amp;ouml;r denna dag har varit att l&amp;auml;sa "SQL Server 2012 Analysis Services The BISM Tabular Model" ISBN-13: 978-0-7356-5818-9, som jag varmt kan rekommendera. Boken g&amp;aring;r grundligt igenom hela processen med bakgrund, installation, utveckling och underh&amp;aring;l av just "Tabular Model"l. En av f&amp;ouml;rfattarna &amp;auml;r Marco Russo som man f&amp;ouml;rresten kan h&amp;ouml;ra och tr&amp;auml;ffa i Stockholm redan den 29 november, men som tyv&amp;auml;rr redan &amp;auml;r fullsatt.&lt;/p&gt;&#xD;
&lt;p&gt;En av nyheterna f&amp;ouml;r &amp;aring;ret n&amp;auml;r det g&amp;auml;ller PASS att man kan f&amp;ouml;lja vissa sessioner live. Detta kan man g&amp;ouml;ra fr&amp;aring;n onsdag och mer om detta hittar ni &lt;a href="http://www.sqlpass.org/summit/2012/Sessions/MoreLearning/passtv.aspx"&gt;h&amp;auml;r&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Seattle &amp;auml;r ju ett k&amp;auml;nt regnst&amp;auml;lle, men &amp;auml;n har jag inte sett regn utan bara h&amp;auml;rligt h&amp;ouml;stv&amp;auml;der :-)&lt;/p&gt;</description><a10:updated>2012-11-06T10:25:20Z</a10:updated></item><item><guid isPermaLink="false">f7a524a3-c4b3-42a6-b776-c104ffe6bea0</guid><link>http://sqlservice.se/sv/start/blogg/ladda-ner-var-windows-8-app.aspx?lang=sv</link><title>Ladda ner vår Windows 8 app</title><description>&lt;p&gt;SQL Service har l&amp;aring;tit utveckla en Windows 8 app f&amp;ouml;r att enklare kunna titta p&amp;aring; v&amp;aring;ra blogginl&amp;auml;gg p&amp;aring; dator, telefon och Microsoft Surface som har Windows 8 som operativsystem.&lt;/p&gt;&#xD;
&lt;p&gt;Klicka p&amp;aring; f&amp;ouml;ljande l&amp;auml;nk f&amp;ouml;r att komma till Windows Store:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://apps.microsoft.com/webpdp/sv-SE/app/sql-service/9e739aea-b6f1-46ab-83da-0f5814acf29e"&gt;http://apps.microsoft.com/webpdp/sv-SE/app/sql-service/9e739aea-b6f1-46ab-83da-0f5814acf29e&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-11-01T09:58:09Z</a10:updated></item><item><guid isPermaLink="false">9d140f1a-e479-4136-9149-d7e10a6c1b04</guid><link>http://sqlservice.se/sv/start/blogg/identifiera-problem-med-parametersniffning.aspx?lang=sv</link><title>Identifiera problem med parametersniffning</title><description>&lt;p&gt;Denna vecka har jag tittat lite p&amp;aring; prestandaproblem i SQL Server orsakade av parametersniffning. Jag t&amp;auml;nkte skriva en l&amp;auml;ngre blogpost om det, men s&amp;aring; hittade jag denna &lt;a href="http://blogs.msdn.com/b/sqlcat/archive/2010/06/09/identifying-query-compile-runtime-parameter-values-using-xml-showplan-output.aspx"&gt;http://blogs.msdn.com/b/sqlcat/archive/2010/06/09/identifying-query-compile-runtime-parameter-values-using-xml-showplan-output.aspx&lt;/a&gt;&amp;nbsp;som redan handlade om i stort s&amp;auml;tt det jag ville s&amp;auml;ga. S&amp;aring; d&amp;aring; f&amp;aring;r det ist&amp;auml;llet bli en refenrens till det blogginl&amp;auml;gget!&lt;/p&gt;&#xD;
&lt;p&gt;Ut&amp;ouml;ver det du kan l&amp;auml;sa dig till d&amp;auml;r, kan jag tipsa om n&amp;aring;gra situationer d&amp;auml;r man kan bli extra h&amp;aring;rt drabbad:&lt;/p&gt;&#xD;
&lt;p&gt;- Om du har oj&amp;auml;mn datadistribution i dina tabeller&lt;/p&gt;&#xD;
&lt;p&gt;- Om du har d&amp;aring;liga/saknade index&lt;/p&gt;&#xD;
&lt;p&gt;- Om din statistik &amp;auml;r utdaterad&lt;/p&gt;&#xD;
&lt;p&gt;- Om du bygger om index, och d&amp;auml;refter jobbar mot en liten del av datat i tabellerna som har oj&amp;auml;mn distribution.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Vad kan du d&amp;aring; g&amp;ouml;ra? Jo, du kan till exempel testa n&amp;aring;gra av f&amp;ouml;ljande saker:&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;- Ta bort den specifika d&amp;aring;liga Query Planen&lt;/p&gt;&#xD;
&lt;p&gt;- Anv&amp;auml;nd Trace Flag 4136 (OBS: TESTA DETTA F&amp;Ouml;RST!!!)&lt;/p&gt;&#xD;
&lt;p&gt;- Anv&amp;auml;nd flaggan OPTIMIZE FOR UNKNOWN, alternativt OPTIMIZE for parameter x = value y&lt;/p&gt;&#xD;
&lt;p&gt;- Bygg om index igen p&amp;aring; den aktuella tabellen&lt;/p&gt;&#xD;
&lt;p&gt;- Uppdatera statistiken igen p&amp;aring; den aktuella tabellen&lt;/p&gt;&#xD;
&lt;p&gt;- Skapa en Plan Guide med "r&amp;auml;tt" plan&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Eller, s&amp;aring; kan du givetvis h&amp;ouml;ra av dig till oss s&amp;aring; kan vi hj&amp;auml;lpa till!&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-10-31T20:08:26Z</a10:updated></item><item><guid isPermaLink="false">211be1c2-7bae-40e0-881e-4252e8904f6d</guid><link>http://sqlservice.se/sv/start/blogg/copy-with-headers--sql-server-2005.aspx?lang=sv</link><title>Copy with Headers - SQL Server 2005</title><description>&lt;p&gt;En nyhet som kom med SQL Server 2008 var m&amp;ouml;jligheten att kopiera med kolumnrubrikerna tillsammans med resultatet fr&amp;aring;n en grid.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=27b49eea-b54f-4d1b-a04b-8ff9ed58bbbc&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;F&amp;ouml;r&amp;nbsp;SQL Server 2005 finns inte detta menyalternativ.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=2efaf51b-e01f-42fd-badb-426f617fc1b9&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Dock &amp;auml;r det&amp;nbsp;ju faktiskt m&amp;ouml;jligt redan med SQL Server 2005, &amp;auml;ven om det kr&amp;auml;vs att man konfigurerar SSMS f&amp;ouml;r detta enligt bilden nedan.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=7c6d593a-2c58-4a14-97fd-9b22a0120e8b&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-10-31T15:48:30Z</a10:updated></item><item><guid isPermaLink="false">675f0ca4-9c2b-43f6-8ba6-cf2de3f81a67</guid><link>http://sqlservice.se/sv/start/blogg/lardomar-fran-installation.aspx?lang=sv</link><title>Lärdomar från installation</title><description>&lt;p&gt;Nyligen installerade jag ett nytt SQL2005 kluster. &lt;br /&gt;Att kunder fortfarande k&amp;ouml;r p&amp;aring; gamla versioner &amp;auml;r inte ovanligt men att en kund vill ha ett nyinstallerat SQL2005 kluster h&amp;ouml;r inte direkt till vanligheterna. Dock s&amp;aring; gjordes installationen p&amp;aring; Windows Server 2008.&lt;/p&gt;&#xD;
&lt;p&gt;Sagt och gjort, installationen startades och slutf&amp;ouml;rdes utan problem. Gick sedan in i kluster managern och f&amp;ouml;rv&amp;auml;ntade mig att hitta SQL Server som resurs i klustret men icke! N&amp;aring;gonstans ringde en klocka i bakhuvudet om att man m&amp;aring;ste installera minst SP2 f&amp;ouml;r SQL Server 2005 innan den blir synlig i kluster managern. Mycket riktigt, efter installation av SP3 d&amp;ouml;k den upp.&lt;/p&gt;&#xD;
&lt;p&gt;Referens: &lt;a href="http://support.microsoft.com/kb/932897"&gt;http://support.microsoft.com/kb/932897&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;N&amp;auml;sta sak som intr&amp;auml;ffade var n&amp;auml;r jag skulle konfigurera tempdb. Baserat p&amp;aring; kundens behov kom jag fram till att tempdb skulle vara 48GB f&amp;ouml;rdelat p&amp;aring; 8 filer. Filer lades till och ut&amp;ouml;kades.&lt;/p&gt;&#xD;
&lt;p&gt;Tempdb skulle dessutom enligt alla konstens regler ligga p&amp;aring; egen disk vilket innebar att den beh&amp;ouml;vde f&amp;ouml;rflyttas fr&amp;aring;n sin ursprungliga plats. Alla som gjort detta vet att man m&amp;aring;ste starta om SQL Server innan flytten&amp;nbsp;blir fullst&amp;auml;ndig. SQL Server startades om men kom inte upp igen....vad var nu detta?&lt;/p&gt;&#xD;
&lt;p&gt;Eftersom jag ut&amp;ouml;kat tempdb till 48GB s&amp;aring; tog det helt enkelt lite tid att skapa filerna (r&amp;auml;tt l&amp;aring;ng tid). L&amp;auml;rdom att dra av detta &amp;auml;r att &lt;strong&gt;f&amp;ouml;rst&lt;/strong&gt; flytta tempdb och sedan efter det ut&amp;ouml;ka filerna.&lt;/p&gt;&#xD;
&lt;p&gt;Slutet gott, allting fungerar nu utan problem.&lt;/p&gt;</description><a10:updated>2012-10-26T11:04:47Z</a10:updated></item><item><guid isPermaLink="false">846042f3-5e54-4e7b-8e4e-dcde30f75104</guid><link>http://sqlservice.se/sv/start/blogg/nagra-trace-flags-for-sql-server.aspx?lang=sv</link><title>Några Trace Flags för SQL Server</title><description>&lt;p&gt;&amp;nbsp;Om du vill &amp;auml;ndra p&amp;aring; &lt;a href="http://www.microsoft.com/sql"&gt;Microsoft SQL Servers&lt;/a&gt; standardbeteende, finns det m&amp;aring;nga inst&amp;auml;llningar du kan g&amp;ouml;ra till exempel med hj&amp;auml;lp av sp_configure, eller via Properties p&amp;aring; SQL Server instansen i Management Studio. Men vissa saker kan man enbart n&amp;aring; via s&amp;aring; kallade Trace Flags, som man st&amp;auml;ller in som startup option i SQL Server Configuration Manager (f&amp;ouml;r permanent f&amp;ouml;r&amp;auml;ndring) eller med hj&amp;auml;lp av DBCC TRACEON (F&amp;ouml;r tillf&amp;auml;llig f&amp;ouml;r&amp;auml;ndring)&lt;/p&gt;&#xD;
&lt;p&gt;Syntaxen i SQL Server Configuration Manager &amp;auml;r ";-T&amp;lt;trace flag number&amp;gt;".&amp;nbsp; Exempel: ";-T 1117"&lt;/p&gt;&#xD;
&lt;p&gt;Det finns en hel m&amp;auml;ngd Trace Flags, men jag t&amp;auml;nkte bara helt kort n&amp;auml;mna n&amp;aring;gra av dom f&amp;ouml;r att ge en k&amp;auml;nsla av vad du kan&amp;nbsp; g&amp;ouml;ra p&amp;aring; detta s&amp;auml;tt. Om du klickar p&amp;aring; l&amp;auml;nkarna nedan finns det mer information, &amp;auml;ven om Trace Flags som inte n&amp;auml;mns i denna artikel. Dock vill jag p&amp;aring;peka att Trace Flags &amp;auml;r mycket avancerade alternativ, och du b&amp;ouml;r l&amp;auml;sa in effekterna noga och testa i din egen testmilj&amp;ouml; innan du &amp;auml;ndra i din produktionsmilj&amp;ouml;. Eller &lt;a href="../sv/start/kontakta-oss.aspx"&gt;h&amp;ouml;r av dig till oss&lt;/a&gt;, s&amp;aring; hj&amp;auml;lper vi dig.&lt;/p&gt;&#xD;
&lt;p&gt;S&amp;aring;, h&amp;auml;r kommer n&amp;aring;gra Trace Flags att fundera p&amp;aring;!&lt;/p&gt;&#xD;
&lt;p&gt;834: Large Page Allocations, ger prestandaf&amp;ouml;rb&amp;auml;ttringar om man har mycket minne och eller mycket CPU&lt;/p&gt;&#xD;
&lt;p&gt;Referens: &lt;a href="http://support.microsoft.com/kb/920093"&gt;http://support.microsoft.com/kb/920093&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;1118: Force Uniform Extent Allocation. Tar bort vissa flaskhalsar som kan uppst&amp;aring; vi allokering av m&amp;aring;nga objekt samtidigt i Tempdb:&lt;/p&gt;&#xD;
&lt;p&gt;Referens: &lt;a href="http://blogs.msdn.com/b/psssql/archive/2008/12/17/sql-server-2005-and-2008-trace-flag-1118-t1118-usage.aspx"&gt;http://blogs.msdn.com/b/psssql/archive/2008/12/17/sql-server-2005-and-2008-trace-flag-1118-t1118-usage.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;4136: Parameter Sniffing behaviour alteration. Tar bort en del av problemen med &amp;rdquo;parameter sniffning&amp;rdquo; som man kan f&amp;aring; till exempel i Dynamics AX, n&amp;auml;r man har v&amp;auml;ldigt olika mycket data i de olika bolagen.&lt;/p&gt;&#xD;
&lt;p&gt;Referens: &lt;a href="http://blogs.msdn.com/b/axinthefield/archive/2010/11/04/sql-server-trace-flags-for-dynamics-ax.aspx"&gt;http://blogs.msdn.com/b/axinthefield/archive/2010/11/04/sql-server-trace-flags-for-dynamics-ax.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;1117: Simultaneous Autogrowth in Multiple-file databases. Ser till att en databas med flera datafiler ut&amp;ouml;kar alla filerna (i samma filegroup) n&amp;auml;r mer utrymme beh&amp;ouml;vs. Detta medf&amp;ouml;r att proportional fill algoritmen fungerar &amp;auml;ven efter auto growth.&lt;/p&gt;&#xD;
&lt;p&gt;Referens: &lt;a href="http://blogs.technet.com/technet_blog_images/b/sql_server_sizing_ha_and_performance_hints/archive/2012/02/09/sql-server-2008-trace-flag-t-1117.aspx"&gt;http://blogs.technet.com/technet_blog_images/b/sql_server_sizing_ha_and_performance_hints/archive/2012/02/09/sql-server-2008-trace-flag-t-1117.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-10-25T15:09:13Z</a10:updated></item><item><guid isPermaLink="false">0fcba509-8500-4229-9c61-8b36fffc9ce7</guid><link>http://sqlservice.se/sv/start/blogg/arets-sista-uppdatering-av-sql-server-2008-r2-.aspx?lang=sv</link><title>Årets sista uppdatering av SQL Server 2008 R2 ?</title><description>&lt;p&gt;R&amp;auml;tt nyligt har &amp;aring;ter en uppdatering av SQL Server 2008 R2 sl&amp;auml;ppts. Denna g&amp;auml;ller f&amp;ouml;r de som redan hunnit installera SP2 och uppdateringen heter nu CU 3.&amp;nbsp; Som vanligt b&amp;ouml;r man kontrollera de f&amp;ouml;r&amp;auml;ndringar som skett och d&amp;auml;refter avg&amp;ouml;ra om man skall uppdatera sin SQL Server milj&amp;ouml;. Det &amp;auml;r ju tyv&amp;auml;rr ganska vanligt att man inte uppdaterar sin milj&amp;ouml; efter att man gjort den initiala installation med den sk RTM versionen. Detta b&amp;ouml;r man f&amp;ouml;rst&amp;aring;s g&amp;ouml;ra och RTM versionen &amp;auml;r f&amp;ouml;rresten sedan i sommar osupporterad av Microsoft.&lt;/p&gt;&#xD;
&lt;p&gt;F&amp;ouml;rb&amp;auml;ttringar som skett av SQL Server 2008 R2 hittar man h&amp;auml;r:&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2754552"&gt;http://support.microsoft.com/kb/2754552&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-10-25T10:19:07Z</a10:updated></item><item><guid isPermaLink="false">109805f2-2ea9-4de6-b037-19ff3c5c804b</guid><link>http://sqlservice.se/sv/start/blogg/kerberos--part-2.aspx?lang=sv</link><title>Kerberos - part 2</title><description>&lt;p&gt;Recap from last week:&lt;/p&gt;&#xD;
&lt;p&gt;Well, you can easily verify that Kerberos validation is active by executing the following query:&lt;/p&gt;&#xD;
&lt;p&gt;select auth_scheme from sys.dm_exec_connections where &lt;a href="mailto:session_id=@@spid"&gt;session_id=@@spid&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Answer: "KERBEROS" &amp;lt;= YES, you&amp;acute;re all set! &amp;nbsp;"NTLM"&amp;nbsp;&amp;lt;= NO, it&amp;acute;s still not working.&lt;/p&gt;&#xD;
&lt;p&gt;So, you get the annoying "NTLM" reply from the query, now what?&lt;/p&gt;&#xD;
&lt;p&gt;The most common problem is that you have multiple registrations in Active Directory!&lt;/p&gt;&#xD;
&lt;p&gt;Run this in a CMD prompt: setspn -X&lt;/p&gt;&#xD;
&lt;p&gt;This command will list all duplicate registrations in the AD and if you find the following lines:&lt;/p&gt;&#xD;
&lt;p&gt;------------------------------------------------------------&lt;/p&gt;&#xD;
&lt;p&gt;Checking domain&amp;nbsp;DC=nydomain,DC=local&lt;/p&gt;&#xD;
&lt;p&gt;...&lt;/p&gt;&#xD;
&lt;p&gt;MSSQLSvc/nystromsql.nydomain.local:1433 is registered for these accounts:&lt;/p&gt;&#xD;
&lt;p&gt;CN=nystromsql,OU=servers,OU=up,DC=nydomain,DC=local&lt;/p&gt;&#xD;
&lt;p&gt;CN=sqlservices,OU=SYSTEM,OU=ACCOUNTS,OU=up,DC=nydomain,DC=local&lt;/p&gt;&#xD;
&lt;p&gt;...&lt;/p&gt;&#xD;
&lt;p&gt;You have two accounts registered for the MSSQLSvc service.&lt;/p&gt;&#xD;
&lt;p&gt;The solution to this is simply to remove the duplicate account. The only account that should be listed is the one that you entered in the SETSPN in last weeks session. If Kerberos finds a duplicate, it will always fall back to NTLM!&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Problem solved!&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;//Joakim&lt;/p&gt;</description><a10:updated>2012-10-21T21:19:05Z</a10:updated></item><item><guid isPermaLink="false">4ec80a61-1d6e-4048-891a-3021aa7dd960</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-management-studio-shortcuts-part-1.aspx?lang=sv</link><title>SQL Server management studio Shortcuts part 1</title><description>&lt;p&gt;In SQL server management studio there are a lot of shortcuts and one of the new shortcuts in SQL server 2008 is the shortcut for selecting text by columns in the query editor window. Lets say you want to change the alias for a table you need to change all the columns that is using the table alias. All you do is place the cursor where you want to start the selection and hold the SHIFT + ALT keys while you use the arrow keys to expand the selection like the image below.&lt;/p&gt;&#xD;
&lt;p&gt;If you want to use the mouse, you hold the ALT key and drag the mouse to expand the selection.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=c1705e0c-26a3-4ff5-8af5-089da69d46fa&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;If you are using SQL server 2012 you can actually replace the selection by entering a new text&amp;nbsp;and all&amp;nbsp;rows&amp;nbsp;will get the new text.&lt;/p&gt;</description><a10:updated>2012-10-20T07:59:45Z</a10:updated></item><item><guid isPermaLink="false">a840bd6e-dcf4-4a42-a28d-b26800098c65</guid><link>http://sqlservice.se/sv/start/blogg/edition-upgrade-fran-evaluation-edition.aspx?lang=sv</link><title>Edition Upgrade från Evaluation Edition</title><description>&lt;p&gt;Om du installerade SQL Server 2012 Evaluation Edition n&amp;auml;r SQL Server 2012 sl&amp;auml;pptes i v&amp;aring;ras, kommer du nu snart (om inte redan) att uppt&amp;auml;cka att du inte l&amp;auml;ngre kan anv&amp;auml;nda den. Utv&amp;auml;rderingsperioden p&amp;aring; 180 dagar har g&amp;aring;tt ut.&lt;/p&gt;&#xD;
&lt;p&gt;N&amp;auml;r du best&amp;auml;mmer dig f&amp;ouml;r att k&amp;ouml;pa en licens, beh&amp;ouml;ver du d&amp;aring; ominstallera hela SQL Server instansen? Nej, som tur &amp;auml;r beh&amp;ouml;ver du inte det! Du kan g&amp;ouml;ra en s&amp;aring; kallad Edition Upgrade, som inneb&amp;auml;r att du lyfter SQL Server Edition fr&amp;aring;n Evaluation till till exempel Enterprise, Standard eller Developer. det &amp;auml;r mycket enkelt att g&amp;ouml;ra, och tar bara n&amp;aring;gra minuter.&lt;/p&gt;&#xD;
&lt;p&gt;- Ta fram media f&amp;ouml;r den Edition du vill uppgradera till, och starta installationen.&lt;/p&gt;&#xD;
&lt;p&gt;- V&amp;auml;lj "Maintenance"&lt;/p&gt;&#xD;
&lt;p&gt;- V&amp;auml;lj "Edition Upgrade"&lt;/p&gt;&#xD;
&lt;p&gt;- The first part of the normal setup starts, klick your way forward to the Product Key page&lt;/p&gt;&#xD;
&lt;p&gt;- Enter the Product key (unless it is already filled in)&lt;/p&gt;&#xD;
&lt;p&gt;- Accept the terms&lt;/p&gt;&#xD;
&lt;p&gt;- Choose your SQL Server 2012 Instance(s)&lt;/p&gt;&#xD;
&lt;p&gt;- Klick your way forward, klick "Upgrade"&lt;/p&gt;&#xD;
&lt;p&gt;- Done! Should not take more than 5 minutes in total.&lt;/p&gt;</description><a10:updated>2012-10-17T08:32:27Z</a10:updated></item><item><guid isPermaLink="false">f4a0bbc1-c1c3-49fe-a4be-143d86919926</guid><link>http://sqlservice.se/sv/start/blogg/uppdatering-for-sql-server-2012.aspx?lang=sv</link><title>Uppdatering för SQL Server 2012</title><description>&lt;p&gt;Alldeles nyligen har man fr&amp;aring;n Microsoft sl&amp;auml;ppt ytterligare en uppdatering av SQL Server 2012. Som vanligt b&amp;ouml;r man kontrollera de f&amp;ouml;r&amp;auml;ndringar som skett och d&amp;auml;refter avg&amp;ouml;ra om man skall uppdatara sin SQL Server milj&amp;ouml;. Tyv&amp;auml;rr &amp;auml;r det alltf&amp;ouml;r vanligt att man inte uppdaterar sin milj&amp;ouml; efter att man gjort den initiala installation. Detta b&amp;ouml;r man f&amp;ouml;rst&amp;aring;s g&amp;ouml;ra och &lt;a href="http://support.microsoft.com/kb/2758687"&gt;h&amp;auml;r&lt;/a&gt; kommer de f&amp;ouml;rb&amp;auml;ttringar som skett av SQL Server 2012.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-10-16T11:32:19Z</a10:updated></item><item><guid isPermaLink="false">c4dac574-b01a-425f-9eaf-d252f36e1bde</guid><link>http://sqlservice.se/sv/start/blogg/24-hours-of-pass-2012.aspx?lang=sv</link><title>24 Hours of PASS 2012</title><description>&lt;p&gt;F&amp;ouml;r er som som missade att f&amp;aring; ett smakprov av kommande SQL Pass Summit 2012,&amp;nbsp; n&amp;auml;mligen 24 Hours of PASS s&amp;aring; g&amp;aring;r det nu att ladda ner sessionerna . M&amp;aring;nga av sessionerna var mycket bra och nu finns det m&amp;ouml;jlighet att ladda ner samtliga av dessa. Som sagt m&amp;aring;nga bra sessioner och dessa &amp;auml;r max 60 minuter l&amp;aring;nga. Nytt f&amp;ouml;r i &amp;aring;r &amp;auml;r det ocks&amp;aring; &amp;auml;r m&amp;ouml;jigt att ladda ned presentationerna. Allting hittar man &lt;a href="http://www.sqlpass.org/24hours/fall2012/"&gt;h&amp;auml;r&lt;/a&gt;.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-10-16T08:20:04Z</a10:updated></item><item><guid isPermaLink="false">db7fd041-30c1-4a10-988b-ab2289bc6b01</guid><link>http://sqlservice.se/sv/start/blogg/kerberos--getting-it-to-work-.aspx?lang=sv</link><title>Kerberos - getting it to work.</title><description>&lt;p&gt;Sometimes you want to do double-hop querying in SQL Server, for example if you add a linked server connection ot your server and you want to query objects on that server from your client. Now, if you run integrated security (native mode) and you want your credentials to validate you from the client over the server and to the linked server, you will have to enable Kerberos.&lt;/p&gt;&#xD;
&lt;p&gt;I think that many have had problems with this (as I frequently see special accounts set up in the linked server definition). Here I put together a short recipe for those of you to try at home (or at work).&lt;/p&gt;&#xD;
&lt;p&gt;Step 1: Active Directory settings (&lt;a href="http://support.microsoft.com/kb/917409"&gt;http://support.microsoft.com/kb/917409&lt;/a&gt;):&lt;/p&gt;&#xD;
&lt;ol&gt;&#xD;
&lt;li&gt;All accounts (users and computers) must belong to the same directory/forest.&lt;/li&gt;&#xD;
&lt;li&gt;The user account must NOT be specified as a sensitive account (not for delegation).&lt;/li&gt;&#xD;
&lt;li&gt;The user account must be specified as "trusted for delegation".&lt;/li&gt;&#xD;
&lt;li&gt;Also, all involved computers must be "trusted for delegation".&lt;/li&gt;&#xD;
&lt;/ol&gt;&#xD;
&lt;p&gt;Step 2: Run cmd command "setspn" (assuming you are running the listener on the standard port 1433) (The following may look like the same lines repeated, but trust me, you need all of them!!)&lt;/p&gt;&#xD;
&lt;ol&gt;&#xD;
&lt;li&gt;SETSPN -A MSSQLSvc/&amp;lt;NetBIOS servername&amp;gt; &amp;lt;sql service account&amp;gt;&lt;/li&gt;&#xD;
&lt;li&gt;SETSPN -A MSSQLSvc/&amp;lt;NetBIOS servername&amp;gt;:1433 &amp;lt;sql service account&amp;gt;&lt;/li&gt;&#xD;
&lt;li&gt;SETSPN -A MSSQLSvc/&amp;lt;FQDN servername&amp;gt; &amp;lt;sql service account&amp;gt;&lt;/li&gt;&#xD;
&lt;li&gt;SETSPN -A MSSQLSvc/&amp;lt;FQDN servername&amp;gt;:1433 &amp;lt;sql service account&amp;gt;&lt;/li&gt;&#xD;
&lt;/ol&gt;&#xD;
&lt;p&gt;In my home network NYDOMAIN where my sql server is named NYSTROMSQL.nydomain.local and the sql service account is NYDOMAIN\sqlservice the commands would thus be as follows: (run in CMD shell)&lt;/p&gt;&#xD;
&lt;ol&gt;&#xD;
&lt;li&gt;SETSPN -A MSSQLSvc/NYSTROMSQL NYDOMAIN\sqlservice&lt;/li&gt;&#xD;
&lt;li&gt;SETSPN -A MSSQLSvc/NYSTROMSQL:1433 NYDOMAIN\sqlservice&lt;/li&gt;&#xD;
&lt;li&gt;SETSPN -A MSSQLSvc/NYSTROMSQL.nydomain.local NYDOMAIN\sqlservice&lt;/li&gt;&#xD;
&lt;li&gt;SETSPN -A MSSQLSvc/NYSTROMSQL.nydomain.local:1433 NYDOMAIN\sqlservice&lt;/li&gt;&#xD;
&lt;/ol&gt;&#xD;
&lt;p&gt;So now you&amp;acute;re done! Everything is working...or is it?&lt;/p&gt;&#xD;
&lt;p&gt;Well, you can easily verify that Kerberos validation is active by executing the following query:&lt;/p&gt;&#xD;
&lt;p&gt;select auth_scheme from sys.dm_exec_connections where session_id=@@spid&lt;/p&gt;&#xD;
&lt;p&gt;Answer:&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;"KERBEROS" &amp;lt;= YES, you&amp;acute;re all set!&lt;/li&gt;&#xD;
&lt;li&gt;"NTLM"&amp;nbsp;&amp;lt;= NO, it&amp;acute;s still not working.&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;I will return next week with what to do if you receive "NTLM", good luck!&lt;/p&gt;&#xD;
&lt;p&gt;//Joakim Nystr&amp;ouml;m&lt;/p&gt;</description><a10:updated>2012-10-14T19:34:38Z</a10:updated></item><item><guid isPermaLink="false">d6c540ff-7631-4656-b9eb-9d6a37e3fca7</guid><link>http://sqlservice.se/sv/start/blogg/alternativ-till-pass-summit.aspx?lang=sv</link><title>Alternativ till PASS Summit</title><description>&lt;p&gt;PASS Summit 2012 i Settle n&amp;auml;rmar sig med stormsteg. Precis som i fjol h&amp;aring;lls tv&amp;aring; dagar med heldagssessioner innan hela programmet drar ig&amp;aring;ng p&amp;aring; allvar. Detta kr&amp;auml;ver att man registrerar sig och f&amp;ouml;rst&amp;aring;s betalar f&amp;ouml;r dessa tv&amp;aring; heldagar. Har man nu inte hunnit det kan man ist&amp;auml;llet titta p&amp;aring; detta alternativ &lt;strong&gt;SQL In The City&lt;/strong&gt; som &amp;auml;r helt gratis och g&amp;aring;r p&amp;aring; m&amp;aring;ndag den 5/11. &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Agenda och am&amp;auml;lan hittar man &lt;a href="http://sqlinthecity.red-gate.com/seattle-2012"&gt;h&amp;auml;r&lt;/a&gt;.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-10-10T05:36:03Z</a10:updated></item><item><guid isPermaLink="false">b77dfc5e-f37c-4957-bf59-dcb277e713e6</guid><link>http://sqlservice.se/sv/start/blogg/hitta-de-storsta-tabellerna.aspx?lang=sv</link><title>Hitta de största tabellerna</title><description>&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;Ibland vill man veta vilka tabeller som tar upp utrymmet i en vissa databas, till exempel om du upplever &amp;ouml;kad tillv&amp;auml;xt eller helt enkelt vill ta reda p&amp;aring; om det finns stora tabeller som du borde st&amp;auml;da ut historiskt data ur. Det &amp;auml;r ju s&amp;aring; att 1 GB data i din databas l&amp;auml;tt kan kr&amp;auml;va 10 GB lagringsutrymme totalt, om man r&amp;auml;knar&amp;nbsp; in backup utrymme, redundans p&amp;aring; diskniv&amp;aring;, test och utvecklingsmilj&amp;ouml;er och s&amp;aring; vidare.&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;Ett enkelt s&amp;auml;tt att titta p&amp;aring; detta &amp;auml;r att h&amp;ouml;gerklicka p&amp;aring; databasen och v&amp;auml;lja Reports -&amp;gt; Standard Reports -&amp;gt; Disk Usage By Top Tables Du f&amp;aring;r d&amp;aring; en rapport som ser ut s&amp;aring;h&amp;auml;r:&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=7b9af37b-edaa-4ab5-bc80-21f41c6e8357&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="600" /&gt;&lt;/p&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;Om du vill g&amp;ouml;ra detta lite mer automatiserat, och inte h&amp;ouml;gerklicka f&amp;ouml;r mycket, kan du givetvis skriva ihop ett script f&amp;ouml;r detta. Eller s&amp;aring; kan du k&amp;ouml;ra Profiler, och f&amp;aring;nga fr&amp;aring;gan som rapporten ovan k&amp;ouml;r, och anpassa den lite. D&amp;aring; kan du f&amp;aring; ut en kodsnutt som ser ut ungef&amp;auml;r som den nedan, som du sedan kan anpassa f&amp;ouml;r eget behov:&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;SELECT TOP 10 &amp;nbsp;&amp;nbsp;&amp;nbsp;(row_number() over(order by (a1.reserved + ISNULL(a4.reserved,0)) desc))%2 as l1, &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;&amp;nbsp;a3.name AS [schemaname], &amp;nbsp;&amp;nbsp;&amp;nbsp;a2.name AS [tablename], &amp;nbsp;&amp;nbsp;&amp;nbsp;a1.rows as row_count, &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;(a1.reserved + ISNULL(a4.reserved,0))* 8 AS reserved, &amp;nbsp;&amp;nbsp;&amp;nbsp;a1.data * 8 AS data, &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;&amp;nbsp;(CASE WHEN (a1.used + ISNULL(a4.used,0)) &amp;gt; a1.data &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;THEN (a1.used + ISNULL(a4.used,0)) - a1.data ELSE 0 END) * 8 AS index_size, &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;(&lt;/span&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;CASE WHEN (a1.reserved + ISNULL(a4.reserved,0)) &amp;gt; a1.used &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;THEN (a1.reserved + ISNULL(a4.reserved,0)) - a1.used &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;ELSE 0 END) * 8 AS unused &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;FROM &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;(SELECT &amp;nbsp;&amp;nbsp;&amp;nbsp;ps.object_id, &amp;nbsp;&amp;nbsp;&amp;nbsp;SUM ( &amp;nbsp;&amp;nbsp;&amp;nbsp;CASE &amp;nbsp;&amp;nbsp;&amp;nbsp;WHEN (ps.index_id &amp;lt; 2) THEN row_count &amp;nbsp;&amp;nbsp;&amp;nbsp;ELSE 0 &amp;nbsp;&amp;nbsp;&amp;nbsp;END &amp;nbsp;&amp;nbsp;&amp;nbsp;) AS [rows],&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;&amp;nbsp;SUM (ps.reserved_page_count) AS reserved, &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;SUM ( &amp;nbsp;&amp;nbsp;&amp;nbsp;CASE &amp;nbsp;&amp;nbsp;&amp;nbsp;WHEN (ps.index_id &amp;lt; 2) &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;THEN (ps.in_row_data_page_count + ps.lob_used_page_count + ps.row_overflow_used_page_count) &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;ELSE (ps.lob_used_page_count + ps.row_overflow_used_page_count) &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;END &amp;nbsp;&amp;nbsp;&amp;nbsp;) AS data, &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;SUM (ps.used_page_count) AS used &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;FROM sys.dm_db_partition_stats ps &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;GROUP BY ps.object_id) AS a1 &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;LEFT OUTER JOIN &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;&amp;nbsp;(SELECT &amp;nbsp;&amp;nbsp;&amp;nbsp;it.parent_id, &amp;nbsp;&amp;nbsp;&amp;nbsp;SUM(ps.reserved_page_count) AS reserved, &amp;nbsp;&amp;nbsp;&amp;nbsp;SUM(ps.used_page_count) AS used &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;&amp;nbsp;FROM sys.dm_db_partition_stats ps &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;INNER JOIN sys.internal_tables it ON (it.object_id = ps.object_id) &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;WHERE it.internal_type IN (202,204) &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;GROUP BY it.parent_id) AS a4 ON (a4.parent_id = a1.object_id) &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;INNER JOIN sys.all_objects a2&amp;nbsp; ON ( a1.object_id = a2.object_id ) &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;INNER JOIN sys.schemas a3 ON (a2.schema_id = a3.schema_id) &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;WHERE a2.type &amp;lt;&amp;gt; N'S' and a2.type &amp;lt;&amp;gt; N'IT'&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: arial,helvetica,sans-serif; font-size: small;"&gt;Till exempel kan informationen sparas till en tabell f&amp;ouml;r att kunna g&amp;aring; bak&amp;aring;t och titta p&amp;aring; historisk information, f&amp;ouml;r att kunna se trender.&lt;/span&gt;&lt;/pre&gt;</description><a10:updated>2012-10-09T16:13:12Z</a10:updated></item><item><guid isPermaLink="false">c4c24bd3-80a4-4749-831c-161f916d0382</guid><link>http://sqlservice.se/sv/start/blogg/vad-ar-pdw-.aspx?lang=sv</link><title>Vad är PDW ?</title><description>&lt;p&gt;Att PDW st&amp;aring;r f&amp;ouml;r Microsoft SQL Server Parallel Data Warehouse kanske m&amp;aring;nga vet redan. Vad det d&amp;auml;remot inneb&amp;auml;r kanske inte &amp;auml;r helt k&amp;auml;nt f&amp;ouml;r s&amp;aring; m&amp;aring;nga. H&amp;auml;r kommer d&amp;auml;rf&amp;ouml;r en l&amp;auml;nk d&amp;auml;r man kan l&amp;auml;ra sig mer om detta och ocks&amp;aring; SQL Server Data Warehousing och Big Data. Allting &amp;auml;r f&amp;ouml;rpackat i en serie om 4 korta videosnuttar som ni hittar &lt;a href="http://channel9.msdn.com/Series/SQLDWShorts"&gt;h&amp;auml;r&lt;/a&gt;.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-10-07T16:21:10Z</a10:updated></item><item><guid isPermaLink="false">f6eab302-bf23-44d0-a7ca-0ee3e52c7972</guid><link>http://sqlservice.se/sv/start/blogg/some-insights-to-the-transactionlog.aspx?lang=sv</link><title>Some insights to the transactionlog</title><description>&lt;p&gt;&lt;span style="font-size: x-small;"&gt;When managing your Microsoft SQL Server and its databases the transaction log is really important. If you fail set the log to appropriate size, and potential autogrowth to adecvate size you will jeopardize the integrity and function of the database. You need to have a view of how the log is constructed. On monday, if you're close by the Microsoft HQ in Kista I'm talking about the log, and some about the do's and don't's about the log.&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Alot of the demos will use DBCC LOGINFO(), an undocumented good dbcc feature that exposes great intel to the logfile. the transaction log file is just a wrapper for Virtual Log Files, VLFs. They are created based on a calculation of the size the log grows.&amp;nbsp;When the growth chunk is up to 64MB there are four (4)&amp;nbsp;VLFs, up to 1GB there are eight (8)&amp;nbsp;VLFs, and larger than 1GB there are sixteen (16)&amp;nbsp;VLFs. You want to have them tuned based on your database need.&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Another important thing that is worth mentioning is that the growth of the log cannot utilize the Instant File Initialization as the new chunk of the log must be zeroed out.&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;There is also a bug around log growth, if the chunk of growth are a multiple of 4GB (4096MB/4196304kB/4294967296B, the first autogrowth will fail and just create a small chunk, the second will work. 4000MB is a better choice than 4096MB or 4GB. This goes for 8GB, 12GB, 16GB and so on as well.&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;You must also remember that when the log grows all changes to the database is locked out as the file is being zeroed out. Test out the most optimal size based on your environment.&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;So, if you want some insight on your environment this script will get all user-databases and dump the info about the transaction logs into a table variable.&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt;USE master &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt;DECLARE @loginfo TABLE &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; ( &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; db sysname NULL, -- The name of the database &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; RecoverUnitId numeric(34,0), -- The Recover Unit ID &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; FileID numeric(34,0), -- The File ID of the transaction log &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; FileSize numeric(34,0), -- The size of the VLF &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; StartOffset numeric(34,0), -- Where in the log file is the VLF starting &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; FSeqNo numeric(34,0), -- Sequencial ID for the VLFs &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; Status numeric(34,0), -- 0 = not in use, 2 = contains transactions &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; Parity numeric(34,0), -- 0 = not in use, 64/128 = contains transactions/current transactions &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; CreateLSN numeric(34,0) -- The Log Sequence Number when the VLF was created &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; ) &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt;DECLARE &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; @db sysname, &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; @stmt nvarchar(max) = N'DBCC LOGINFO(''{db}'')', &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; @exec nvarchar(max) &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt;DECLARE loop CURSOR &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; FOR &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; SELECT name FROM sys.databases &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; WHERE name NOT IN ('master','msdb','tempdb','model') &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt;OPEN loop &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt;FETCH NEXT FROM loop INTO @db &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt;WHILE @@FETCH_STATUS = 0 &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; BEGIN &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; SET @exec = REPLACE(@stmt, N'{db}', @db) &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; INSERT INTO @loginfo&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; (&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; RecoverUnitId, &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; FileID, &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; FileSize, &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; StartOffset, &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; FSeqNo, &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; Status, &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; Parity, &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; CreateLSN &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt;) &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; EXEC(@exec) &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; UPDATE @loginfo &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; SET db = @db &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; WHERE db IS NULL &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; FETCH NEXT FROM loop INTO @db &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt; END &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt;CLOSE loop &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt;DEALLOCATE loop &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier; font-size: medium;"&gt;SELECT * FROM @loginfo ORDER BY db ASC, StartOffset ASC&lt;/span&gt;&lt;/pre&gt;</description><a10:updated>2012-10-05T17:45:37Z</a10:updated></item><item><guid isPermaLink="false">618e5e5d-f037-4e31-9ce6-f3b0221a80e7</guid><link>http://sqlservice.se/sv/start/blogg/how-to-get-cisco-vpn-to-work-on-windows-8.aspx?lang=sv</link><title>How to get Cisco VPN to work on Windows 8</title><description>&lt;p&gt;As a SQL server DBA consultant you once in while need to connect remote to your clients server and you can't choose the VPN software and have to use your clients solution. If you already have upgraded to Windows 8 and need to use Cisco VPN 5.0.7 you realize that the VPN client is not compatible with Windows 8.&lt;/p&gt;&#xD;
&lt;p&gt;Don't give up, there is a simple solution to this fix.&lt;/p&gt;&#xD;
&lt;ol&gt;&#xD;
&lt;li&gt;Open the regedit.exe&lt;/li&gt;&#xD;
&lt;li&gt;Browse the registry key&amp;nbsp;HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\CVirtA&lt;/li&gt;&#xD;
&lt;li&gt;Export the&amp;nbsp;original registry key&lt;/li&gt;&#xD;
&lt;li&gt;Change the value DisplayName to:&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;for x86 system: "Cisco Systems VPN Adapter&amp;rdquo;&lt;/li&gt;&#xD;
&lt;li&gt;for x64 system: "Cisco Systems VPN Adapter for 64-bit Windows&amp;rdquo;&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;/li&gt;&#xD;
&lt;li&gt;Close regedit&lt;/li&gt;&#xD;
&lt;li&gt;Try connect with VPN client&lt;/li&gt;&#xD;
&lt;/ol&gt;&#xD;
&lt;p&gt;If this doesn't work replace the setting to the original value with your exported registry key.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-10-02T07:16:19Z</a10:updated></item><item><guid isPermaLink="false">4da73b07-5816-4c95-8cff-40d0ac63fe42</guid><link>http://sqlservice.se/sv/start/blogg/veckans-fraga--vecka-39.aspx?lang=sv</link><title>Veckans fråga - vecka 39 </title><description>&lt;p&gt;Veckans fr&amp;aring;ga g&amp;aring;r till&lt;strong&gt; H&amp;aring;kan Winther&lt;/strong&gt; som har stor erfarenhet av fels&amp;ouml;kning och optimering i stora och komplexa milj&amp;ouml;er.&lt;/p&gt;&#xD;
&lt;p&gt;Finns det n&amp;aring;got &lt;strong&gt;verktyg f&amp;ouml;r SQL Server d&amp;auml;r man i efterhand kan kontrollera vilka queries som l&amp;aring;stes p&amp;aring; grund av andra queries&lt;/strong&gt;, kanske med hj&amp;auml;lp av en profilerdump eller ... ?.&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-09-27T14:14:45Z</a10:updated></item><item><guid isPermaLink="false">939f60a5-cfa4-4d9c-9e2e-ed8b9082686d</guid><link>http://sqlservice.se/sv/start/blogg/vad-ar-data-profile-viewer-.aspx?lang=sv</link><title>Vad är Data Profile Viewer ?</title><description>&lt;p&gt;Data Profile Viewer m&amp;aring;ste vara en av de mest dolda till&amp;auml;mpningarna som finns f&amp;ouml;r SQL Server. N&amp;aring;gon &amp;nbsp;kanske t&amp;auml;nker att det m&amp;aring;ste var en nyhet f&amp;ouml;r SQL Server 2012. S&amp;aring; &amp;auml;r det dock inte utan detta kom redan med SQL Server 2008.&lt;/p&gt;&#xD;
&lt;p&gt;Sk&amp;auml;len till anv&amp;auml;nda &lt;strong&gt;Data Profile Viewer&lt;/strong&gt; &amp;auml;r bl a dessa :&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;- Analysera k&amp;auml;lldatat mer effektivt&lt;/li&gt;&#xD;
&lt;li&gt;- F&amp;ouml;rst&amp;aring; k&amp;auml;lldatat b&amp;auml;ttre&lt;/li&gt;&#xD;
&lt;li&gt;- F&amp;ouml;rhinda datakvalitetsproblem f&amp;ouml;re de hamnar i ett datavaruhus&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;Nedan f&amp;ouml;ljer en kort demonstration av hur man anv&amp;auml;nder detta f&amp;ouml;rtr&amp;auml;ffliga program.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=6db7c4d0-52bd-4cba-abec-6b0e642f0f7d&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;F&amp;ouml;rsta steget man m&amp;aring;ste g&amp;ouml;ra &amp;auml;r att skapa ett SSIS paket. &amp;nbsp;D&amp;auml;refter anv&amp;auml;nder man objektet &lt;strong&gt;Data Profiling Task&lt;/strong&gt;.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=762820b1-a355-4a8d-bdd6-b007b6aa550e&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Det f&amp;ouml;rsta man g&amp;ouml;r att att skapa en destination f&amp;ouml;r filen som kommer skapas, en xml fil allts&amp;aring;.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;img src="../ci.axd?sid=710c4319-7016-4a1c-b7f3-9830a8e776b1&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;N&amp;auml;sta steg &amp;auml;r att v&amp;auml;lja k&amp;auml;llan som skall analyseras enligt n&amp;auml;sta bild, mha knappen Quick Profile. Jag v&amp;auml;ljer databasen AdventureWorks och alla tabeller. Detta g&amp;aring;r f&amp;ouml;rst&amp;aring;s bra att bara analysera enstaka tabeller ocks&amp;aring;. &amp;nbsp;Dessutom g&amp;aring;r det h&amp;auml;r att v&amp;auml;lja vilka analyser man vill g&amp;ouml;ra, men jag v&amp;auml;ljer standardvalen.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;img src="../ci.axd?sid=afe540d5-8897-45d3-8828-2381a9bc44f9&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;D&amp;auml;refter &amp;auml;r det bara starta SSIS paketet som vanligt och v&amp;auml;nta till allt &amp;auml;r klart.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=6f99c143-0174-49c7-9c1a-aaa33aa1430a&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Nu &amp;auml;r vi redo att presentera datat och en f&amp;ouml;rb&amp;auml;ttring som faktiskt kommit med SQL Server 2012 &amp;auml;r att man kan &amp;ouml;ppna objektet och sedan mha Open Profile Viewer g&amp;ouml;ra just detta, ... Det g&amp;aring;r ocks&amp;aring; bra att g&amp;ouml;ra som nedan&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;img src="../ci.axd?sid=4c256023-9baf-40a2-b081-565470601df4&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Efter att &amp;ouml;ppnat den skapade filen finns nu massor av intressant information. Nedan ser vi t.ex. max och min-l&amp;auml;ngder f&amp;ouml;r kolumnen Name och att UnitMeasureCode har 3 olika l&amp;auml;ngder med procentuell f&amp;ouml;rdelning mellan dessa.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;img src="../ci.axd?sid=f2387173-2675-408e-a049-feb2dd8e790c&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Bilden nedan visar de unika v&amp;auml;rden som finns och t.ex. f&amp;ouml;r kolumnen NameStyle s&amp;aring; finns det bara ett v&amp;auml;rde och dessa &amp;auml;r 19972 till antalet och vilka de &amp;auml;r ser man sedan p&amp;aring; den allra sista raden.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;img src="../ci.axd?sid=995bf295-b708-46c3-8e4c-534571f4406a&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Det var bara n&amp;aring;gra av de m&amp;ouml;jligheter som finns med detta program och en klar f&amp;ouml;rdel f&amp;ouml;r oss som t.ex.&amp;nbsp; skall migrera data eller utveckla datavaruhus. En klar f&amp;ouml;rdel &amp;auml;r ju ocks&amp;aring;&amp;nbsp; hur enkelt det &amp;auml;r att ta fram denna information samt att det ocks&amp;aring; ing&amp;aring;r i SQL Server sviten utan extra kostnad.&lt;/p&gt;</description><a10:updated>2012-09-26T20:53:01Z</a10:updated></item><item><guid isPermaLink="false">330383a3-2c45-4fea-9853-f8938773db81</guid><link>http://sqlservice.se/sv/start/blogg/varfor-tpce-.aspx?lang=sv</link><title>Varför TPC-E ?</title><description>&lt;p&gt;Om du &amp;auml;r intresserad av SQL Server prestanda, eller databas prestanda generellt, har du s&amp;auml;kert n&amp;aring;gon g&amp;aring;ng tittat in p&amp;aring; Transaction Processing Council's hemsida p&amp;aring; &lt;a href="http://www.tpc.org/"&gt;http://www.tpc.org/&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Det som &amp;auml;r anm&amp;auml;rkningsv&amp;auml;rt &amp;auml;r att om du tittar p&amp;aring; sidan med alla TPC-E resultat som n&amp;aring;gonsin publicerats &lt;a href="http://www.tpc.org/tpce/results/tpce_results.asp"&gt;http://www.tpc.org/tpce/results/tpce_results.asp&lt;/a&gt;&amp;nbsp;s&amp;aring; ser du att det finns m&amp;aring;nga olika Server HW leverant&amp;ouml;rer representerade, men bara en databashanterare, n&amp;auml;mligen &lt;a href="http://www.microsoft.com/sql"&gt;Microsoft SQL Server&lt;/a&gt;.&lt;/p&gt;&#xD;
&lt;p&gt;Det jag ville tipsa om denna g&amp;aring;ng, &amp;auml;r &lt;a href="http://blogs.technet.com/b/dataplatforminsider/archive/2012/08/28/tpc-e-raising-the-bar-in-oltp-performance.aspx"&gt;detta blogginl&amp;auml;gg&lt;/a&gt; fr&amp;aring;n Microsoft, som f&amp;ouml;rklarar hur de ser p&amp;aring; TPC-E och varf&amp;ouml;r de &amp;auml;r de enda som l&amp;auml;mnat in godk&amp;auml;nda och validerade reultat.&lt;/p&gt;&#xD;
&lt;p&gt;Trevlig l&amp;auml;sning!&lt;/p&gt;</description><a10:updated>2012-09-25T19:00:44Z</a10:updated></item><item><guid isPermaLink="false">95d15d01-8ed8-4c9d-8f67-b26dda693e6f</guid><link>http://sqlservice.se/sv/start/blogg/ssdt-in-visual-studio-2012-missing-ssis,-ssas-and-ssrs-tools.aspx?lang=sv</link><title>SSDT in Visual Studio 2012 missing SSIS, SSAS and SSRS tools</title><description>&lt;p&gt;Looking for SSIS and SSAS (and maybe even SSRS) tools on the new platform Visual Studio 2012?&lt;/p&gt;&#xD;
&lt;p&gt;I have, and cound not find them anywhere.&lt;/p&gt;&#xD;
&lt;p&gt;You are going to have to wait a bit longer, because these plug-ins have not yet been converted to the latest version of the platform. Keep an eye (e.g. RSS) on the following site for updates, they should not be long waiting for:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/ssdt/"&gt;http://blogs.msdn.com/b/ssdt/&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Meanwhile you can run the 2010 version of the tools in parallell with the 2012 installation.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Good Luck!&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;//Joakim&lt;/p&gt;</description><a10:updated>2012-09-24T08:34:34Z</a10:updated></item><item><guid isPermaLink="false">1935d45a-0b73-4e85-9066-922b8299abfb</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-2012-sp1-ctp4-ute.aspx?lang=sv</link><title>SQL Server 2012 SP1 CTP4 ute!</title><description>&lt;p&gt;F&amp;ouml;r Er alla beta-/CTP-/EAP-/... d&amp;auml;rute som gillar att testa nya verktyg, finns nu service pack 1 av SQL Server 2012 att tillg&amp;aring;:&lt;/p&gt;&#xD;
&lt;p&gt;Alla n&amp;ouml;dv&amp;auml;ndiga l&amp;auml;nkar finns &lt;a href="http://blogs.technet.com/b/dataplatforminsider/archive/2012/09/20/sql-server-2012-sp1-ctp4-now-available.aspx"&gt;h&amp;auml;r:&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Uttdrag fr&amp;aring;n MSDN artikeln:&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;The following highlights a few key enhancements in CTP4:&lt;/p&gt;&#xD;
&lt;p&gt;&amp;bull;A solution to migrate AlwaysOn Availability Group from a lower version of Windows Server cluster to a higher version of Windows Server cluster.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;bull;Selective XML Index which will improve querying performance over data stored as XML&lt;/p&gt;&#xD;
&lt;p&gt;&amp;bull;For SQL Server 2012 Express users, SQL Server 2012 SP1 Express Edition will ship the SQL Server Management Studio with functionality that existed with the SQL Server Management Studio from SQL Server premium editions&lt;/p&gt;</description><a10:updated>2012-09-21T12:42:25Z</a10:updated></item><item><guid isPermaLink="false">0c1a3524-bac5-4932-bebb-90c7b440f4a1</guid><link>http://sqlservice.se/sv/start/blogg/veckans-fraga-med-svar-vecka-38.aspx?lang=sv</link><title>Veckans fråga med svar vecka 38</title><description>&lt;p&gt;Veckans fr&amp;aring;ga g&amp;aring;r till &lt;strong&gt;Jan Nieminen&lt;/strong&gt; som har stor erfarenhet av olika driftsmilj&amp;ouml;er.&lt;/p&gt;&#xD;
&lt;p&gt;Vi ser nu att Red Gate lanserat ny version av sin programvara f&amp;ouml;r backup &amp;rdquo;&lt;strong&gt;SQL Backup Pro 7.2&lt;/strong&gt;&amp;rdquo;. Vad &amp;auml;r dina erfarenheter av denna eller liknande och &amp;auml;r det verkligen v&amp;auml;rt merkostnaden j&amp;auml;mf&amp;ouml;rt med att anv&amp;auml;nda SQL Servers egna backup/restore funktioner ?&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.red-gate.com/products/dba/sql-backup/?utm_source=simpletalk&amp;amp;utm_medium=email-main&amp;amp;utm_content=dbateam_7_2-20120917&amp;amp;utm_campaign=sqlbackup"&gt;http://www.red-gate.com/products/dba/sql-backup/?utm_source=simpletalk&amp;amp;utm_medium=email-main&amp;amp;utm_content=dbateam_7_2-20120917&amp;amp;utm_campaign=sqlbackup&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;Svar:&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-size: small;"&gt;Som alltid n&amp;auml;r man skall investera i till&amp;auml;ggsprodukter likt Red-Gate Backup PRO eller Quest LiteSpeed skall man vara&amp;nbsp; tydlig med nyttan av produkten. SQL Server har redan v&amp;auml;ldigt mycket av funktionaliteten som dessa produkter erbjuder inbyggt, kanske inte alltid lika flott presenterat men &amp;auml;ndock s&amp;aring; finns det d&amp;auml;r och man har redan betalat f&amp;ouml;r det.&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-size: small;"&gt;Backupkomprimering i samband med backuptagning var tidigare ett f&amp;ouml;rs&amp;auml;ljningsargument som man som kund l&amp;auml;tt kunde r&amp;auml;kna hem och gjorde produkterna prisv&amp;auml;rda men i och med att det finns inbyggt i SQL Server Standard Edition och upp&amp;aring;t from 2008R2 f&amp;aring;r man ist&amp;auml;llet fokusera p&amp;aring; andra f&amp;ouml;rdelar och funktioner. Detta har &amp;auml;ven mjukvarutillverkarna uppt&amp;auml;ckt eftersom de bygger in mer och mer funktionalitet i produkterna som kanske inte direkt har att g&amp;ouml;ra med just bara backup/restore.&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-size: small;"&gt;Nu menar jag inte att produkter som tex Red-Gate Backup PRO inte &amp;auml;r prisv&amp;auml;rda, det beror helt och h&amp;aring;llet p&amp;aring; vad man skall anv&amp;auml;nda dem till. Om man tittar lite n&amp;auml;rmare p&amp;aring; ovan n&amp;auml;mnda produkt s&amp;aring; hittar man en m&amp;auml;ngd bra och nyttiga funktioner som hj&amp;auml;lper en DBA att g&amp;ouml;ra r&amp;auml;tt, tex s&amp;aring; finns en funktion f&amp;ouml;r att testa sina backuper. Man kan helt enkelt s&amp;auml;tta upp jobb som flyttar en backup till annan server, g&amp;ouml;r restore, k&amp;ouml;r DBCC CHECKDB f&amp;ouml;r att verifiera att backupen inte &amp;auml;r korrupt. Att ta backup g&amp;ouml;r de flesta men att sedan testa sina backuper &amp;auml;r mer s&amp;auml;llsynt, alla kanske inte ens &amp;auml;r medvetna om att det &amp;auml;r en bra id&amp;eacute; att regelbundet testa sina backuper, men genom att funktionen finns d&amp;auml;r blir man som DBA p&amp;aring;mind om att backuper beh&amp;ouml;ver kontrolleras. D&amp;auml;rtill kan produkten &amp;auml;ven fungera som ett bra st&amp;ouml;d f&amp;ouml;r en mer oerfaren DBA.&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-size: small;"&gt;En nackdel, f&amp;ouml;rutom att det kostar pengar, &amp;auml;r att man f&amp;aring;r en produkt till att installera, underh&amp;aring;lla och uppgradera med allt vad det inneb&amp;auml;r. Om man har en stor milj&amp;ouml; med hundratals servrar kan en uppgradering ta mycket tid i anspr&amp;aring;k vilket jag sj&amp;auml;lv bevittnat p&amp;aring; n&amp;auml;ra h&amp;aring;ll. En annan nackdel &amp;auml;r att man blir beroende av ytterligare ett lager i mjukvarustacken. Personligen vill jag vid en krissituation ha s&amp;aring; kort v&amp;auml;g till restore som m&amp;ouml;jligt och vara beroende av s&amp;aring; f&amp;aring; komponenter som m&amp;ouml;jligt, enkelhet &amp;auml;r v&amp;auml;rt pengar den dag det &amp;auml;r skarpt l&amp;auml;ge.&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-size: small;"&gt;Nu kanske det verkar som att jag &amp;auml;r stark motst&amp;aring;ndare till produkter som dessa, det &amp;auml;r jag inte. Nyckeln ligger i vad produkten har f&amp;ouml;r merv&amp;auml;de ut&amp;ouml;ver det som redan finns i SQL Server och hur man v&amp;auml;rderar detta? Innan man sl&amp;aring;r till g&amp;ouml;r man klokt i att noggrant utv&amp;auml;rdera nyttan och f&amp;ouml;rs&amp;ouml;ka att s&amp;auml;tta en prislapp p&amp;aring; det samt fundera p&amp;aring; om man verkligen kommer att anv&amp;auml;nda alla funktioner och vad det d&amp;aring; inneb&amp;auml;r f&amp;ouml;r nyttan. Om man sedan &amp;auml;ven kommer fram till att vardagen kraftigt f&amp;ouml;renklas av att anv&amp;auml;nda sig av Backup PRO eller LiteSpeed &amp;auml;r det naturligtvis en viktig faktor, en n&amp;ouml;jd och glad DBA g&amp;aring;r inte att s&amp;auml;tta en prislapp p&amp;aring; :-)&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-size: small;"&gt;P&amp;aring; SQL Service jobbar vi med att hj&amp;auml;lpa kunder att utnyttja SQL Server till fullo, vi hj&amp;auml;lper g&amp;auml;rna till med att utv&amp;auml;rdera alla m&amp;ouml;jligheter som finns inbyggt och som man redan betalat licenspengar f&amp;ouml;r.&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-size: small;"&gt;/Janne&lt;/span&gt;&lt;/p&gt;</description><a10:updated>2012-09-21T06:49:50Z</a10:updated></item><item><guid isPermaLink="false">190c8a8c-0b31-4e00-b0ff-5befb2e86696</guid><link>http://sqlservice.se/sv/start/blogg/24-hours-of-pass.aspx?lang=sv</link><title>24 Hours Of PASS</title><description>&lt;p&gt;P&amp;aring; torsdag 20/9 &amp;auml;r det dags f&amp;ouml;r h&amp;ouml;stens "24 Hours Of PASS", 24 stycken sessioner under ett helt dygn. Detta inneb&amp;auml;r att vi f&amp;aring;r vi ett smakprov p&amp;aring; n&amp;aring;gra av sessionerna under kommande PASSSummit i Seattle i 5-9 november. F&amp;ouml;rst&amp;aring;s handlar det denna g&amp;aring;ng mycket om SQL Server 2012 och Azure, men &amp;auml;ven fels&amp;ouml;kning, exekveringsplaner och t.ex. "Choosing the Right Reporting Platform" som &amp;auml;r den f&amp;ouml;rsta sessionen man kan f&amp;ouml;lja under dessa 24 timmar.&lt;/p&gt;&#xD;
&lt;p&gt;Regstreringen g&amp;ouml;r man h&amp;auml;r:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.sqlpass.org/24hours/fall2012/SessionsbySchedule.aspx"&gt;http://www.sqlpass.org/24hours/fall2012/SessionsbySchedule.aspx&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-09-19T19:15:55Z</a10:updated></item><item><guid isPermaLink="false">99e113c0-afa2-492f-bc2d-f16c59a5679c</guid><link>http://sqlservice.se/sv/start/blogg/vad-ar-runas-radio-.aspx?lang=sv</link><title>Vad är RunAs Radio ?</title><description>&lt;p&gt;Detta &amp;auml;r en ganska ok&amp;auml;nd informationskanal som faktiskt inneh&amp;aring;ller r&amp;auml;tt m&amp;aring;nga bra godbitar om t.ex. SQL Server.&lt;/p&gt;&#xD;
&lt;p&gt;H&amp;auml;r &amp;auml;r n&amp;aring;gra av dem:&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;- &lt;a href="http://www.runasradio.com/default.aspx?showNum=256"&gt;Preps for SQL Server 2012 &lt;/a&gt;&lt;/li&gt;&#xD;
&lt;li&gt;- &lt;a href="http://www.runasradio.com/default.aspx?showNum=281"&gt;Saves Money on SQL Server Hardware &lt;/a&gt;&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;Hela inneh&amp;aring;llet inneh&amp;aring;llet hittar ni &lt;a href="http://www.runasradio.com/archives.aspx"&gt;h&amp;auml;r&lt;/a&gt;.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-09-19T19:13:29Z</a10:updated></item><item><guid isPermaLink="false">ad2a7afe-7735-433c-b3fb-0f416d65465d</guid><link>http://sqlservice.se/sv/start/blogg/keeping-track-of-replication-statistical-data-using-extended-events.aspx?lang=sv</link><title>Keeping track of Replication statistical data using Extended Events</title><description>&lt;p&gt;The other day I had reason to think about how to get more reliable statistics about the number of commands beeing replicated between SQL Servers. As you might know, Replication Monitor can give you information like that, but it is not very reliable, and also does not easily expose information that you can track, say in you favourite management or monitoring tool. So I came up with the idea to try to use Extended Events to collect that info, due to it's lightweight nature. Below here, you will find a script to set it up.&lt;/p&gt;&#xD;
&lt;p&gt;The idea is based on the fact that the replication subscription is run via an SQL Server Agent job, that is uniquely named based on Publisher server name, database name and subscription database name. And it is one job per article. Also, SQL Server replication uses stored procedures to insert, update or delete information in the destination (subscription ) database, and if you update 1000 rows&amp;nbsp;with one UPDATE command on you publication database, it will result in 1000 individual calls to the sp_MSIns_&amp;lt;tablename&amp;gt; stored procedure at the subscriber database.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;The script creates a table to store data, an Extended Events session to collect data, a stored procedure to move the data from the EE session to the table, and a stored procedure to return an integer that is the number of commands (rpc completed events) executetd by the SQL Server Agent job specified as a parameter to the get_repl_stats procedure.&lt;/p&gt;&#xD;
&lt;p&gt;The idea is that you would run this script on your destination (subscription) server once, then run the get_repl_stats proc every 5 minutes from you monitoring software, specifying the name of the job that you are interested in. Sounds confusing? Don't worry, I actually put some comments into the code ;-)&lt;/p&gt;&#xD;
&lt;p&gt;Enjoy!&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;-- Replication speed monitoring -- By: SQL Service, Steinar Andersen -- Created: 2012-09-18&lt;/p&gt;&#xD;
&lt;p&gt;-- Part 1: Create objects for data collection, in master database&lt;/p&gt;&#xD;
&lt;p&gt;-- Create Results table, wich will hold the data collected via Extended Events&lt;/p&gt;&#xD;
&lt;p&gt;USE [master]&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;IF EXISTS ( SELECT&amp;nbsp; * &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM&amp;nbsp;&amp;nbsp;&amp;nbsp; dbo.sysobjects &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE&amp;nbsp;&amp;nbsp; id = OBJECT_ID(N'[DF_repl_stats_history_last_updated]') &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;&amp;nbsp;&amp;nbsp; AND type = 'D' ) &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;BEGIN &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;ALTER TABLE [dbo].[repl_stats_history] DROP CONSTRAINT [DF_repl_stats_history_last_updated] &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;END&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;USE [master]&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;IF EXISTS ( SELECT&amp;nbsp; * &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.objects &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE&amp;nbsp;&amp;nbsp; object_id = OBJECT_ID(N'[dbo].[repl_stats_history]') &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;&amp;nbsp;&amp;nbsp; AND type IN ( N'U' ) ) &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;DROP TABLE [dbo].[repl_stats_history]&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;USE [master]&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;CREATE TABLE [dbo].[repl_stats_history] &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;( &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [JobName] [varchar](150) NULL , &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[EventCount] [int] NULL , &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[EventsTrunc] [int] NULL , &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;[last_updated] [datetime] NULL &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;)&lt;/p&gt;&#xD;
&lt;p&gt;ON&amp;nbsp; [PRIMARY]&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;ALTER TABLE [dbo].[repl_stats_history]&lt;/p&gt;&#xD;
&lt;p&gt;ADD&amp;nbsp; CONSTRAINT [DF_repl_stats_history_last_updated]&amp;nbsp; DEFAULT (GETDATE()) FOR [last_updated]&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;USE [master]&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;IF EXISTS ( SELECT&amp;nbsp; * &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.indexes &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHERE&amp;nbsp;&amp;nbsp; object_id = OBJECT_ID(N'[dbo].[repl_stats_history]') &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;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;AND name = N'Idx_Last_Updated' ) &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;DROP INDEX [Idx_Last_Updated] ON [dbo].[repl_stats_history] WITH ( ONLINE = OFF ) GO&lt;/p&gt;&#xD;
&lt;p&gt;USE [master]&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;CREATE CLUSTERED INDEX [Idx_Last_Updated] ON [dbo].[repl_stats_history]&lt;/p&gt;&#xD;
&lt;p&gt;( [last_updated] ASC, [JobName] ASC )&lt;/p&gt;&#xD;
&lt;p&gt;WITH (PAD_INDEX&amp;nbsp; = OFF, STATISTICS_NORECOMPUTE&amp;nbsp; = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF,&lt;/p&gt;&#xD;
&lt;p&gt;DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS&amp;nbsp; = ON, ALLOW_PAGE_LOCKS&amp;nbsp; = ON, FILLFACTOR = 90) ON [PRIMARY]&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;GO&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;-- Create an Event Session to Track RPC Completed per Client App Name&lt;/p&gt;&#xD;
&lt;p&gt;IF EXISTS ( SELECT&amp;nbsp; * &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.server_event_sessions &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE&amp;nbsp;&amp;nbsp; name = 'Repl_Stats' ) &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;DROP EVENT SESSION [Repl_Stats] ON SERVER;&lt;/p&gt;&#xD;
&lt;p&gt;CREATE EVENT SESSION [Repl_Stats] ON SERVER&lt;/p&gt;&#xD;
&lt;p&gt;ADD EVENT sqlserver. rpc_completed -- Count RPC Completed, as Replication uses Stored Procedures to make changes at the Subscriber. One SP will be fired per row changed, so the count of SP's run will equal number of rows impacted &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;( ACTION ( sqlserver. client_app_name )&lt;/p&gt;&#xD;
&lt;p&gt;--WHERE (sqlserver.client_app_name = 'Microsoft SQL Server Management Studio - Query')&lt;/p&gt;&#xD;
&lt;p&gt;--The Client Application name or names that you want to monitor. Replication will use one SQL Serve Agent Job for each replication article subscription. The Client App Name here is obviously just an example. )&lt;/p&gt;&#xD;
&lt;p&gt;ADD TARGET package0. asynchronous_bucketizer --Target=Bucket, as we only want to store the number of times the event is fired &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;( SET source_type=1, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; source='sqlserver.client_app_name' --Group events fired by Client App Name )&lt;/p&gt;&#xD;
&lt;p&gt;WITH ( MAX_DISPATCH_LATENCY = 5 SECONDS )&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;-- Create proc to save stats and recycle counter.&lt;/p&gt;&#xD;
&lt;p&gt;IF EXISTS ( SELECT&amp;nbsp; * &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.objects &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHERE&amp;nbsp;&amp;nbsp; object_id = OBJECT_ID(N'[dbo].[save_repl_stats]') &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;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;AND type IN ( N'P' ) ) &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;DROP PROC [dbo].[save_repl_stats]&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;CREATE PROC dbo.save_repl_stats&lt;/p&gt;&#xD;
&lt;p&gt;AS &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;BEGIN &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;SET ANSI_PADDING ON &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;INSERT&amp;nbsp; INTO master.dbo.repl_stats_history &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;/p&gt;&#xD;
&lt;p&gt;( JobName , &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;/p&gt;&#xD;
&lt;p&gt;EventCount , &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;/p&gt;&#xD;
&lt;p&gt;EventsTrunc &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; ) --Insert data into history table &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;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;SELECT&amp;nbsp; ( n.value('(value)[1]', 'varchar(max)') ) AS JobName ,&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;n.value('(@count)[1]', 'int') AS EventCount ,&lt;/p&gt;&#xD;
&lt;p&gt;n.value('(@trunc)[1]', 'int') AS EventsTrunc&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;FROM&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;( SELECT&amp;nbsp;&amp;nbsp;&amp;nbsp; CAST(target_data AS XML) target_data&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;FROM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.dm_xe_sessions AS s&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;JOIN sys.dm_xe_session_targets t ON s.address = t.event_session_address&lt;/p&gt;&#xD;
&lt;p&gt;WHERE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s.name = 'Repl_Stats'&lt;/p&gt;&#xD;
&lt;p&gt;AND t.target_name = 'asynchronous_bucketizer'&amp;nbsp; )&lt;/p&gt;&#xD;
&lt;p&gt;AS tab &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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;CROSS APPLY target_data.nodes('BucketizerTarget/Slot') AS q ( n )&lt;/p&gt;&#xD;
&lt;p&gt;ALTER EVENT SESSION [Repl_Stats] -- Stop EE session to zero out the values &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;ON SERVER &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;STATE=STOP&lt;/p&gt;&#xD;
&lt;p&gt;ALTER EVENT SESSION [Repl_Stats] -- Start EE session to start collecting values again &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;ON SERVER &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;STATE=START&lt;/p&gt;&#xD;
&lt;p&gt;END&lt;/p&gt;&#xD;
&lt;p&gt;go&lt;/p&gt;&#xD;
&lt;p&gt;-- Schedule data collection proc as job to run every 5 minutes. -- This job will fail the first time only, because the EE session is not started. Pay no attention to that! ;-)&lt;/p&gt;&#xD;
&lt;p&gt;USE [msdb]&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;IF EXISTS ( SELECT&amp;nbsp; job_id &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM&amp;nbsp;&amp;nbsp;&amp;nbsp; msdb.dbo.sysjobs_view &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE&amp;nbsp;&amp;nbsp; name = N'Collect Replication Statistics' ) &amp;nbsp;&amp;nbsp;&amp;nbsp; EXEC msdb.dbo.sp_delete_job @job_id = N'9f703264-a99b-4285-9688-856a3031baf1', &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @delete_unused_schedule = 1 GO&lt;/p&gt;&#xD;
&lt;p&gt;USE [msdb]&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;BEGIN TRANSACTION DECLARE @ReturnCode INT SELECT&amp;nbsp; @ReturnCode = 0&lt;/p&gt;&#xD;
&lt;p&gt;DECLARE @jobId BINARY(16) EXEC @ReturnCode = msdb.dbo.sp_add_job @job_name = N'Collect Replication Statistics', &amp;nbsp;&amp;nbsp;&amp;nbsp; @enabled = 1, @notify_level_eventlog = 0, @notify_level_email = 0, &amp;nbsp;&amp;nbsp;&amp;nbsp; @notify_level_netsend = 0, @notify_level_page = 0, @delete_level = 0, &amp;nbsp;&amp;nbsp;&amp;nbsp; @description = N'Uses Extended events to collect SQL Server Replication Statistics every 5 minutes&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;&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;&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;&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;&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; Usage: exec master.dbo.get_repl_stats ''&amp;lt;jobname&amp;gt;''', &amp;nbsp;&amp;nbsp;&amp;nbsp; @category_name = N'[Uncategorized (Local)]', @owner_login_name = N'sa', &amp;nbsp;&amp;nbsp;&amp;nbsp; @job_id = @jobId OUTPUT IF ( @@ERROR &amp;lt;&amp;gt; 0 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR @ReturnCode &amp;lt;&amp;gt; 0 &amp;nbsp;&amp;nbsp; ) &amp;nbsp;&amp;nbsp;&amp;nbsp; GOTO QuitWithRollback&lt;/p&gt;&#xD;
&lt;p&gt;EXEC @ReturnCode = msdb.dbo.sp_add_jobstep @job_id = @jobId, &amp;nbsp;&amp;nbsp;&amp;nbsp; @step_name = N'Save Replication Statistics', @step_id = 1, &amp;nbsp;&amp;nbsp;&amp;nbsp; @cmdexec_success_code = 0, @on_success_action = 1, @on_success_step_id = 0, &amp;nbsp;&amp;nbsp;&amp;nbsp; @on_fail_action = 2, @on_fail_step_id = 0, @retry_attempts = 0, &amp;nbsp;&amp;nbsp;&amp;nbsp; @retry_interval = 0, @os_run_priority = 0, @subsystem = N'TSQL', &amp;nbsp;&amp;nbsp;&amp;nbsp; @command = N'exec dbo.save_repl_stats', @database_name = N'master', &amp;nbsp;&amp;nbsp;&amp;nbsp; @flags = 0 IF ( @@ERROR &amp;lt;&amp;gt; 0 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR @ReturnCode &amp;lt;&amp;gt; 0 &amp;nbsp;&amp;nbsp; ) &amp;nbsp;&amp;nbsp;&amp;nbsp; GOTO QuitWithRollback EXEC @ReturnCode = msdb.dbo.sp_update_job @job_id = @jobId, @start_step_id = 1 IF ( @@ERROR &amp;lt;&amp;gt; 0 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR @ReturnCode &amp;lt;&amp;gt; 0 &amp;nbsp;&amp;nbsp; ) &amp;nbsp;&amp;nbsp;&amp;nbsp; GOTO QuitWithRollback EXEC @ReturnCode = msdb.dbo.sp_add_jobschedule @job_id = @jobId, &amp;nbsp;&amp;nbsp;&amp;nbsp; @name = N'Repl_Stats', @enabled = 1, @freq_type = 4, @freq_interval = 1, &amp;nbsp;&amp;nbsp;&amp;nbsp; @freq_subday_type = 4, @freq_subday_interval = 5, &amp;nbsp;&amp;nbsp;&amp;nbsp; @freq_relative_interval = 0, @freq_recurrence_factor = 0, &amp;nbsp;&amp;nbsp;&amp;nbsp; @active_start_date = 20120917, @active_end_date = 99991231, &amp;nbsp;&amp;nbsp;&amp;nbsp; @active_start_time = 0, @active_end_time = 235959, &amp;nbsp;&amp;nbsp;&amp;nbsp; @schedule_uid = N'90561def-ba8e-4339-b5f4-8cbf605408b1' IF ( @@ERROR &amp;lt;&amp;gt; 0 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR @ReturnCode &amp;lt;&amp;gt; 0 &amp;nbsp;&amp;nbsp; ) &amp;nbsp;&amp;nbsp;&amp;nbsp; GOTO QuitWithRollback EXEC @ReturnCode = msdb.dbo.sp_add_jobserver @job_id = @jobId, &amp;nbsp;&amp;nbsp;&amp;nbsp; @server_name = N'(local)' IF ( @@ERROR &amp;lt;&amp;gt; 0 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR @ReturnCode &amp;lt;&amp;gt; 0 &amp;nbsp;&amp;nbsp; ) &amp;nbsp;&amp;nbsp;&amp;nbsp; GOTO QuitWithRollback COMMIT TRANSACTION GOTO EndSave QuitWithRollback: IF ( @@TRANCOUNT &amp;gt; 0 ) &amp;nbsp;&amp;nbsp;&amp;nbsp; ROLLBACK TRANSACTION EndSave:&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;-- Part 2: Create objects to retrive data USE [master]&lt;/p&gt;&#xD;
&lt;p&gt;-- Create proc to get repl stats data -- Usage: exec master.dbo.get_repl_stats '&amp;lt;jobname&amp;gt;'&lt;/p&gt;&#xD;
&lt;p&gt;IF EXISTS&lt;/p&gt;&#xD;
&lt;p&gt;( SELECT&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;FROM&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.objects &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHERE&amp;nbsp;&amp;nbsp; object_id = OBJECT_ID(N'[dbo].[get_repl_stats]') &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;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;AND type IN ( N'P' ) ) &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;DROP PROC [dbo].[get_repl_stats]&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;CREATE PROC dbo.get_repl_stats @jobname VARCHAR(150)&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;AS &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;BEGIN &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;SELECT TOP 1&amp;nbsp;&amp;nbsp;&amp;nbsp;ISNULL(eventcount, 0) AS ReturnValue &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;FROM&amp;nbsp;&amp;nbsp;&amp;nbsp; master.[dbo].[repl_stats_history] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHERE&amp;nbsp;&amp;nbsp; JobName = @jobname &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;/p&gt;&#xD;
&lt;p&gt;AND last_updated &amp;gt; DATEADD(minute, -5, GETDATE()) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;ORDER BY last_updated DESC &amp;nbsp;&amp;nbsp;&amp;nbsp; END&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;--The End!&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;(CREDIT: I stole some code/ideas from &lt;a href="http://sqlskills.com/blogs/jonathan/"&gt;Jonathan Kehiyas&lt;/a&gt; &lt;a href="http://sqlskills.com/blogs/jonathan/post/Tracking-Extended-Events-for-a-SQL-Agent-Job.aspx"&gt;blogpost&lt;/a&gt; while creating this!)&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-09-18T19:38:26Z</a10:updated></item><item><guid isPermaLink="false">b613ee62-6770-41d3-b257-9b89c1762e13</guid><link>http://sqlservice.se/sv/start/blogg/gastblogg-hur-far-du-till-de-dar-nyheterna-pa-ms-bi-plattan.aspx?lang=sv</link><title>Gästblogg: Hur får du till de där nyheterna på MS BI plattan?</title><description>&lt;p&gt;Du gick p&amp;aring; ett f&amp;ouml;rkl&amp;auml;tt s&amp;auml;ljm&amp;ouml;te i form av en session fr&amp;aring;n en slipad Powerpoint konsult f&amp;ouml;r att f&amp;aring; se nyheterna i BI-plattformen. Sharepoint+PowerPivot+PowerView+Excel Services+PerformancePoint+SQL 2012 tabular model och SQL 2012 engine. Allt &amp;auml;r sproilans, g&amp;auml;rna beta och riktigt fancy-schmanzy och du ser m&amp;ouml;jligheter. L&amp;ouml;sningen som ska befria dina anv&amp;auml;ndare och f&amp;aring; sanden att bli guld.&lt;/p&gt;&#xD;
&lt;p&gt;S&amp;aring; du har f&amp;aring;tt 2 dagar av kunden f&amp;ouml;r att installera Sharepoint 2010 SP1, p&amp;aring; en 2 server-farm med Web p&amp;aring; ena och SQL 2012 p&amp;aring; den andra. OK. Det &amp;auml;r lite trickigt. Kan g&amp;aring;. &amp;Auml;ven om du inte sett Sharepoint tidigare, s&amp;aring; f&amp;aring;r du ta hj&amp;auml;lp av en konsultfirma att kapa lite av tiden genom att h&amp;aring;lla i handen. De har stor erfarenhet av sharepoint. Men inte BI och inte p&amp;aring; SQL 2012. Och du l&amp;auml;ser p&amp;aring; prerequisites f&amp;ouml;rst och best&amp;auml;ller konton och servrar, AD-r&amp;auml;ttigheter och s&amp;aring;nt i god tid innan s&amp;aring; kanske &amp;auml;nd&amp;aring;?&lt;/p&gt;&#xD;
&lt;p&gt;Skulle du k&amp;ouml;ra under de f&amp;ouml;ruts&amp;auml;ttningarna? Tja, hur ska du annars f&amp;aring; jobba med de d&amp;auml;r roliga nya verktygen. S&amp;aring; du k&amp;ouml;r!&lt;/p&gt;&#xD;
&lt;p&gt;De h&amp;auml;r enades konsulten och jag om:&lt;/p&gt;&#xD;
&lt;ol&gt;&#xD;
&lt;li&gt;1. H&amp;aring;rdvara och mjukvara&lt;/li&gt;&#xD;
&lt;li&gt;2. Installationsmedia med Product Key&lt;/li&gt;&#xD;
&lt;li&gt;3. Lista p&amp;aring; Services&amp;nbsp;som ska installeras&lt;/li&gt;&#xD;
&lt;li&gt;4. Dom&amp;auml;nkonton f&amp;ouml;r&amp;nbsp;SharePoint och SQL (vi valde att ha 12 st systemkonton)&lt;/li&gt;&#xD;
&lt;li&gt;5. Personer och resurser&lt;/li&gt;&#xD;
&lt;li&gt;6. Internetanslutning f&amp;ouml;r konsultens PC&lt;/li&gt;&#xD;
&lt;li&gt;7. Installationsguide&lt;/li&gt;&#xD;
&lt;/ol&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Och letar r&amp;auml;tt p&amp;aring; ett par stycken installationsguider p&amp;aring; n&amp;auml;tet (officiella och blog-varianter) och mergar ihop till en ungef&amp;auml;rlig plan som passar dina parametrar av topologi,arkitektur, servermilj&amp;ouml;, f&amp;ouml;rkunskaper, slutanv&amp;auml;ndarbehov, driftbarhet, f&amp;ouml;r&amp;auml;ndringsbarhet osv.&lt;/p&gt;&#xD;
&lt;p&gt;Sen ska du dessutom l&amp;auml;gga p&amp;aring; Business Intelligence komponenterna. Ok. Nu vet du att du beh&amp;ouml;ver &amp;auml;ska mer timmar. Men kommer inte f&amp;aring; n&amp;aring;gra. S&amp;aring; du k&amp;ouml;r.&lt;/p&gt;&#xD;
&lt;p&gt;Nu har SQL 2012 funnits ute ett tag. F&amp;ouml;reg&amp;aring;ngen av l&amp;aring;nga alfa, beta perioder med Denali och saker som hyfsat fungerar ihop. Men inget servicepack har kommit &amp;auml;nnu. Och Microsofts dokumentation f&amp;aring;r betraktas som beta tills tillr&amp;auml;ckligt m&amp;aring;nga k&amp;ouml;rt skarpt ett tag. Bered dig p&amp;aring; en ordentligt skumpig resa.&lt;/p&gt;&#xD;
&lt;p&gt;Hos oss b&amp;ouml;rjade det med alias f&amp;ouml;r sql burken. Vi ville ha sharepoint webbservern skyddad mot framtida migreringar av SQL instanser s&amp;aring; vi letade information om Alias och hur man s&amp;auml;tter det i SQL Configuration Manager p&amp;aring; web-serverns sql klient. Googlande gav resultat. D&amp;auml;remot stod det inte p&amp;aring; samma st&amp;auml;lle om att eftersom Management Studio &amp;auml;r en x86 applikation s&amp;aring; kan du inte l&amp;auml;gga upp alias under vanliga SQL Native Client 11.0 Configuration utan under SQL Native Client 11.0 Configuration (32bit). D&amp;auml;r gick 1,5 timmar av fels&amp;ouml;kanden, googlande, &amp;auml;ndra, testa, googla mer, &amp;auml;ndra testa osv. &amp;Auml;ra den som &amp;auml;ras b&amp;ouml;r:&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;a href="http://www.mssqltips.com/sqlservertip/1620/how-to-setup-and-use-a-sql-server-alias/"&gt;http://www.mssqltips.com/sqlservertip/1620/how-to-setup-and-use-a-sql-server-alias/&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;V&amp;aring;r driftsleverant&amp;ouml;r gav oss en f&amp;auml;rdig SQL setup p&amp;aring; SQL servern &amp;ndash; med ett lokalt konto som k&amp;ouml;r tj&amp;auml;nsterna. S&amp;aring; d&amp;auml;r slapp vi undan. Men &amp;nbsp;jag undrar om jag inte f&amp;ouml;redragit att k&amp;ouml;ra den sj&amp;auml;lv s&amp;aring; man vet vad som &amp;auml;r gjort&amp;hellip; :-)&lt;/p&gt;&#xD;
&lt;p&gt;Dags att installera Sharepoint 2010 och SP1. F&amp;ouml;red&amp;ouml;mligt nog fanns en kombinerad setup + sp1 att tanka ner fr&amp;aring;n Microsoft Volume Licences. Den h&amp;auml;r installationsplanen hade vi i grova drag n&amp;auml;r vi b&amp;ouml;rjade, n&amp;aring;gra punkter &amp;auml;r redigerade/borttagna f&amp;ouml;r att &amp;rdquo;skydda oskyldiga&amp;rdquo;. PowerPivot, RS och PowerView v&amp;auml;ntade vi dock med till senare n&amp;auml;r vi v&amp;auml;l kom dit.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;ol&gt;&#xD;
&lt;li&gt;1. Starta Splash-filen i foldern d&amp;auml;r installationsfilerna ligger.&lt;/li&gt;&#xD;
&lt;li&gt;2. V&amp;auml;lj &lt;strong&gt;Install software Prerequisites&lt;/strong&gt;.&lt;/li&gt;&#xD;
&lt;li&gt;3. V&amp;auml;lj &lt;strong&gt;Install SharePoint Server&lt;/strong&gt;.&lt;/li&gt;&#xD;
&lt;li&gt;4. Ange Product Key.&lt;/li&gt;&#xD;
&lt;li&gt;5, V&amp;auml;lj att installera &lt;strong&gt;Server Farm&lt;/strong&gt;.&lt;/li&gt;&#xD;
&lt;li&gt;6. V&amp;auml;lj Server Type &lt;strong&gt;Complete&lt;/strong&gt;.&lt;/li&gt;&#xD;
&lt;li&gt;7. V&amp;auml;lj var installationsfilerna ska ligga i &lt;strong&gt;File Location&lt;/strong&gt;.&lt;/li&gt;&#xD;
&lt;li&gt;8. Checka i &lt;strong&gt;Run Configuration Wizard&lt;/strong&gt; och klicka p&amp;aring; Close.&lt;/li&gt;&#xD;
&lt;li&gt;9. N&amp;auml;r den startat klicka p&amp;aring; &lt;strong&gt;Next&lt;/strong&gt; och svara &lt;strong&gt;Yes&lt;/strong&gt;.&lt;/li&gt;&#xD;
&lt;li&gt;10. V&amp;auml;lj &lt;strong&gt;Create a new server farm&lt;/strong&gt;.&lt;/li&gt;&#xD;
&lt;li&gt;11. Ange &lt;strong&gt;Database server&lt;/strong&gt;: mindom&amp;auml;n\minserveralias (Ett sql-alias b&amp;ouml;r anv&amp;auml;ndas h&amp;auml;r)&lt;/li&gt;&#xD;
&lt;li&gt;12. Ange &lt;strong&gt;Database Name&lt;/strong&gt;: Min_SharePoint_Config_DB&lt;/li&gt;&#xD;
&lt;li&gt;13. Ange ett konto f&amp;ouml;r &lt;strong&gt;Database Access&lt;/strong&gt;: Mitt_konto&lt;/li&gt;&#xD;
&lt;li&gt;14. Skriv in en &lt;strong&gt;Passphrase&lt;/strong&gt; och konfirmera den: anv&amp;auml;nd ett komplext l&amp;ouml;senord. Passphrase f&amp;ouml;r att kunna l&amp;auml;gga till servrar i sharepoint-farmen senare.&lt;/li&gt;&#xD;
&lt;li&gt;15. Fyll i &lt;strong&gt;Specify a port number&lt;/strong&gt;: t ex 8080&lt;/li&gt;&#xD;
&lt;li&gt;16. V&amp;auml;lj NTLM eller Negotiate (Kerberos). Kan &amp;auml;ndras senare.&lt;/li&gt;&#xD;
&lt;li&gt;17. Klicka Next och den k&amp;ouml;r 10 steg.&lt;/li&gt;&#xD;
&lt;li&gt;18. Central Administration startar med Configure your SharePoint farm.&lt;/li&gt;&#xD;
&lt;li&gt;19. Innan wizarden startas s&amp;aring; ska Managed Accounts skapas.&lt;/li&gt;&#xD;
&lt;li&gt;20. I SharePoint Central Administration, v&amp;auml;lj &lt;strong&gt;Security&lt;/strong&gt;.&lt;/li&gt;&#xD;
&lt;li&gt;21.&amp;nbsp;V&amp;auml;lj &lt;strong&gt;Configure managed accounts&lt;/strong&gt;.&lt;/li&gt;&#xD;
&lt;li&gt;22. V&amp;auml;lj &lt;strong&gt;Register Managed Account&lt;/strong&gt; och skapa ett managed account f&amp;ouml;r varje service account. S&amp;aring; kan man v&amp;auml;lja konton I listboxar I sharepoint vid senare referenser, smutt!&lt;/li&gt;&#xD;
&lt;li&gt;23. Installera f&amp;ouml;ljande BI Services (gjorde vi allts&amp;aring; senare iofs):&lt;/li&gt;&#xD;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;23.1.PowerPivot 2012&lt;/li&gt;&#xD;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;23.2.Reporting Services &amp;ndash; SSRS 2012&lt;/li&gt;&#xD;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;23.3.PowerView for SP 2010&lt;/li&gt;&#xD;
&lt;li&gt;24. Starta Farm Configuration Wizard och checka av de services som ska ha egna accounts:&lt;/li&gt;&#xD;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;24.1.Excel Services Application&lt;/li&gt;&#xD;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;24.2.PerformancePoint Service Application&lt;/li&gt;&#xD;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;24.3.User Profile Service Application&lt;/li&gt;&#xD;
&lt;li&gt;25. Ange SP_ServiceApps f&amp;ouml;r de services som wizarden ska konfigurera.&lt;/li&gt;&#xD;
&lt;li&gt;26. G&amp;aring; till Manage Service Applications och v&amp;auml;lj Create New och ange namn p&amp;aring; App Pool och konto:&lt;/li&gt;&#xD;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 26.1.Excel Services Application &amp;ndash; SP_Excel&lt;/li&gt;&#xD;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 26.2.PerformancePoint Service Application &amp;ndash; SP_PerfPoint&lt;/li&gt;&#xD;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 26.3.PowerPivot 2012 &amp;ndash; SP_PowerPivot&lt;/li&gt;&#xD;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;26.4.Reporting Services &amp;ndash; SSRS 2012 &amp;ndash; SP_PerfPoint&lt;/li&gt;&#xD;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 26.5.PowerView for SP 2010 &amp;ndash; SP_PowerPivot&lt;/li&gt;&#xD;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;26.6.User Profile Service Application &amp;ndash; SP_Farm&lt;/li&gt;&#xD;
&lt;li&gt;27. Skapa en Web Site Collection f&amp;ouml;r verifiering&lt;/li&gt;&#xD;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 27.1.V&amp;auml;lj &lt;strong&gt;Classic Mode Authentication &lt;/strong&gt;och&lt;strong&gt; NTLM&lt;/strong&gt;&lt;/li&gt;&#xD;
&lt;li&gt;28 Skapa en Site Collection f&amp;ouml;r verifiering&lt;/li&gt;&#xD;
&lt;/ol&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;D&amp;auml;r b&amp;ouml;rjade n&amp;auml;sta &amp;ouml;verraskande &amp;rdquo;task&amp;rdquo;&amp;ndash; visar sig att Sharepoint har ytterligare prerequisites f&amp;ouml;r mjukvara, &amp;nbsp;som den sj&amp;auml;lv f&amp;ouml;rs&amp;ouml;ker tanka ner fr&amp;aring;n n&amp;auml;tet. Sitter s&amp;aring; klart p&amp;aring; en server utan internet koppling J. Blir till att k&amp;ouml;ra, f&amp;aring; felmeddelande, s&amp;ouml;k media, ladda ner, packa upp, k&amp;ouml;r setup, &amp;rdquo;RETRY&amp;rdquo; p&amp;aring; sharepointen ett g&amp;auml;ng varv f&amp;ouml;r&amp;rdquo;Microsoft Chart Controls for .Net 3.5&amp;rdquo;, &amp;rdquo;Microsoft Server Speech Platform Runtime (x64)&amp;rdquo;, &amp;rdquo;Microsoft Sync Framework Runtime v1 (x64)&amp;rdquo;, &amp;rdquo;Microsoft SQL Server Analysis Services ADOMD.NET&amp;rdquo; (feature pack, men du m&amp;aring;ste hitta r&amp;auml;tt version ocks&amp;aring;, den med &amp;rdquo;content created&amp;rdquo; 4/2/2009 8:08 AM fungerade f&amp;ouml;r oss), &amp;rdquo;Microsoft SQL Server 2008 Native Client&amp;rdquo;, &amp;rdquo;Windows&amp;nbsp; Identity Foundation KB974405&amp;rdquo;, &amp;rdquo; Microsoft SQL 2008 R2 Reporting Services SharePoint 2010 Add-in&amp;rdquo;, &amp;rdquo;Microsoft Filter Pack 2.0&amp;rdquo;.&lt;/p&gt;&#xD;
&lt;p&gt;Efter ett tag hittade vi var man skulle plocka ihop dem, i ett powershell skript som Brian Lalancette @brianlala gjort, tack f&amp;ouml;r den!:&lt;/p&gt;&#xD;
&lt;p&gt;$UrlList = ("http://download.microsoft.com/download/C/9/F/C9F6B386-824B-4F9E-BD5D-F95BB254EC61/Redist/amd64/Microsoft%20Sync%20Framework/Synchronization.msi", # http://go.microsoft.com/fwlink/?LinkID=141237&amp;amp;clcid=0x409 - Microsoft Sync Framework Runtime v1.0 (x64)&lt;/p&gt;&#xD;
&lt;p&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;&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;&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;&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;&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;&amp;nbsp; "http://download.microsoft.com/download/c/c/4/cc4dcac6-ea60-4868-a8e0-62a8510aa747/MSChart.exe", # "http://go.microsoft.com/fwlink/?LinkID=141512" - Microsoft Chart Controls for the Microsoft .NET Framework 3.5&lt;/p&gt;&#xD;
&lt;p&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;&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;&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;&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;&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;&amp;nbsp; "http://download.microsoft.com/download/2/0/e/20e90413-712f-438c-988e-fdaa79a8ac3d/dotnetfx35.exe", # http://go.microsoft.com/fwlink/?LinkId=131037 - Microsoft .NET Framework 3.5 Service Pack 1&lt;/p&gt;&#xD;
&lt;p&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;&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;&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;&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;&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;&amp;nbsp; "http://download.microsoft.com/download/2/8/6/28686477-3242-4E96-9009-30B16BED89AF/Windows6.0-KB968930-x64.msu", # "http://download.microsoft.com/download/2/8/6/28686477-3242-4E96-9009-30B16BED89AF/Windows6.0-KB968930-x64.msu" - Windows PowerShell 2.0&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&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;&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;&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;&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;&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;&amp;nbsp; "http://download.microsoft.com/download/D/7/2/D72FD747-69B6-40B7-875B-C2B40A6B2BDD/Windows6.1-KB974405-x64.msu", # "http://go.microsoft.com/fwlink/?LinkID=166363" - Windows Identity Framework (Win2008 R2)&lt;/p&gt;&#xD;
&lt;p&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;&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;&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;&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;&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;&amp;nbsp; "http://download.microsoft.com/download/6/8/1/681F5144-4092-489B-87E4-63F05E95079C/Windows6.0-KB976394-x64.msu", # http://go.microsoft.com/fwlink/?linkID=160770 - WCF fix for Win2008 SP2&lt;/p&gt;&#xD;
&lt;p&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;&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;&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;&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;&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;&amp;nbsp; "http://download.microsoft.com/download/E/C/7/EC785FAB-DA49-4417-ACC3-A76D26440FC2/Windows6.1-KB976462-v2-x64.msu", # http://go.microsoft.com/fwlink/?LinkID=166231 - WCF fix for Win2008 R2&lt;/p&gt;&#xD;
&lt;p&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;&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;&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;&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;&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;&amp;nbsp; "http://download.microsoft.com/download/D/7/2/D72FD747-69B6-40B7-875B-C2B40A6B2BDD/Windows6.0-KB974405-x64.msu", # "http://go.microsoft.com/fwlink/?LinkID=160381" - Windows Identity Framework (Win2008 SP2)&lt;/p&gt;&#xD;
&lt;p&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;&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;&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;&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;&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;&amp;nbsp; "http://download.microsoft.com/download/3/5/5/35522a0d-9743-4b8c-a5b3-f10529178b8a/sqlncli.msi", # "http://go.microsoft.com/fwlink/?LinkId=123718&amp;amp;clcid=0x409" - SQL Server 2008 Native Client&lt;/p&gt;&#xD;
&lt;p&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;&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;&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;&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;&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;&amp;nbsp; "http://download.microsoft.com/download/9/1/3/9138773A-505D-43E2-AC08-9A77E1E0490B/1033/x64/SQLSERVER2008_ASADOMD10.msi", # "http://go.microsoft.com/fwlink/?LinkID=160390&amp;amp;clcid=0x409" - Microsoft SQL Server 2008 Analysis Services ADOMD.NET&lt;/p&gt;&#xD;
&lt;p&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;&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;&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;&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;&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;&amp;nbsp; "http://download.microsoft.com/download/1/7/1/171CCDD6-420D-4635-867E-6799E99AB93F/ADONETDataServices_v15_CTP2_RuntimeOnly.exe", # "http://go.microsoft.com/fwlink/?LinkId=158354" - ADO.NET Data Services v1.5 CTP2 (Win2008 SP2)&lt;/p&gt;&#xD;
&lt;p&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;&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;&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;&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;&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;&amp;nbsp; "http://download.microsoft.com/download/B/8/6/B8617908-B777-4A86-A629-FFD1094990BD/iis7psprov_x64.msi", # http://go.microsoft.com/?linkid=9655704 - IIS management cmdlets&lt;/p&gt;&#xD;
&lt;p&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;&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;&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;&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;&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;&amp;nbsp; "http://download.microsoft.com/download/1/0/F/10F1C44B-6607-41ED-9E82-DF7003BFBC40/1033/x64/rsSharePoint.msi", # http://go.microsoft.com/fwlink/?LinkID=166379 - SQL 2008 R2 Reporting Services SharePoint 2010 Add-in&lt;/p&gt;&#xD;
&lt;p&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;&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;&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;&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;&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;&amp;nbsp; "http://download.microsoft.com/download/8/D/F/8DFE3CE7-6424-4801-90C3-85879DE2B3DE/Platform/x64/SpeechPlatformRuntime.msi", # http://go.microsoft.com/fwlink/?LinkID=166378 - Microsoft Server Speech Platform Runtime&lt;/p&gt;&#xD;
&lt;p&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;&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;&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;&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;&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;&amp;nbsp; "http://download.microsoft.com/download/E/0/3/E033A120-73D0-4629-8AED-A1D728CB6E34/SR/MSSpeech_SR_en-US_TELE.msi" # http://go.microsoft.com/fwlink/?LinkID=166371 - Microsoft Server Speech Recognition Language - TELE(en-US)&lt;/p&gt;&#xD;
&lt;p&gt;SQL Servern vill ocks&amp;aring; n&amp;aring; update services f&amp;ouml;r att tanka ner senaste version. Ingen internet. F&amp;aring;r v&amp;auml;nta till efter&amp;aring;t. Kommer p&amp;aring; efter ett tag att &amp;rdquo;skip&amp;rdquo; &amp;auml;r bra att anv&amp;auml;nda d&amp;auml;r.&lt;/p&gt;&#xD;
&lt;p&gt;Varf&amp;ouml;r stannar den s&amp;aring; l&amp;auml;nge p&amp;aring; registry kollarna. Hur sv&amp;aring;rt ska det va?&lt;/p&gt;&#xD;
&lt;p&gt;Bara PowerPivot delen med olika konto-varianter, googling etc, nya f&amp;ouml;rs&amp;ouml;k, reboot och s&amp;aring; vidare tog sammanlagt 6 timmar att fels&amp;ouml;ka, la upp en connect p&amp;aring; den till sist n&amp;auml;r vi till slut hittade en work-around. R&amp;ouml;sta g&amp;auml;rna om du vill ha en f&amp;ouml;rb&amp;auml;ttring av den. &lt;a href="https://connect.microsoft.com/SQLServer/feedback/details/763299/setup-powerpivot-on-an-existing-sharepoint-server-farm-account-provisioning"&gt;https://connect.microsoft.com/SQLServer/feedback/details/763299/setup-powerpivot-on-an-existing-sharepoint-server-farm-account-provisioning&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;D&amp;auml;r var de tv&amp;aring; dagarna slut. Letar tid och pengar f&amp;ouml;r forts&amp;auml;ttning. Eller s&amp;aring; f&amp;aring;r man ta sin fritid.&lt;/p&gt;&#xD;
&lt;p&gt;Lessons learned (igen). Det g&amp;aring;r inte att vara helt f&amp;ouml;rberedd p&amp;aring; en s&amp;aring;n h&amp;auml;r uppgift, &amp;auml;ven att l&amp;auml;sa in sig p&amp;aring; &amp;auml;mnet tar din (och f&amp;ouml;retagets) dyrbara tid. &amp;rdquo;Improvise, adapt and overcome&amp;rdquo; &amp;auml;r det enda som funkar i l&amp;auml;ngden, g&amp;auml;rna med hj&amp;auml;lp av andras f&amp;ouml;rs&amp;ouml;k och frikostiga sj&amp;auml;lvutl&amp;auml;mnande beskrivningar i bloggar och forum.&lt;/p&gt;&#xD;
&lt;p&gt;Forts&amp;auml;ttning f&amp;ouml;ljer. Kanske. :-)&lt;/p&gt;&#xD;
&lt;p&gt;Jonas Bergstr&amp;ouml;m&lt;/p&gt;</description><a10:updated>2012-09-18T19:03:22Z</a10:updated></item><item><guid isPermaLink="false">e01fba34-5533-48cd-948a-32b64a4db137</guid><link>http://sqlservice.se/sv/start/blogg/sql-server--kolumn-alias-best-practice.aspx?lang=sv</link><title>SQL server - kolumn alias best practice</title><description>&lt;p&gt;Att anv&amp;auml;nda alias i SQL har m&amp;aring;nga f&amp;ouml;rdelar och &amp;auml;r helt n&amp;ouml;dv&amp;auml;ndiga i vissa situationer, som exepelvis&amp;nbsp;vid anv&amp;auml;ndade av&amp;nbsp;common table expression (CTE).&amp;nbsp;Nedanst&amp;aring;ende exempel skulle generera ett felmeddelande:&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;;WITH myCTE &lt;br /&gt;AS &lt;br /&gt;( &lt;br /&gt;SELECT GETDATE(), t.Name FROM sys.Tables t &lt;br /&gt;) &lt;br /&gt;SELECT * FROM myCTE;&lt;/p&gt;&#xD;
&lt;p&gt;----------------------------------------- &lt;br /&gt;Msg 8155, Level 16, State 2, Line 1 &lt;br /&gt;No column name was specified for column 1 of 'myCTE'.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Enligt ANSI standarden f&amp;ouml;r SQL s&amp;aring; skall man anv&amp;auml;nda:&lt;/p&gt;&#xD;
&lt;p&gt;uttryck AS alias&lt;/p&gt;&#xD;
&lt;p&gt;Det inneb&amp;auml;r att f&amp;ouml;reg&amp;aring;ende fr&amp;aring;ga skall d&amp;aring; allts&amp;aring; skrivas:&lt;/p&gt;&#xD;
&lt;p&gt;;WITH myCTE AS ( SELECT GETDATE() as currentDateTime, t.Name FROM sys.Tables t ) SELECT * FROM myCTE;&lt;/p&gt;&#xD;
&lt;p&gt;I det h&amp;auml;r exemplet s&amp;aring; &amp;auml;r det ganska enkelt att se vad GETDATE() uttrycket har f&amp;ouml;r alias, men anta att du har en komplex utr&amp;auml;kning blandat med en l&amp;aring;ng CASE sats etc, s&amp;aring; att antingen raden eller uttrycket blir s&amp;aring; l&amp;aring;ng att du inte kan snabbt se ditt alias. D&amp;aring; blir koden ganska snabbt sv&amp;aring;r att tolka. &amp;Auml;nnu v&amp;auml;rre blir situationen om du har en INSERT sats d&amp;auml;r du ska l&amp;auml;gga in r&amp;auml;tt uttryck i r&amp;auml;tt kolumn.&lt;/p&gt;&#xD;
&lt;p&gt;Eftersom antalet columner, datatyper, etc&amp;nbsp;i tabellen d&amp;auml;r datat skall l&amp;auml;ggas till m&amp;aring;ste matchas med kolumnerna i SELECT listan s&amp;aring; kan det l&amp;auml;tt bli frustrerande n&amp;auml;r man f&amp;aring;r fel p&amp;aring; grund av :&lt;/p&gt;&#xD;
&lt;ol&gt;&#xD;
&lt;li&gt;att fel antal kolumner &amp;auml;r angivna i SELECT listan&lt;/li&gt;&#xD;
&lt;li&gt;att&amp;nbsp;n&amp;aring;gon kolumn i INSERT listan&amp;nbsp;har en annan typ &amp;auml;n den kolumnen som &amp;auml;r&amp;nbsp;p&amp;aring; samma position&amp;nbsp;i SELECT listan&lt;/li&gt;&#xD;
&lt;li&gt;att en kolumn fr&amp;aring;n SELECT listan l&amp;auml;ggs in i&amp;nbsp;fel kolumn&amp;nbsp;i INSERT tabellen&lt;/li&gt;&#xD;
&lt;/ol&gt;&#xD;
&lt;p&gt;Eftersom felmeddelandet inte alltid pekar ut vilken rad som inneh&amp;aring;ller ett fel s&amp;aring; kan det bli ganska tids&amp;ouml;dande att hitta felet, speciellt om det &amp;auml;r s&amp;aring; enkelt som att man missat ett kommatecken mellan tv&amp;aring; kolumner eftersom det d&amp;aring; anses vara ett alias p&amp;aring; grund av att AS &amp;auml;r inte obligatoriskt!&lt;/p&gt;&#xD;
&lt;p&gt;INSERT INTO dbo.yyy (createdDate) &lt;br /&gt;SELECT GETDATE() createdDate FROM xxx&lt;/p&gt;&#xD;
&lt;p&gt;&amp;auml;r detsama som&lt;/p&gt;&#xD;
&lt;p&gt;INSERT INTO dbo.yyy (createdDate) &lt;br /&gt;SELECT GETDATE() as createdDate FROM xxx&lt;/p&gt;&#xD;
&lt;p&gt;MEN vad hade h&amp;auml;nt anta att du hade velat ha en currentTime baserat p&amp;aring; GETDATE() och en kolumn fr&amp;aring;n xxx som heter createdDate. I nedanst&amp;aring;ende exempel har jag medvetet "missat" ett kommatecken f&amp;ouml;r att visa konsekvensen. GETDATE() f&amp;aring;r ett alias som heter createdDate och antalet kolumner i INSERT matchar inte antalet i SELECT, vilket resulterar i ett fel.&lt;/p&gt;&#xD;
&lt;p&gt;INSERT INTO dbo.yyy (currentTime, createdDate) &lt;br /&gt;SELECT GETDATE() createdDate FROM xxx&lt;/p&gt;&#xD;
&lt;p&gt;Det h&amp;auml;r felet hade inte uppst&amp;aring;tt om vi hade varit tvungen att skriva AS f&amp;ouml;r alias. Det har var dock ett enkelt exempel d&amp;auml;r det var l&amp;auml;tt att se var felet uppstod, men vi har nog alla sett m&amp;aring;nga exempel p&amp;aring; sv&amp;aring;rl&amp;auml;st kod s&amp;aring; jag undviker att tr&amp;aring;ka ut er med en s&amp;aring;dan.&lt;/p&gt;&#xD;
&lt;p&gt;Nu till ett alternativ som inte &amp;auml;r ANSI compliant, men som jag &amp;auml;r f&amp;ouml;respr&amp;aring;kare till:&lt;/p&gt;&#xD;
&lt;p&gt;alias = uttryck&lt;/p&gt;&#xD;
&lt;p&gt;S&amp;aring; h&amp;auml;r skriver man ju i de flesta andra programmeringsspr&amp;aring;k, s&amp;aring; varf&amp;ouml;r inte i SQL!&lt;/p&gt;&#xD;
&lt;p&gt;INSERT INTO dbo.yyy (currentTime, createdDate) &lt;br /&gt;SELECT currentTime = GETDATE() createdDate FROM xxx&lt;/p&gt;&#xD;
&lt;p&gt;Det &amp;auml;r l&amp;auml;tt att f&amp;ouml;lja och l&amp;auml;tt att matcha SELECT satsen visuellt mot INSERT satsen. Samma kolumnnamn i INSERT listan som i SELECT listan och aliaset st&amp;aring;r f&amp;ouml;rst s&amp;aring; att det inte f&amp;ouml;rsvinner l&amp;auml;ngst bort i perifirin. Det spelar d&amp;aring; ingen roll hur l&amp;aring;ngt uttrycket blir:&lt;/p&gt;&#xD;
&lt;p&gt;INSERT INTO dbo.zzz ( customerID, CountryCode) &lt;br /&gt;SELECT &lt;br /&gt;customerID, &lt;br /&gt;countryCode = CASE countryName&lt;br /&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;&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; WHEN 'SWEDEN' THEN 'SE'&lt;br /&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;&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; WHEN 'Sverige'&amp;nbsp; THEN 'SE'&lt;br /&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;&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; WHEN 'NORWAY' THEN 'NO'&lt;br /&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;&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; WHEN 'FINLAND' THEN 'FI'&lt;br /&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END &lt;br /&gt;FROM dbo.bbb&lt;/p&gt;&#xD;
&lt;p&gt;&amp;auml;r l&amp;auml;ttare att l&amp;auml;sa och f&amp;ouml;lja &amp;auml;n:&lt;/p&gt;&#xD;
&lt;p&gt;INSERT INTO dbo.zzz (customerID, CountryCode) &lt;br /&gt;SELECT &lt;br /&gt;customerID, &lt;br /&gt;CASE countryName&lt;br /&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;&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; WHEN 'SWEDEN' THEN 'SE'&lt;br /&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;&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; WHEN 'Sverige'&amp;nbsp; THEN 'SE'&lt;br /&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;&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; WHEN 'NORWAY' THEN 'NO'&lt;br /&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;&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; WHEN 'FINLAND' THEN 'FI'&lt;br /&gt; END AS countryCode &lt;br /&gt;FROM dbo.bbb&lt;/p&gt;&#xD;
&lt;p&gt;Orolig f&amp;ouml;r att det inte &amp;auml;r ANSI standard? Personligen s&amp;aring; har jag inte sett s&amp;aring; m&amp;aring;nga bra till&amp;auml;mpningar som &amp;auml;r helt plattformsoberoende och kan porteras mellan olika databasmotorer utan att det finns n&amp;aring;gra problem, framf&amp;ouml;rallt vad g&amp;auml;ller prestanda.&lt;/p&gt;&#xD;
&lt;p&gt;L&amp;auml;s g&amp;auml;rna mer om Alias ifr&amp;aring;n Aaron Bertrand p&amp;aring; &lt;a href="http://sqlblog.com/blogs/aaron_bertrand/archive/2012/01/23/bad-habits-to-kick-using-as-instead-of-for-column-aliases.aspx"&gt;http://sqlblog.com/blogs/aaron_bertrand/archive/2012/01/23/bad-habits-to-kick-using-as-instead-of-for-column-aliases.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Kontakta g&amp;auml;rna n&amp;aring;gon av v&amp;aring;ra SQL server konsulter f&amp;ouml;r att f&amp;aring; hj&amp;auml;lp att s&amp;auml;tta upp en Best Practice f&amp;ouml;r SQL server&lt;/p&gt;&#xD;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-09-16T22:53:46Z</a10:updated></item><item><guid isPermaLink="false">a88b49ec-8c81-418d-98d1-c1fd56d6000b</guid><link>http://sqlservice.se/sv/start/blogg/guest-blog-performance-tip--transactions-can-actually-boost-throughput.aspx?lang=sv</link><title>Guest Blog: Performance Tip - Transactions Can Actually Boost Throughput</title><description>&lt;p&gt;&lt;a href="../"&gt;SQL Service&lt;/a&gt; are happy to welcome Michael K Campbell as a guest blogger! Michael K Campbell (&lt;a href="mailto:mike@sqlserveraudits.com"&gt;mike@sqlserveraudits.com&lt;/a&gt; and &lt;a href="http://www.sqlserveraudits.com"&gt;www.sqlserveraudits.com&lt;/a&gt;) is a contributing editor for SQL Server Magazine and a consultant with years of SQL Server DBA and developer experience. He enjoys consulting, development, and creating free videos for &lt;a href="http://www.sqlservervideos.com"&gt;www.sqlservervideos.com&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Over to you Michael!&lt;/p&gt;&#xD;
&lt;p&gt;************************************&lt;/p&gt;&#xD;
&lt;p&gt;Good developers typically have a good handle on what Donald Knuth&amp;rsquo;s famous &lt;a href="http://en.wikiquote.org/wiki/Donald_Knuth"&gt;quote&lt;/a&gt; about &amp;ldquo;premature optimization [being] the root of all evil&amp;rdquo; is all about &amp;ndash; it&amp;rsquo;s a constant reminder that developers shouldn&amp;rsquo;t &lt;a href="http://programmers.stackexchange.com/questions/80084/is-premature-optimization-really-the-root-of-all-evil"&gt;needlessly agonize&lt;/a&gt; over every line of code and worry about its potential performance cost. Instead, they should code as necessary (using as many best practices as possible), and then come BACK and manage any performance tuning needed &amp;ndash; once their application is put under load.&lt;/p&gt;&#xD;
&lt;p&gt;Still, one area where seasoned developers typically tend to be a bit worried or leery about potential performance problems is when it comes to explicit transactions &amp;ndash; because any seasoned developer knows that transactions come with a certain amount of processing overhead and an increase in resource utilization.&lt;/p&gt;&#xD;
&lt;h2&gt;Explicit Transactions Can Actually Make SOME Operations Faster&lt;/h2&gt;&#xD;
&lt;p&gt;As such, it can come as a big surprise to many developers that there are actually SOME kinds of operations that you can actually SPEED up in SQL Server when you wrap them within explicit transactions. And the key to gaining a sense for how all of this works is to remember that the &lt;a href="http://www.sqlservervideos.com/video/logging-essentials/"&gt;SQL Server Transaction Log&lt;/a&gt; has to keep writing out changes, serially, as each and every data modification comes through. Consequently, if a large number of UPDATE, for example, or INSERTs, is fired off &amp;ndash; one after another, that means that the Transaction Log is going to be hit by a bunch of back-to-back, individual and distinct, operations that can each be rolled back, independently, if needed.&lt;/p&gt;&#xD;
&lt;p&gt;Of late, I&amp;rsquo;ve spent a decent amount of time working with a couple of different clients to help diagnose potential problems with multi-tenant servers &amp;ndash; where large numbers of transactions can have an ugly &amp;lsquo;aggregate&amp;rsquo; effect when there are lots of writes being sent to multiple databases at the same time. Accordingly, one of the things I&amp;rsquo;ve been paying attention to a lot of late is the &lt;a href="http://sqlcat.com/sqlcat/b/technicalnotes/archive/2008/12/09/diagnosing-transaction-log-performance-issues-and-limits-of-the-log-manager.aspx"&gt;SQL Server Log Manager&lt;/a&gt; and how it works &amp;ndash; including how it buffers data and so on. And, along those lines, I was reminded of the fact that in SOME cases, explicitly blocking lots of (typically repeated) operations into a single, explicit, transaction can actually do a lot of good in terms of reducing disk-activity generated by the transaction log.&lt;/p&gt;&#xD;
&lt;h2&gt;Proof is in the Pudding - Or: Only Attempt this with Appropriate Testing&lt;/h2&gt;&#xD;
&lt;p&gt;Granted, this isn&amp;rsquo;t something you&amp;rsquo;d necessarily believe without seeing some hard numbers to back up such a claim NOR is it something you&amp;rsquo;d want to blindly consider for all operations without checking the actual metrics as well. So, with that in mind, let&amp;rsquo;s look at some examples.&lt;/p&gt;&#xD;
&lt;p&gt;To do that, you&amp;rsquo;ll want to carve out a little sandbox for yourself &amp;ndash; somewhere in a NON-production database. For me, that&amp;rsquo;s my &amp;lsquo;Meddling&amp;rsquo; database, which, as you can see, I start of with by creating a new table, and then running some backups to make sure I can clear out any transactions in the transaction log:&lt;/p&gt;&#xD;
&lt;div&gt;&#xD;
&lt;pre&gt;USE Meddling&lt;/pre&gt;&#xD;
&lt;pre&gt;GO &amp;nbsp;&lt;/pre&gt;&#xD;
&lt;pre&gt;IF OBJECT_ID('dbo.TransactionTest','U') IS NOT NULL&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DROP TABLE dbo.TransactionTest&lt;/pre&gt;&#xD;
&lt;pre&gt;GO&lt;/pre&gt;&#xD;
&lt;pre&gt;CREATE TABLE dbo.TransactionTest (&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RowId int IDENTITY(1,1) NOT NULL, &lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OptionName nvarchar(40) NOT NULL, &lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OptionValue int NOT NULL&lt;/pre&gt;&#xD;
&lt;pre&gt; )&lt;/pre&gt;&#xD;
&lt;pre&gt;GO&amp;nbsp; &lt;/pre&gt;&#xD;
&lt;pre&gt;BACKUP DATABASE Meddling TO DISK = N'D:\SQLBackups\Meddling_Full.bak'&lt;/pre&gt;&#xD;
&lt;pre&gt;WITH COMPRESSION&lt;/pre&gt;&#xD;
&lt;pre&gt;GO&lt;/pre&gt;&#xD;
&lt;pre&gt;BACKUP LOG Meddling TO DISK = N'D:\SQLBackups\Meddling_FULL.trn'&lt;/pre&gt;&#xD;
&lt;pre&gt;WITH COMPRESSION&lt;/pre&gt;&#xD;
&lt;pre&gt;GO&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&#xD;
&lt;p style="background: white;"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 9pt;" lang="EN-US"&gt;Then, once I&amp;rsquo;ve created a table and cleared everything out, I can check on the amount of space being used in my transaction log. The documented, or supported, way to do this is to use &lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms189768.aspx"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 9pt;"&gt;DBCC SQLPERF()&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 9pt;" lang="EN-US"&gt; command with the LOGSPACE argument, but I personally hate how that shows me log-space info for all tables. (Er, well, I hate that aspect when working on a single database &amp;ndash; especially when I have a lot.) So, I prefer to use an admittedly ugly way of getting the same info &amp;ndash; by using performance counters: &lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="background: white;"&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;div&gt;&#xD;
&lt;pre&gt;SELECT &lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbs.name,&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ls.cntr_value / 1024 AS [Log Size (MB)],&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lu.cntr_value / 1024 AS [Log Used (MB)]&lt;/pre&gt;&#xD;
&lt;pre&gt;FROM &lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.databases dbs&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INNER JOIN sys.dm_os_performance_counters lu ON dbs.name = lu.instance_name&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INNER JOIN sys.dm_os_performance_counters ls ON dbs.name = ls.instance_name&lt;/pre&gt;&#xD;
&lt;pre&gt;WHERE&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lu.counter_name LIKE N'Log File(s) Used Size (KB)%' &lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND ls.counter_name LIKE N'Log File(s) Size (KB)%'&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND dbs.database_id = DB_ID()&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&#xD;
&lt;p style="background: white;"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 9pt;" lang="EN-US"&gt;As the benefit of such an approach is that it&amp;rsquo;s pretty easy to restrict results down to a single database. &lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="background: white;"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 9pt;" lang="EN-US"&gt;And, in my case, after a t-log backup, I&amp;rsquo;m using roughly 4MB of my 100MB log. And, with such a base-line set, I can then kick off a pretty simple operation where I&amp;rsquo;ll log 20,000 back to back inserts by creating some bogus data from the master&amp;rsquo;s spt_value table (something that&amp;rsquo;s really only good for demos): &lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="background: white;"&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;div&gt;&#xD;
&lt;pre&gt;SET NOCOUNT ON &lt;/pre&gt;&#xD;
&lt;pre&gt;GO&lt;/pre&gt;&#xD;
&lt;pre&gt;DECLARE cursorsAreUgly CURSOR FAST_FORWARD &lt;/pre&gt;&#xD;
&lt;pre&gt;FOR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT TOP 20000 t1.name, t1.number &lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM master.dbo.spt_values t1 &lt;/pre&gt;&#xD;
&lt;pre&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; LEFT JOIN master.dbo.spt_values t2 ON t1.number = t2.number&lt;/pre&gt;&#xD;
&lt;pre&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; LEFT JOIN master.dbo.spt_values t3 ON t2.name = t3.name&lt;/pre&gt;&#xD;
&lt;pre&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; LEFT JOIN master.dbo.spt_values t4 ON t3.name = t1.name&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORDER BY NEWID()&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/pre&gt;&#xD;
&lt;pre&gt;DECLARE @name nvarchar(40), @number int&lt;/pre&gt;&#xD;
&lt;pre&gt;OPEN cursorsAreUgly&lt;/pre&gt;&#xD;
&lt;pre&gt;FETCH NEXT FROM cursorsAreUgly INTO @name, @number &lt;/pre&gt;&#xD;
&lt;pre&gt;WHILE @@FETCH_STATUS = 0 BEGIN &lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INSERT INTO TransactionTest&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VALUES (ISNULL(@name,''), @number)&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FETCH NEXT FROM cursorsAreUgly INTO @name, @number &lt;/pre&gt;&#xD;
&lt;pre&gt;END&lt;/pre&gt;&#xD;
&lt;pre&gt;CLOSE cursorsAreUgly&lt;/pre&gt;&#xD;
&lt;pre&gt;DEALLOCATE cursorsAreUgly&lt;/pre&gt;&#xD;
&lt;pre&gt;GO&lt;/pre&gt;&#xD;
&lt;p style="background: white;"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 9pt;" lang="EN-US"&gt;And, while 20,000 INSERTs may seem like a lot (and is), these are exceptionally narrow rows &amp;ndash; so bear that in mind when comparing this technique against your own data. &lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="background: white;"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 9pt;" lang="EN-US"&gt;Likewise, in my example, I&amp;rsquo;m using a cursor &amp;ndash; but your code might be processing either INSERTs or UPDATEs much differently. &lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="background: white;"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 9pt;" lang="EN-US"&gt;The key thing, though, is that after running that statement above (which takes 13 seconds on my dev/testing server that runs older/cruddy SATA drives), I end up with 13MB of my log file used. &lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="background: white;"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 9pt;" lang="EN-US"&gt;If, however, I re-backup the transaction log (to clear it out &amp;ndash; and get back down to around 4MB used), and then run the following operation &amp;ndash; which wraps everything in an EXPLICIT transaction (something that might make you think this operation would take LONGER than the implicit version listed above) :&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p style="background: white;"&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;div&gt;&#xD;
&lt;pre&gt;SET NOCOUNT ON &lt;/pre&gt;&#xD;
&lt;pre&gt;GO&lt;/pre&gt;&#xD;
&lt;pre&gt;BEGIN TRAN&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DECLARE cursorsAreUgly CURSOR FAST_FORWARD &lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FOR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/pre&gt;&#xD;
&lt;pre&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; SELECT TOP 20000 t1.name, t1.number &lt;/pre&gt;&#xD;
&lt;pre&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; FROM master.dbo.spt_values t1 &lt;/pre&gt;&#xD;
&lt;pre&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LEFT JOIN master.dbo.spt_values t2 ON t1.number = t2.number&lt;/pre&gt;&#xD;
&lt;pre&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LEFT JOIN master.dbo.spt_values t3 ON t2.name = t3.name&lt;/pre&gt;&#xD;
&lt;pre&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LEFT JOIN master.dbo.spt_values t4 ON t3.name = t1.name&lt;/pre&gt;&#xD;
&lt;pre&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; ORDER BY NEWID()&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DECLARE @name nvarchar(40), @number int&lt;/pre&gt;&#xD;
&lt;pre&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OPEN cursorsAreUgly&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FETCH NEXT FROM cursorsAreUgly INTO @name, @number &lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHILE @@FETCH_STATUS = 0 BEGIN &lt;/pre&gt;&#xD;
&lt;pre&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; INSERT INTO TransactionTest&lt;/pre&gt;&#xD;
&lt;pre&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; VALUES (ISNULL(@name,''), @number)&lt;/pre&gt;&#xD;
&lt;pre&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; FETCH NEXT FROM cursorsAreUgly INTO @name, @number &lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLOSE cursorsAreUgly&lt;/pre&gt;&#xD;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DEALLOCATE cursorsAreUgly&lt;/pre&gt;&#xD;
&lt;pre&gt;COMMIT&lt;/pre&gt;&#xD;
&lt;pre&gt;GO&lt;/pre&gt;&#xD;
&lt;/div&gt;&#xD;
&lt;p style="background: white;"&gt;&lt;br /&gt;I end up with an operation that only took 8 seconds, and which only managed to generate an additional 3MB of transaction log usage (taking me up to 7MB used total instead of 13MB &amp;ndash; quite a nice savings). And, of course, if I watch disk performance counters, I can see that they&amp;rsquo;re the primary source of contention during the previous operation &amp;ndash; or they end up being my bottleneck because I&amp;rsquo;m thumping them over and over and over again.&lt;/p&gt;&#xD;
&lt;/div&gt;&#xD;
&lt;p&gt;In fact, if you&amp;rsquo;d like to get a better insight into what&amp;rsquo;s going on, run the tests above in your own environment and pay attention to your disk metrics AND take a peek at what&amp;rsquo;s being logged to the T-LOG itself by means of the most-excellent, and undocumented, T-SQL functionality made available by fn_dblog() as follows:&lt;/p&gt;&#xD;
&lt;div&gt;&#xD;
&lt;pre&gt;SELECT * FROM fn_dblog(NULL, NULL)&lt;/pre&gt;&#xD;
&lt;/div&gt;&#xD;
&lt;p&gt;And, just make sure that you backup your t-log between each of your tests &amp;ndash; to clear out used data and to make it easier to see the differences in what&amp;rsquo;s going on by looking at fn_dblog() output.&lt;/p&gt;&#xD;
&lt;h2&gt;Conclusion&lt;/h2&gt;&#xD;
&lt;p&gt;Obviously, this blog post isn&amp;rsquo;t an open invitation to run out and wrap every single operation in an explicit transaction. Instead, it&amp;rsquo;s a reminder that when you know what&amp;rsquo;s going on under the covers, performance benefits and boosts can come in what might, otherwise, seem to be surprising ways. That, and this post is a reminder that testing and hard-numbers are a great way to ensure performance optimizations when they&amp;rsquo;re actually needed.&lt;/p&gt;&#xD;
&lt;/div&gt;&#xD;
&lt;p style="background: white;"&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;/div&gt;</description><a10:updated>2012-09-14T14:10:07Z</a10:updated></item><item><guid isPermaLink="false">8786fde8-b0c0-4e91-b496-93a0fbb7f58d</guid><link>http://sqlservice.se/sv/start/blogg/dubbla-index-.aspx?lang=sv</link><title>Dubbla index ?</title><description>&lt;p&gt;Vad som ofta f&amp;ouml;rv&amp;aring;nar oss n&amp;auml;r vi &amp;auml;r ute hos kunder &amp;auml;r de index som eventuellt &amp;auml;r skapade f&amp;ouml;r tabellerna. Att skapa r&amp;auml;tt index &amp;auml;r en konst och p&amp;aring; samma s&amp;auml;tt som det kan f&amp;ouml;rb&amp;auml;ttra kan det ocks&amp;aring; f&amp;ouml;rs&amp;auml;mra och t.ex. &amp;nbsp;tynga ned ett system som kostar i det extra underh&amp;aring;ll som kr&amp;auml;vs. Det &amp;auml;r ju v&amp;auml;ldigt l&amp;auml;tt att skapa index i SQL Server och man f&amp;aring;r inte heller mycken hj&amp;auml;lp ens av de verkyg som f&amp;ouml;ljer med t.ex. Database Tuning Advisor. Visst kan liknande verktyg hj&amp;auml;lpa till att ge f&amp;ouml;rslag p&amp;aring; index men man skall aldrig lita blint p&amp;aring; dessa r&amp;aring;d och sedan skapa alla m&amp;ouml;jliga och om&amp;ouml;jliga index. B&amp;auml;ttre &amp;auml;r d&amp;aring; anlita experter och skapa de n&amp;ouml;dv&amp;auml;ndiga och r&amp;auml;tta index. De allra b&amp;auml;sta &amp;auml;r f&amp;ouml;rst&amp;aring;s att en g&amp;aring;ng f&amp;ouml;r alla verkligen l&amp;auml;ra sig detta med att skapa index. Sj&amp;auml;lvklart hj&amp;auml;lper vi till med&amp;nbsp;b&amp;aring;de och. Detta&amp;nbsp;&amp;auml;r en investering som kommer l&amp;ouml;na sig i det l&amp;aring;nga loppet.&lt;/p&gt;&#xD;
&lt;p&gt;Som sagt ett exempel som kan finnas &amp;auml;r dubbla index, dvs index som t&amp;auml;cker samma kolumner . R&amp;auml;tt smart att ha tv&amp;aring; inneh&amp;aring;llsf&amp;ouml;rteckningar i samma bok :-).&lt;/p&gt;&#xD;
&lt;p&gt;Nedan finns en l&amp;auml;nk med informaton som avsl&amp;ouml;jar om detta &amp;auml;r fallet i eran milj&amp;ouml;.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.sqlskills.com/BLOGS/KIMBERLY/post/UnderstandingDuplicateIndexes.aspx"&gt;http://www.sqlskills.com/BLOGS/KIMBERLY/post/UnderstandingDuplicateIndexes.aspx&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-09-11T20:35:00Z</a10:updated></item><item><guid isPermaLink="false">278eb700-c7f3-4455-93f7-c621926aaa6f</guid><link>http://sqlservice.se/sv/start/blogg/find-the-code-behind.aspx?lang=sv</link><title>Find the code behind</title><description>&lt;p&gt;-- If you need to split strings on specific characters &lt;br /&gt;-- and experiencing problem finding the right character &lt;br /&gt;-- or the UNICODE code of the character this might come in handy. &lt;br /&gt;-- &lt;br /&gt;-- The reason behind this post is that I needed to identify the character code&lt;br /&gt; &lt;br /&gt;-- behind a junk character.&lt;br /&gt; &lt;br /&gt;-- &lt;br /&gt;-- It utilizes a cursor because I need to loop through the string or strings. &lt;br /&gt;-- The cursor fetch every single string, and the loop reads the string. &lt;br /&gt;-- &lt;br /&gt;-- Valiables for the string &lt;br /&gt;DECLARE @string nvarchar(255) = N'', @stringnumber int = 0, @length int = 0 &lt;br /&gt; &lt;br /&gt;-- Declaring the cursor &lt;br /&gt;DECLARE StringCursor CURSOR FOR &lt;br /&gt;-- Within the block comment you'll find a sample query. &lt;br /&gt;-- * {rowidentifier} = The column that identifies the row in table &lt;br /&gt;-- * {stringcolumn} = The column that needs to be evaluated &lt;br /&gt;-- * {sourcetable} = The table that contains your strings &lt;br /&gt;-- * {filtercolumn} = The column that identifies your row containing the string &lt;br /&gt;-- * {filtervalue} = The value that filter &lt;br /&gt;/* &lt;br /&gt;SELECT {rowidentifier}, {stringcolumn} FROM {sourcetable} WHERE {filtercolumn} = {filtervalue} &lt;br /&gt;*/ &lt;br /&gt;-- Just to get some sample data. &lt;br /&gt;SELECT &lt;br /&gt; ROW_NUMBER() OVER (ORDER BY (SELECT NULL)), &lt;br /&gt; name &lt;br /&gt;FROM sys.databases (NOLOCK) &lt;br /&gt;-- Please note that ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) is &lt;br /&gt;-- just something that gives you the read order position of the string &lt;br /&gt;-- and should probably be a reference to the row identifier. &lt;br /&gt; &lt;br /&gt;-- A variable containg the target table &lt;br /&gt;DECLARE @StringTable TABLE ( &lt;br /&gt; String nvarchar(255) NOT NULL, &lt;br /&gt;-- String to be evaluated &lt;br /&gt; StringNumber int NOT NULL, &lt;br /&gt;-- Number representing the physical order in table &lt;br /&gt; Position int NOT NULL, &lt;br /&gt;-- Position in string for the Character &lt;br /&gt; UNICODECharacter nchar(1) NOT NULL, &lt;br /&gt;-- Character to be decoded &lt;br /&gt; UNICODECode AS UNICODE(UNICODECharacter) &lt;br /&gt;-- The UNICODE for specific character. &lt;br /&gt;) &lt;br /&gt; &lt;br /&gt;-- In this example I use a cursor. Remember that cursors might be bad &lt;br /&gt;-- and if the source table contain long words and long strings this might take &lt;br /&gt;-- a while. Due to this I choose to add the NOLOCK hint on the query for the cursor. &lt;br /&gt;OPEN StringCursor &lt;br /&gt;FETCH NEXT FROM StringCursor INTO @stringnumber, @string &lt;br /&gt; &lt;br /&gt;WHILE @@FETCH_STATUS = 0 &lt;br /&gt;-- As long the FETCH NEXT grabs a row this is true. &lt;br /&gt;BEGIN &lt;br /&gt; &lt;br /&gt; -- Variables for the position of the character and character itself. &lt;br /&gt; DECLARE @pos int = 1, @char nchar(1) = N'' &lt;br /&gt; SET @length = LEN(@string) &lt;br /&gt;-- Length of the evaluated string. &lt;br /&gt; WHILE @pos -- Will continue to loop while we have a character to read. &lt;br /&gt; BEGIN &lt;br /&gt; -- Inserts the table valued variable &lt;br /&gt; INSERT INTO @StringTable (String, StringNumber, Position, UNICODECharacter) &lt;br /&gt; VALUES(@string, @stringnumber, @pos, SUBSTRING(@string, @pos, 1)) &lt;br /&gt; SET @pos += 1 &lt;br /&gt;-- Moves to next position in the string. &lt;br /&gt; END &lt;br /&gt; -- Grab the next string from the table. &lt;br /&gt; FETCH NEXT FROM StringCursor INTO @stringnumber, @string &lt;br /&gt;END &lt;br /&gt; &lt;br /&gt;-- The CLOSE and DEALLOCATE is important and usually forgotten and if left out &lt;br /&gt;-- probably leads to excessive, unnecessary locking. &lt;br /&gt;CLOSE StringCursor &lt;br /&gt;DEALLOCATE StringCursor &lt;br /&gt; &lt;br /&gt;-- See the result. &lt;br /&gt;SELECT * from @StringTable &lt;br /&gt; &lt;br /&gt;-- Have fun, I hope you enjoyed the script. &lt;br /&gt;-- /Mattias&lt;/p&gt;</description><a10:updated>2012-09-09T17:23:37Z</a10:updated></item><item><guid isPermaLink="false">26c6fabb-ffb5-413f-91ab-e62f170bc00e</guid><link>http://sqlservice.se/sv/start/blogg/sql-server--datadictionary.aspx?lang=sv</link><title>SQL Server - DataDictionary</title><description>&lt;p&gt;Som SQL server konsult s&amp;aring; har jag under min karri&amp;auml;r ofta st&amp;ouml;tt p&amp;aring; databaser som saknar ett vettigt (och konsekvent) data dictionary. Avsaknaden av data dictionary tar sig ofta uttryck i databaser som inneh&amp;aring;ller tabeller med olika definitioner f&amp;ouml;r samma verksamhetsbegrepp (realiserat som kolumner).&lt;/p&gt;&#xD;
&lt;p&gt;Det kan i f&amp;ouml;rsta anblick tyckas&amp;nbsp;oviktigt att ha&amp;nbsp;samma definition f&amp;ouml;r samma&amp;nbsp;begrepp i olika tabeller,&amp;nbsp;men tittar man&amp;nbsp;n&amp;auml;rmare p&amp;aring; problemet s&amp;aring; kan man hitta ganska allvarliga konsekvenser av detta.&lt;/p&gt;&#xD;
&lt;p&gt;N&amp;aring;gra av&amp;nbsp;de&amp;nbsp;allvarliga negativa konsekvenserna&amp;nbsp;kan vara:&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;trunkering av data&lt;/li&gt;&#xD;
&lt;li&gt;exceptions&lt;/li&gt;&#xD;
&lt;li&gt;implicit conversion, med prestandaproblem som f&amp;ouml;ljd&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;Att samma verksamhetsbegrepp f&amp;ouml;rekommer i flera olika tabeller kan dessutom vara ett tecken p&amp;aring; d&amp;aring;lig databasdesign.&lt;/p&gt;&#xD;
&lt;p&gt;Exempel p&amp;aring; problemet:&lt;/p&gt;&#xD;
&lt;p&gt;CREATE &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;TABLE &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;x&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ID &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;int &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;IDENTITY&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Val &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;NUMERIC&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;4&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;2&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;NAME &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;CHAR&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;10&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ModificationDate &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;DATETIME2 &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;DEFAULT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;GETDATE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;()));&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;GO&lt;br /&gt;CREATE &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;TABLE &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;y&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ID &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;int &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;IDENTITY&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Val &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;NUMERIC&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;4&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;2&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;NAME &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;VARCHAR&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;30&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ModificationDate &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;DATETIME &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;DEFAULT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;GETDATE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;()));&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;GO&lt;br /&gt;CREATE &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;NONCLUSTERED &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;INDEX &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ix_x &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ON &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;x&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ModificationDate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;INCLUDE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;val&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;) ;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;GO&lt;br /&gt;CREATE &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;NONCLUSTERED &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;INDEX &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ix_y &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ON &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;y&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ModificationDate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;INCLUDE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;val&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;) ;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;CREATE&amp;nbsp;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;a href="mailto:PROCEDUREdbo.getByModDate@ModificationDateDATETIME"&gt;PROCEDURE&lt;/a&gt;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a href="mailto:dbo.getByModDate@ModificationDate"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;getByModDate &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;@ModificationDate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&amp;nbsp;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;a&gt;DATETIME&lt;/a&gt;2 &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;AS &lt;br /&gt;PRINT &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;@ModificationDate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;SELECT &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;val &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;FROM &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;x &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;WHERE &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;a href="mailto:ModificationDate=@ModificationDate"&gt;ModificationDate&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;a href="mailto:ModificationDate=@ModificationDate"&gt;@ModificationDate&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;; &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;SELECT&lt;a href="mailto:SELECTvalFROMdbo.yWHEREModificationDate=@ModificationDate"&gt; &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;val &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;FROM &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;y &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;WHERE &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ModificationDate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;a href="mailto:SELECTvalFROMdbo.yWHEREModificationDate=@ModificationDate"&gt;@ModificationDate&lt;/a&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;; &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;SELECT &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;x&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;val&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;x&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ModificationDate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;y&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;val&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;y&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ModificationDate &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;FROM &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;x &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;INNER &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;JOIN &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;y &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ON &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;y&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ModificationDate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;x&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ModificationDate &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;DECLARE &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;@date &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;DATETIME2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;SYSDATETIME&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;INSERT &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;INTO &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;x&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Val&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ModificationDate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;) &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;VALUES&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;10.01&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'H.Winther'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;@date&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;); &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;INSERT &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;INTO &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;y&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Val&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ModificationDate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;) &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;VALUES&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;10.01&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'H.Winther'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;@date&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;) &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;EXEC &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;getByModDate &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;@ModificationDate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;@date&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;I det h&amp;auml;r exemplet s&amp;aring; kommer proceduren att bara returnera 1 enda rad eftersom det sker implicita konverteringar och i dessa konvertingar s&amp;aring; f&amp;ouml;rsvinner precisionen p&amp;aring; tidsangivelsen vilket g&amp;ouml;r att det inte blir n&amp;aring;gon tr&amp;auml;ff.&lt;/p&gt;&#xD;
&lt;p&gt;Problemet hade l&amp;auml;tt kunnat undvikas om man hade gjort en ordentlig modellering av verksamhetsbegrepp och omsatt det till ett DataDictionary som kan anv&amp;auml;ndas f&amp;ouml;r att validera datamodellen.&lt;/p&gt;&#xD;
&lt;p&gt;F&amp;ouml;r att underl&amp;auml;tta denna typ av validering s&amp;aring; har SQL service tagit fram ett DataDictionary verktyg. Alla kolumner eller parametrar som inte finns i DataDictionary tabellen eller inte matchar datatypen kommer att rapporteras som ogiltiga.&lt;/p&gt;&#xD;
&lt;p&gt;Om du redan har en f&amp;auml;rdig/halvf&amp;auml;rdig databas s&amp;aring; kan du anv&amp;auml;nda v&amp;aring;rt verktyg f&amp;ouml;r att samla in alla kolumner samt dess definition&amp;nbsp;och lagra dem som verksamhetsbegrepp. Information om vilka tabeller som anv&amp;auml;nder verksamhetsbegrepp lagras i en l&amp;auml;nkad tabell tillsammans med dess definition.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;Auml;r du intresserad av att veta mer om DataDictionary och v&amp;aring;rt DataDictionary verktyg s&amp;aring; &amp;auml;r du varmt v&amp;auml;lkommen att kontakta n&amp;aring;gon av v&amp;aring;ra SQL server konsulter&lt;/p&gt;</description><a10:updated>2012-09-06T16:19:49Z</a10:updated></item><item><guid isPermaLink="false">3a6a1ecf-67ca-42e2-ac30-b2e600479cd3</guid><link>http://sqlservice.se/sv/start/blogg/job-schedules.aspx?lang=sv</link><title>Job Schedules</title><description>&lt;p&gt;N&amp;auml;r man v&amp;auml;ljer att schemal&amp;auml;gga ett jobb i SQL Server s&amp;aring; har man m&amp;ouml;jlighet att v&amp;auml;lja en tid som redan &amp;auml;r definerad mha "Pick". Det som d&amp;aring; kan h&amp;auml;nda &amp;auml;r att man v&amp;auml;ljer att &amp;auml;ndra en tid och inte t&amp;auml;nker p&amp;aring; att det kanske finns andra jobb som ocks&amp;aring; anv&amp;auml;nder denna tid. Detta intr&amp;auml;ffar ocks&amp;aring; om man kopierar ett jobb. Titta i exemplet nedan.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=7abbaaef-05d4-4659-b848-c691d5ca7f46&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;TestJob1 har tiden 06:00&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;img src="../ci.axd?sid=5baab91c-3bec-4de6-b259-31387ab7e856&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Sedan tar tar man och &amp;auml;ndrar tiden f&amp;ouml;r TestJob2 till 06:30 och till och med d&amp;ouml;per om det till "Daily 06:30".&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=2696f4ee-1a5c-472f-bfc0-d67463c7189e&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Kanske inte helt ov&amp;auml;ntat men troligen inte vad man vill &amp;auml;r att nu har ju tiden &amp;auml;ndrats ocks&amp;aring; f&amp;ouml;r TestJob1.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=45563978-6f71-423c-b7ed-276f30e850bd&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Nu finns det ju ett s&amp;auml;tt se hur m&amp;aring;nga jobb som anv&amp;auml;nder samma schemal&amp;auml;ggningsrad och det &amp;auml;r mha "Pick". D&amp;auml;remot ser man inte informationen f&amp;ouml;r det jobb man st&amp;aring;r p&amp;aring; utan man m&amp;aring;ste v&amp;auml;lja ett annat som nedan.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=af95864a-b951-42a0-aac8-fb7cf2b4124c&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-09-05T19:48:49Z</a10:updated></item><item><guid isPermaLink="false">7854b096-1f81-4067-8049-c92885e3e9a3</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-2012-support-in-system-center-advisor.aspx?lang=sv</link><title>SQL Server 2012 support in System Center Advisor</title><description>&lt;p&gt;This does not really qualify as news, but it is worth mentioning that System Center Advisor &lt;a href="http://www.systemcenteradvisor.com/"&gt;http://www.systemcenteradvisor.com/&lt;/a&gt; (More info here &lt;a href="../sv/start/blogg/atlanta-a-k-a-system-center-advisor.aspx"&gt;http://www.sqlservice.se/sv/start/blogg/atlanta-a-k-a-system-center-advisor.aspx&lt;/a&gt; and here &lt;a href="http://onlinehelp.microsoft.com/en-us/advisor/default.aspx"&gt;http://onlinehelp.microsoft.com/en-us/advisor/default.aspx&lt;/a&gt;) supports monitoring SQL Server 2012 since April 2012. If you haven't yet tried it out, now might be the time! System Center Advisor is a cloud based SQL Server (and more...) daily monitoring tool, that analyzes your environment and gives you information about issues that you&amp;nbsp;have to of want to fix, to avoid potential problems.&amp;nbsp;And if you have SQL Server with Software assurance, you have already paid for it!&lt;/p&gt;</description><a10:updated>2012-09-04T16:46:14Z</a10:updated></item><item><guid isPermaLink="false">c2d32a9c-bb25-4315-b182-a3cc55708eba</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-support-livscykel.aspx?lang=sv</link><title>SQL Server support livscykel</title><description>&lt;p&gt;Att Microsoft inte supportar sina produkter och versioner av dessa i all evighet vet vi alla. Som ni kanske ocks&amp;aring; vet s&amp;aring; g&amp;auml;ller detta &amp;auml;ven alla service packar. Tex s&amp;aring; supportar Microsoft sina service packar 12 m&amp;aring;nader efter att n&amp;auml;stf&amp;ouml;ljande&amp;nbsp;service pack&amp;nbsp;sl&amp;auml;pps.&lt;/p&gt;&#xD;
&lt;p&gt;Det &amp;auml;r viktigt att ha koll p&amp;aring; detta s&amp;aring; man inte k&amp;ouml;r p&amp;aring; en osupportad version. Risken med att halka efter &amp;auml;r att man inte f&amp;aring;r hj&amp;auml;lp den dagen man verkligen beh&amp;ouml;ver hj&amp;auml;lp. I v&amp;auml;rsta fall kan man d&amp;aring; tvingas g&amp;ouml;ra en uppgradering innan man kan komma vidare i fels&amp;ouml;kningen eller f&amp;aring; hj&amp;auml;lp av Microsoft. B&amp;auml;ttre d&amp;aring; att ist&amp;auml;llet ligga steget f&amp;ouml;re och uppgradera n&amp;auml;r nya service packar sl&amp;auml;pps under kontrollerade former.&lt;/p&gt;&#xD;
&lt;p&gt;Dessutom &amp;auml;r ju service packar en uppdatering och f&amp;ouml;rb&amp;auml;ttring av programvaran vilket man naturligtvis vill ha!&lt;/p&gt;&#xD;
&lt;p&gt;Lyckligtvis beh&amp;ouml;ver man inte memorera alla datum d&amp;aring; versioner och uppdateringar av versioner blir osupportade, man kan titta h&amp;auml;r:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/lifecycle/?LN=en-us&amp;amp;x=5&amp;amp;y=11&amp;amp;c2=1044"&gt;http://support.microsoft.com/lifecycle/?LN=en-us&amp;amp;x=5&amp;amp;y=11&amp;amp;c2=1044&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-08-31T10:09:00Z</a10:updated></item><item><guid isPermaLink="false">7b8765db-c6b8-4b83-9bcc-da22a537def7</guid><link>http://sqlservice.se/sv/start/blogg/where-is-my-data.aspx?lang=sv</link><title>Where is my data?</title><description>&lt;p&gt;As you might already know, SQL Server stores the data in the databases in *.mdf and *.ndf files. And internally, these files are divided up into 8Kb structures called Pages. And sometimes you might want to know exactly in which file and which page a certain row of data is stored.&lt;/p&gt;&#xD;
&lt;p&gt;Why would you ever need to know that, apart from pure curiosity? One example could be to verify how many rows you can fit on one page with you current database design, and maybe how designchanges affects this. And it can also be a good way to visually see the fragmentation of your clustered indexes. Or even to view the effects of converting a heap to a table with a clustered index.&lt;/p&gt;&#xD;
&lt;p&gt;Let me show you how this can be done, using MSDB as an example database:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Select &amp;nbsp;jh.*, pl.* from msdb.dbo.sysjobhistory jh&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Cross apply fn_physloccracker(%%physloc%%) pl&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;This gives us all rows and all columns in the sysjobhistory table, and 3 additional columns to the right of the normal columns:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;File_ID&lt;/strong&gt; is the id number of the mdf/ndf datafile.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Page_ID&lt;/strong&gt; is the id of the 8Kb page that the specific row is stored on&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Slot_ID&lt;/strong&gt; is the ordinal place in the page that this specific row is stored on, as a page can generally contain several rows.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-08-30T14:55:34Z</a10:updated></item><item><guid isPermaLink="false">e895b18a-f527-41b5-bb49-b0e61dc8f8b2</guid><link>http://sqlservice.se/sv/start/blogg/behorighet-pa-radniva-i-sql-server.aspx?lang=sv</link><title>Behörighet på radnivå i SQL Server</title><description>&lt;p&gt;Det finns ingen inbyggd funktionalitet i SQL Server f&amp;ouml;r att s&amp;auml;tta beh&amp;ouml;righet p&amp;aring; radniv&amp;aring; utan enbart p&amp;aring; tabellniv&amp;aring;. Det finns inte heller i den nyaste versionen SQL Server 2012 n&amp;aring;got st&amp;ouml;d f&amp;ouml;r rads&amp;auml;kerhet, allts&amp;aring; st&amp;ouml;d f&amp;ouml;r vilka poster som de olika anv&amp;auml;ndarna skall se. Dock finns det p&amp;aring; f&amp;ouml;rslagslistan till f&amp;ouml;rb&amp;auml;ttringar, men tydligen prioriteras inte detta nog mycket. D&amp;auml;remot finns det vedertagna s&amp;auml;tt f&amp;ouml;r att l&amp;ouml;sa behovet av rads&amp;auml;kerhet som jag h&amp;auml;r i korthet beskriver.&lt;/p&gt;&#xD;
&lt;p&gt;F&amp;ouml;r att adminstrera beh&amp;ouml;righet p&amp;aring; radniv&amp;aring; s&amp;aring; l&amp;auml;gger man till n&amp;aring;gra administrationstabeller och definerar niv&amp;aring;er av s&amp;auml;kerhet som man &amp;ouml;nskar. Detta g&amp;ouml;r man enklast med ett verktyg &amp;rdquo;Label Policy Designer&amp;rdquo; som &amp;auml;r utvecklat av Microsofts team &amp;rdquo;Consulting Services&amp;rdquo;.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Nedan &amp;auml;r en bild av hur niv&amp;aring;erna kan se ut.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;img src="../ci.axd?sid=52e1a708-20b6-4ca1-97ab-56189f8765fe&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;N&amp;auml;r definitionen av s&amp;auml;kerheten och dess niv&amp;aring;er &amp;auml;r uppsatt i detta verktyg s&amp;aring; v&amp;auml;ljer man d&amp;auml;refter&amp;nbsp; databas och implementerar denna design i databasen. Det som d&amp;aring; h&amp;auml;nder &amp;auml;r att fem tabeller skapas och fylls med poster f&amp;ouml;r att st&amp;ouml;dja designen man gjort av beh&amp;ouml;righeterna. Dessutom skapas vyer, funktioner och roller i den valda databasen.&amp;nbsp; Tanken &amp;auml;r n&amp;auml;mligen att ist&amp;auml;llet f&amp;ouml;r att ge beh&amp;ouml;righet till tabellerna s&amp;aring; anv&amp;auml;nder man vyer som styr vilka rader ur tabellerna de olika anv&amp;auml;ndarna ser. Detta inneb&amp;auml;r att alla tabeller som skall ha radbeh&amp;ouml;righet m&amp;aring;ste kompletteras med en kolumn, t.ex. RLS_ID som sedan fylls med&amp;nbsp; r&amp;auml;tt beh&amp;ouml;righetsniv&amp;aring; . Det kan d&amp;aring; se ut som nedan.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #000080;"&gt;&lt;em&gt;DECLARE @SECRET int exec usp_GetSecLabelID '&amp;lt;Label&amp;gt;&amp;lt;Cl&amp;gt;SECRET&amp;lt;/Cl&amp;gt;&amp;lt;/Label&amp;gt;', @SECRET OUTPUT&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #000080;"&gt;&lt;em&gt;INSERT INTO tblCustomer (Name, Phone, Email, RLS_ID) VALUES ('Catherine R. Abel (AdvWorks)', '(888) 555-4433', &lt;a href="mailto:'catherine0@adventure-works.com'"&gt;&lt;span style="color: #000080;"&gt;'catherine0@adventure-works.com'&lt;/span&gt;&lt;/a&gt;, @SECRET)&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Dessutom m&amp;aring;ste roller tilldelas till de olika anv&amp;auml;ndarna som t.ex. nedan.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #000080;"&gt;&lt;em&gt;exec sp_addrolemember 'clSECRET', 'Bob'&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Som sagt kommer vyer anv&amp;auml;ndas av anv&amp;auml;ndarna ist&amp;auml;llet f&amp;ouml;r direkt g&amp;aring; mot tabellerna. Nedan ser man ett typiskt exempel p&amp;aring; hur en vy ser ut.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #000080;"&gt;&lt;em&gt;CREATE VIEW Customer WITH ENCRYPTION, VIEW_METADATA AS&amp;nbsp;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #000080;"&gt;&lt;em&gt;SELECT tblCustomer.ID, Name, Phone, Email &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #000080;"&gt;&lt;em&gt;FROM tblCustomer WITH (READCOMMITTED) INNER JOIN vwVisibleLabels&amp;nbsp; ON tblCustomer.RLS_ID = vwVisibleLabels.ID&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #000080;"&gt;&lt;em&gt;GO&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Allt detta inneb&amp;auml;r i slut&amp;auml;ndan att anv&amp;auml;ndarna beroende p&amp;aring; sin beh&amp;ouml;righet f&amp;aring;r olika resultat p&amp;aring; denna fr&amp;aring;ga:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #000080;"&gt;&lt;em&gt;SELECT [Name], [Phone],[Email] FROM [dbo].[Customer]&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;En anv&amp;auml;ndare kan d&amp;aring; f&amp;aring; detta resultat: &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=f782470e-58c7-4175-b895-405792086706&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Medan en annan anv&amp;auml;ndare som har &amp;rdquo;mer&amp;rdquo; beh&amp;ouml;righet f&amp;aring;r detta resultat: &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=dc647e83-b41d-4782-8627-94c8242351d8&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Mer information hittar ni i denna artikel&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://technet.microsoft.com/en-us/library/cc966395.aspx"&gt;http://technet.microsoft.com/en-us/library/cc966395.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;SQL Server Label Security Toolkit hittar ni h&amp;auml;r.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;a href="http://sqlserverlst.codeplex.com/"&gt;http://sqlserverlst.codeplex.com/&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-08-29T04:53:27Z</a10:updated></item><item><guid isPermaLink="false">b49c1d78-4fd3-457f-b96b-f7f4c27de44f</guid><link>http://sqlservice.se/sv/start/blogg/viewing-the-output-of-any-sql-server-spid.aspx?lang=sv</link><title>Viewing the output of any SQL Server SPID</title><description>&lt;p&gt;When investigation problems whit SQL Server, we often use commands like DBCC INPUTBUFFER, or tools like SQL Server Profile to view the various commands that arrive to SQL Server, thereby finding useful information such as errors, duration, CPU usage, IO usage and so on.&lt;/p&gt;&#xD;
&lt;p&gt;But, what if you don't want to see what query the client sent to SQL Server but rather the result that SQL Server sent back to the client? That is not as easy as using Profiler, but can be done. Sort of.&lt;/p&gt;&#xD;
&lt;p&gt;The command to use is DBCC OUTPUTBUFFER (SPID ,[otional request id]) . Full documentation of this command is at &lt;a href="http://msdn.microsoft.com/en-us/library/ms189821.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms189821.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;The drawback is that you can only see the curent outputbuffer, not a continous stream as with Profiler for input. But if you know the SPID of the problematic connection/application you can atleast see what the last results or messages returned to it looks like.&lt;/p&gt;&#xD;
&lt;p&gt;And you could create a little loop like this to collect info for a little bit of time, and the view it.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;create table #tmp (output varchar(max))&lt;/p&gt;&#xD;
&lt;p&gt;declare @buf int=0&lt;/p&gt;&#xD;
&lt;p&gt;while @buf&amp;lt; 100&lt;/p&gt;&#xD;
&lt;p&gt;begin&lt;/p&gt;&#xD;
&lt;p&gt;insert into #tmp exec ('dbcc outputbuffer (83)')&lt;/p&gt;&#xD;
&lt;p&gt;select @buf = @buf +1&lt;/p&gt;&#xD;
&lt;p&gt;end&lt;/p&gt;&#xD;
&lt;p&gt;select * from #tmp&lt;/p&gt;&#xD;
&lt;p&gt;drop table #tmp&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-08-22T14:00:59Z</a10:updated></item><item><guid isPermaLink="false">504cec20-5d02-45da-a72e-7c20f2a91511</guid><link>http://sqlservice.se/sv/start/blogg/24-hours-of-pass--2012.aspx?lang=sv</link><title>24 Hours Of Pass - 2012</title><description>&lt;p&gt;Som vanligt finns m&amp;ouml;jlighet att f&amp;aring; ett smakprov p&amp;aring; n&amp;aring;gra av sessionerna som kommer under Pass Summit i Seattle&amp;nbsp;5-9 november. Detta sker om en m&amp;aring;nad, n&amp;auml;mligen 20/9 med start kl 14.00 d&amp;aring; man kan f&amp;ouml;lja 24 sessioner. F&amp;ouml;rst&amp;aring;s handlar det denna g&amp;aring;ng mycket om SQL Server 2012 och Azure, men &amp;auml;ven fels&amp;ouml;kning, exekveringsplaner och t.ex. "What are the Largest SQL Server Projects in the World?" kan man f&amp;ouml;lja under 24 timmar.&lt;/p&gt;&#xD;
&lt;p&gt;Regstreringen g&amp;ouml;r man h&amp;auml;r:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.sqlpass.org/24hours/fall2012/SessionsbySchedule.aspx"&gt;http://www.sqlpass.org/24hours/fall2012/SessionsbySchedule.aspx&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-08-20T09:06:25Z</a10:updated></item><item><guid isPermaLink="false">4d0c1251-d5de-4f40-be8c-917999c9ab8f</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-indexing-strategies-part-3--non-clustered-indexes.aspx?lang=sv</link><title>SQL server indexing strategies part 3 - non clustered indexes</title><description>&lt;p&gt;This is my third blog post about indexing strategies for SQL server and it has passed some time since the last one, but now it's time for the next.&lt;/p&gt;&#xD;
&lt;p&gt;In SQL server 2005, Microsoft implemented something called included columns, and although it's more than 7 years since SQL server 2005 was brought to life, I still get the questions:&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;What is an included column?&lt;/li&gt;&#xD;
&lt;li&gt;Why do I need included columns?&lt;/li&gt;&#xD;
&lt;li&gt;How should I use&amp;nbsp;included columns?&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;&amp;nbsp;I think it is time to repeat the answers and give some kind of explanation.&lt;/p&gt;&#xD;
&lt;p&gt;First of, lets explain the difference between the clustered and the non clustered index in a simple way. Think of a book with an index. The index of the book give you a structured way of finding the right page to read. A clustered index is like a book, you have the pages with all the information and you have an index pointing at the correct page.&lt;/p&gt;&#xD;
&lt;p&gt;You can seek the index to find the page or you can scan all the pages to get what you want, but you can only seek the index by the key columns. If you don't have any values to search for in the key columns, you have to scan the pages.&lt;/p&gt;&#xD;
&lt;p&gt;The non clustered index is more like a quick reference card where you have some other key columns in the index, but the non clustered index doesn't have the complete information in the pages. The pages in the non clustered index contains the clustered index keys AND the INCLUDED COLUMNS.&lt;/p&gt;&#xD;
&lt;p&gt;By searching the non clustered index, you'll only find the key words you need to search the clustered index to get the rest of the information.&lt;/p&gt;&#xD;
&lt;p&gt;Assume you want to get all columns for a customer record and the clustering key in the clustered index is a counter. You probably do not know the value of the counter for a specific record, but you know the customer name. To get some performance in the query you add non clustered index on customer name.&lt;/p&gt;&#xD;
&lt;p&gt;Let't take a look at some code:&lt;/p&gt;&#xD;
&lt;p&gt;CREATE &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;SCHEMA &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;SALES &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;CREATE &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;TABLE &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[Sales]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[Customer]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;( &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[ID] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[int] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;IDENTITY&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;) &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;NOT &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;NULL,&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[CustomerName] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[varchar]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;75&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;) &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;COLLATE &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Finnish_Swedish_CI_AS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;NOT &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;NULL, &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[CustomerGroup] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[int] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;NULL, &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[CustomerType] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[int] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;NULL, &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;CONSTRAINT &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;[PK_Customer] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;PRIMARY &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;KEY &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;CLUSTERED &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #000000; font-family: Verdana;"&gt;( &lt;/span&gt;[ID] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ASC &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;)) &lt;br /&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;CREATE&amp;nbsp;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;NONCLUSTERED &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;INDEX &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ix_Customer_AK &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ON &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Sales&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Customer &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;( &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;CustomerName &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;) &lt;br /&gt;GO &lt;br /&gt;INSERT&amp;nbsp;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;INTO &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Sales&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;CustomerName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;CustomerType&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;) &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;VALUES&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'H&amp;aring;kan Winther'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt; 1&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;),(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'SQL Service'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt; 2&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;-- First select &lt;br /&gt;SELECT&amp;nbsp;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;* &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;FROM &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Sales&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Customer &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;WHERE &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;CustomerName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'H&amp;aring;kan Winther'&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;DROP &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;INDEX &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ix_Customer_AK &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ON &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Sales&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Customer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;; &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;CREATE &lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;NONCLUSTERED &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;INDEX &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ix_Customer_AK &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;ON &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Sales&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Customer &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;( &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;CustomerName &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;)&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;INCLUDE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;CustomerType&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;) &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;-- second select &lt;br /&gt;SELECT &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ID&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;CustomerName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;CustomerType &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;FROM &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Sales&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Customer &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;WHERE &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;CustomerName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'H&amp;aring;kan Winther' &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;-- the third select &lt;br /&gt;SELECT &lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;ID&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;CustomerName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;CustomerType &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;FROM &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Sales&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;Customer &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-family: Consolas; font-size: x-small;"&gt;WHERE &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #008080; font-family: Consolas; font-size: x-small;"&gt;CustomerType&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;If you take a look at the actual execution plan you can see something interesting. The first select using select * cannot get all the information from the nonclusterd index and needs to go to the clustered index to get all columns. It can be done in tw ways, a clustered index scan or an index seek + a key lookup. Either way, this will not give you the best performance.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;In the second select you'll get all the columns you need from the nonclustered index as Clustering key (ID)&amp;nbsp;is&amp;nbsp;always included in all non clustered indexes&amp;nbsp;and CustomerType is specified in the include clause. In the execution plan, you'll find an index seek on the non clustered index. This is what's called covering index.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;As you can see in the third select, you'll get an index scan in the non clustered index as CustomerType is not one of the index keys, it's only included at the "page" level.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;You might ask yourself, why don't I use all columns as key columns in the index. Well there are some limitations, like you can't have more than 16 columns as key columns and you'll lose performance.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;h5&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&amp;gt;&amp;gt;Conclusion&amp;lt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;/h5&gt;&#xD;
&lt;h5&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;You need included columns to get the performance when you need to search on columns that is not part of the clustered index, by avoiding clustered index scans &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;and index seek + key lookup.&lt;/span&gt;&lt;/span&gt;&lt;/h5&gt;&#xD;
&lt;p&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;&lt;span style="font-family: Consolas; font-size: x-small;"&gt;Well, I hope you learned something from this blog post or that it was crystal clear from the beginning.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description><a10:updated>2012-08-16T14:55:24Z</a10:updated></item><item><guid isPermaLink="false">4529f316-f5c1-49b2-b6dd-9d7596b43b89</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-indexing-strategy-part1--general-recommendations.aspx?lang=sv</link><title>SQL server indexing strategy part1 - General recommendations</title><description>&lt;p&gt;When you design a database you should have performance in mind, and indexing strategy is one of the important things to consider. If you create too few or to many indexes you'll suffer from bad performance. If you don't have indexes to cover your queries, you'll have slow running queries, and if you have to many, your inserts, updates and deletes will be slow. You have to balance this and there are always tradeoffs and there are no simple answers that will work for everybody, but there are some guidelines you can follow.&lt;/p&gt;&#xD;
&lt;p&gt;In this series of blog posts I'll try to give you some of these guidelines.&lt;/p&gt;&#xD;
&lt;p&gt;- Don't create too many or too few.&lt;br /&gt;- Every table should have a clustered index! End of discussion! (some might say that small tables shouldn't have, but I'll cover that in a later post)&lt;br /&gt;- Choose the clustered index wisely, don't let SQL Server Management Studio to select it for you (by creating a primary key in the table designer.&lt;br /&gt;- Index columns that is used in a foreign key relation&lt;br /&gt;&lt;strong&gt;- Test you workload with your indexes&lt;br /&gt;&lt;/strong&gt;- Monitor your performance to find new indexes&lt;br /&gt;- Remove indexes that is not used&lt;br /&gt;- Don't create duplicate indexes&lt;br /&gt;- The column order in you index counts, if the first column in the index is not used in a where/join clause, you'll end up with a scan&lt;br /&gt;- Use the right fill factor for every index, don't count on the server default setting for fillfactor&lt;br /&gt;- Consider partitioning for performance and maintenance&lt;br /&gt;- Use data compression for datawarehouse/reporting databases.&lt;br /&gt;- Rebuild the indexes on a regular basis&lt;br /&gt;- Update the statistics of the indexes&lt;/p&gt;&#xD;
&lt;p&gt;Get back another day for more details on specific recommendations&lt;/p&gt;&#xD;
&lt;p&gt;If you have some questions, feel free to contact any of our SQL server consultants and we will help you.&lt;/p&gt;</description><a10:updated>2012-08-16T13:19:30Z</a10:updated></item><item><guid isPermaLink="false">6091fe37-0db5-4cb4-aa05-f6cd08a3f627</guid><link>http://sqlservice.se/sv/start/blogg/just-a-brief-demo-of-dynamic-use-of-offset-through-a-loop.aspx?lang=sv</link><title>Just a brief demo of dynamic use of OFFSET through a loop</title><description>&lt;table&gt;&#xD;
&lt;tbody&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;DECLARE&lt;/td&gt;&#xD;
&lt;td&gt;-- Let us declare variables:&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;&amp;nbsp;&amp;nbsp;@count int = 0,&lt;/td&gt;&#xD;
&lt;td&gt;-- Start&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;&amp;nbsp;&amp;nbsp;@to int,&lt;/td&gt;&#xD;
&lt;td&gt;-- End&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;&amp;nbsp;&amp;nbsp;@rows int = 10;&lt;/td&gt;&#xD;
&lt;td&gt;-- Rows per set&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;SELECT&lt;/td&gt;&#xD;
&lt;td&gt;-- Now we're gonna&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;&amp;nbsp;&amp;nbsp;@to = count(*) / @rows&lt;/td&gt;&#xD;
&lt;td&gt;-- determe the number of sets&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;FROM sys.columns&lt;/td&gt;&#xD;
&lt;td&gt;-- from this table&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;WHILE @count &amp;lt;= @to&lt;/td&gt;&#xD;
&lt;td&gt;-- This loops all through to the last set&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;BEGIN&lt;/td&gt;&#xD;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;&amp;nbsp;&amp;nbsp;SELECT&lt;/td&gt;&#xD;
&lt;td&gt;-- Returning these&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*&lt;/td&gt;&#xD;
&lt;td&gt;-- columns&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;&amp;nbsp;&amp;nbsp;FROM sys.columns&lt;/td&gt;&#xD;
&lt;td&gt;-- from this table&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;&amp;nbsp;&amp;nbsp;ORDER BY 1 ASC&lt;/td&gt;&#xD;
&lt;td&gt;-- in this order (here just based on first column).&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;&amp;nbsp;&amp;nbsp;OFFSET (0 + (@count * @rows))&lt;/td&gt;&#xD;
&lt;td&gt;-- Based on loop we get the starting point of the offset.&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;&amp;nbsp;&amp;nbsp;ROW FETCH NEXT (@rows) ROWS ONLY&lt;/td&gt;&#xD;
&lt;td&gt;-- The number of rows we're fetching!&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;&amp;nbsp;&amp;nbsp;SET @count += 1&lt;/td&gt;&#xD;
&lt;td&gt;-- Next step!&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;END&lt;/td&gt;&#xD;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;/tbody&gt;&#xD;
&lt;/table&gt;</description><a10:updated>2012-08-09T16:16:14Z</a10:updated></item><item><guid isPermaLink="false">e1133eee-d64c-4ae0-b495-8993532532fc</guid><link>http://sqlservice.se/sv/start/blogg/en-liten-pivot.aspx?lang=sv</link><title>En liten PIVOT</title><description>&lt;p&gt;&lt;strong&gt;Hej p&amp;aring; er,&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Nu n&amp;auml;r det g&amp;aring;tt en vecka t&amp;auml;nkte jag passa p&amp;aring; att presentera mig. Mattias Lind heter jag och b&amp;ouml;rjade den 1:a augusti h&amp;auml;r p&amp;aring; SQL Service. De senaste tio &amp;aring;ren har jag k&amp;ouml;rt som egenf&amp;ouml;retagare, min profil som talare, instrukt&amp;ouml;r, mentor och konsult g&amp;auml;ller fortfarande, dock numera som en i ett fantasktiskt team h&amp;auml;r hos SQL Service.&lt;/p&gt;&#xD;
&lt;p&gt;Sedan t&amp;auml;nkte jag ocks&amp;aring; dela med mig lite av mina erfarenheter i den h&amp;auml;r bloggen, min personliga blog &lt;a href="http://blog.mssqlserver.se/"&gt;http://blog.mssqlserver.se&lt;/a&gt; lever givetvis kvar &amp;auml;ven fast ocks&amp;aring; jag skriver h&amp;auml;r med j&amp;auml;mna mellanrum. Till att b&amp;ouml;rja med s&amp;aring; t&amp;auml;nkte jag visa er hur PIVOT kan fungera i verkligheten p&amp;aring; ett lite mer dynamiskt s&amp;auml;tt. Ofta n&amp;auml;r jag h&amp;aring;ller kurser f&amp;aring;r jag fr&amp;aring;gan hur jag skulle ha gjort, h&amp;auml;r kommer jag att skriva inl&amp;auml;gg som svar p&amp;aring; de fr&amp;aring;gorna.&lt;/p&gt;&#xD;
&lt;p&gt;Men innan vi b&amp;ouml;rjar beh&amp;ouml;ver vi lite data. Jag t&amp;auml;nkte att resultatet skulle vara en pivottabell &amp;ouml;ver v&amp;aring;ran databas server, d&amp;auml;r varje databas f&amp;aring;r en rad och typen av databasobjekt blir kolumner och antalet av de h&amp;auml;r objekten blir en summa. Med de f&amp;ouml;ruts&amp;auml;ttningarna skapar vi f&amp;ouml;rst en tabell som en variabel, d&amp;auml;refter fyller vi den tabellen med metadata med hj&amp;auml;lp av en cursor.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;-- F&amp;ouml;rst skapar vi en tabellvariabel samt deklarerar lite variabler vi beh&amp;ouml;ver&lt;/strong&gt;&lt;br /&gt;DECLARE @DatabaseObjects TABLE&lt;br /&gt;&amp;nbsp;&amp;nbsp;(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DatabaseName sysname,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ObjectType sysname,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ObjectName sysname&lt;br /&gt;&amp;nbsp; );&lt;br /&gt;DECLARE&lt;br /&gt;&amp;nbsp;&amp;nbsp;@DatabaseName sysname,&lt;br /&gt;&amp;nbsp;&amp;nbsp;@SQLStatement varchar(max),&lt;br /&gt;&amp;nbsp;&amp;nbsp;@ExecuteStatement varchar(max),&lt;br /&gt;&amp;nbsp;&amp;nbsp;@Columns varchar(max);&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;-- H&amp;auml;r b&amp;ouml;rjar laddningen av simulerat data&lt;/strong&gt;&lt;br /&gt;SET NOCOUNT ON;&lt;br /&gt;SET @SQLStatement = 'SELECT ''{DatabaseName}'' AS [DatabaseName], [type_desc] AS [ObjectType], [name] AS [ObjectName] FROM [{DatabaseName}].[sys].[objects];';&lt;br /&gt;DECLARE&lt;br /&gt;&amp;nbsp;&amp;nbsp;DatabaseCrawler CURSOR&lt;br /&gt;&amp;nbsp;&amp;nbsp;FOR SELECT Name FROM sys.Databases ORDER BY Name ASC;&lt;br /&gt;OPEN DatabaseCrawler;&lt;br /&gt;FETCH NEXT FROM DatabaseCrawler INTO @DatabaseName;&lt;br /&gt;WHILE @@FETCH_STATUS = 0&lt;br /&gt;BEGIN&lt;br /&gt;&amp;nbsp;&amp;nbsp;SET @ExecuteStatement = REPLACE(@SQLStatement, '{DatabaseName}', @DatabaseName);&lt;br /&gt;&amp;nbsp;&amp;nbsp;INSERT INTO @DatabaseObjects&lt;br /&gt;&amp;nbsp;&amp;nbsp;EXEC (@ExecuteStatement);&lt;br /&gt;&amp;nbsp;&amp;nbsp;FETCH NEXT FROM DatabaseCrawler INTO @DatabaseName;&lt;br /&gt;END;&lt;br /&gt;CLOSE DatabaseCrawler;&lt;br /&gt;DEALLOCATE DatabaseCrawler;&lt;br /&gt;SET NOCOUNT OFF;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;-- F&amp;ouml;rst skapar jag en tempor&amp;auml;r tabell eftersom tabellvariabeln inte kan n&amp;aring;s i kommande EXEC-uttryck&lt;/strong&gt;&lt;br /&gt;SELECT * INTO #DatabaseObjects FROM @DatabaseObjects&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;-- Sedan populerar jag en variabel med en kommaseparerad lista av unika objektstyper&lt;/strong&gt;&lt;br /&gt;SELECT @Columns = ISNULL(@Columns, '') + '[' + [Column] + '],' FROM (SELECT DISTINCT ObjectType AS [Column] FROM @DatabaseObjects) Columns&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;-- D&amp;auml;refter tar jag bort det avslutande kommatecknet i listan&lt;/strong&gt;&lt;br /&gt;SET @Columns = LEFT(@Columns, LEN(@Columns) - 1)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;-- SELECT-uttrycket med PIVOT-klausulen, {Columns} &amp;auml;r en platsh&amp;aring;llare. Den &amp;aring;terkommer tv&amp;aring; g&amp;aring;nger.&lt;/strong&gt;&lt;br /&gt;SET @SQLStatement = 'SELECT DatabaseName, {Columns} FROM #DatabaseObjects PIVOT (Count(ObjectName) FOR ObjectType IN ({Columns})) AS pvt'&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;-- Ers&amp;auml;tter platsh&amp;aring;llaren med inneh&amp;aring;llet i listan.&lt;/strong&gt;&lt;br /&gt;SET @ExecuteStatement = REPLACE(@SQLStatement, '{Columns}', @Columns);&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;-- Slutligen k&amp;ouml;r jag SQL-uttrycket och tar bort den tempor&amp;auml;ra tabellen&lt;/strong&gt;&lt;br /&gt;EXEC (@ExecuteStatement)&lt;br /&gt;DROP TABLE #DatabaseObjects&lt;br /&gt;&lt;br /&gt;S&amp;aring; varf&amp;ouml;r all denna kod f&amp;ouml;r att f&amp;aring; ut ett pivoterat resultat. Titta p&amp;aring; inneh&amp;aring;llet i variabeln &lt;strong&gt;@SQLStatement&lt;/strong&gt;.&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT DatabaseName, &lt;span style="background-color: #ffff99;"&gt;{Columns}&lt;/span&gt; FROM #DatabaseObjects&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PIVOT (Count(ObjectName) FOR ObjectType IN (&lt;span style="background-color: #ffff99;"&gt;{Columns}&lt;/span&gt;)) AS pvt&lt;/strong&gt;&lt;br /&gt;{Columns} &amp;auml;r listan &amp;ouml;ver kolumner, eftersom dessa h&amp;auml;mtas fr&amp;aring;n tabellen @DatabaseObjects och dess kolumn ObjectTypes.Om jag inte anv&amp;auml;nt det h&amp;auml;r skriptet hade jag s&amp;aring;ledes varit tvungen att skriva in kolumnnamnen manuellt. Nu anv&amp;auml;nder jag ist&amp;auml;llet REPLACE-funktionen f&amp;ouml;r att ers&amp;auml;tta {Columns} med en kommaseparerad lista i variabeln @Columns.&lt;/p&gt;</description><a10:updated>2012-08-08T16:49:07Z</a10:updated></item><item><guid isPermaLink="false">16183716-8a51-455f-b0f9-6620deca5b7a</guid><link>http://sqlservice.se/sv/start/blogg/sql-server--cast-string-into-date-vs-datetime.aspx?lang=sv</link><title>SQL Server - cast string into date vs datetime</title><description>&lt;p&gt;I found&amp;nbsp;a tricky question on &lt;a href="http://www.sqlservercentral.com/Questions"&gt;http://www.sqlservercentral.com/Questions&lt;/a&gt;&amp;nbsp;about casting strings into date vs datetime, and I want to share this with you, in case you missed it. (by the way, excellent site if you want to measure your knowledge and learn something new, thanks SQL server central)&lt;/p&gt;&#xD;
&lt;p&gt;Try the following code:&lt;/p&gt;&#xD;
&lt;p&gt;SET &lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;DATEFORMAT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; YDM&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;;&lt;br /&gt;&lt;/span&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;CREATE &lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;VIEW&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; vDate&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;dt1&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; dt2)&lt;br /&gt;&lt;/span&gt;AS&lt;br /&gt;SELECT &lt;span style="color: #ff00ff; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-size: x-small;"&gt;CAST&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-size: x-small;"&gt;'2012-04-10' &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;AS &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;DATETIME&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;),&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff00ff; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-size: x-small;"&gt;CAST&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-size: x-small;"&gt;'2012-04-10' &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;AS &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;DATE&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;)&lt;br /&gt;&lt;/span&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;SET &lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;DATEFORMAT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; YDM&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;;&lt;br /&gt;&lt;/span&gt;GO&lt;br /&gt;SELECT &lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;* &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;FROM&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; vDate &lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;WHERE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; dt1&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;dt2&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;SET &lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;DATEFORMAT&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; YMD&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;;&lt;br /&gt;&lt;/span&gt;GO&lt;br /&gt;SELECT &lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;* &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;FROM&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; vDate &lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;WHERE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; dt1&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;dt2&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;DROP VIEW vDate;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;It turns out that the two selects from the veiw doesn't return the same result! :) The string casted to datetime is depending on the regional setting but date is not. The date datatype is language neutral and will always be casted as yyyymmdd.&lt;/p&gt;&#xD;
&lt;p&gt;If you want to learn more about how date and datetime are handled by the sql server engine you can read more on Tibor Karaszi's blog &lt;a href="http://www.karaszi.com/SQLServer/info_datetime.asp"&gt;http://www.karaszi.com/SQLServer/info_datetime.asp&lt;/a&gt;&amp;nbsp;or contact any of our SQL server consultants.&lt;/p&gt;</description><a10:updated>2012-07-31T08:19:12Z</a10:updated></item><item><guid isPermaLink="false">77161c2d-cbac-4abd-ab5f-977ba23fc5c4</guid><link>http://sqlservice.se/sv/start/blogg/running-com-objects-outside-sql-server-process.aspx?lang=sv</link><title>Running COM objects outside SQL Server process</title><description>&lt;p&gt;In some cases, you can get an error 0x00000005 (Access Violation) in the SQL Server process, that is caused by running external COM objects via sp_OAcreate. The effect is that the entire SQL server process rolls over and dies immedeately.&lt;/p&gt;&#xD;
&lt;p&gt;This can be quite hard to solve without the help of Microsoft PSS, but there is one thing you can try that might help. When you call sp_OAcreate, use option 4, wich will spawn teh COM object in a process outside the SQL server process. If and when that process crashes, atleast it will not take down the entire SQL Server process with it.&lt;/p&gt;&#xD;
&lt;p&gt;Read more about sp_OAcreate at &lt;a href="http://msdn.microsoft.com/en-us/library/ms189763(v=sql.105).aspx"&gt;http://msdn.microsoft.com/en-us/library/ms189763(v=sql.105).aspx&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-07-31T07:42:05Z</a10:updated></item><item><guid isPermaLink="false">08083e0b-46cf-4d71-890b-33336f9e281e</guid><link>http://sqlservice.se/sv/start/blogg/microsoft-sommarkollo-2012--nyheterna-i-sql-server-2012.aspx?lang=sv</link><title>Microsoft Sommarkollo 2012 - Nyheterna i SQL server 2012</title><description>&lt;p&gt;F&amp;ouml;r er som missat min session p&amp;aring; Microsoft Sommarkollo 2012 - Nyheterna i SQL server 2012, eller f&amp;ouml;r er som vill g&amp;aring; igenom presentationen p&amp;aring; egen hand som finns den nu f&amp;ouml;r nedladdning. &lt;a href="../cd.axd?sid=b40a4073-8894-4349-8974-866343ba7a80"&gt;Sommarkollo2012_SQLserver2012.pptx&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Kommer inom kort &amp;auml;ven p&amp;aring; Microsofts hemsida.&lt;/p&gt;&#xD;
&lt;p&gt;Vill ni veta mer om SQL server 2012 s&amp;aring; f&amp;aring;r ni g&amp;auml;rna kontata n&amp;aring;gon av v&amp;aring;ra SQL server konsulter eller anm&amp;auml;la er till v&amp;aring;r kurs p&amp;aring; LabCenter.&lt;/p&gt;&#xD;
&lt;p&gt;/H&amp;aring;kan Winther&lt;/p&gt;</description><a10:updated>2012-07-30T09:06:33Z</a10:updated></item><item><guid isPermaLink="false">307de0d1-61f5-4fee-9ef9-296b9647a62f</guid><link>http://sqlservice.se/sv/start/blogg/ssrs-and-report-caching,-dynamic-refresh-for-data-warehouses.aspx?lang=sv</link><title>SSRS and report caching, dynamic refresh for Data Warehouses</title><description>&lt;p&gt;I have a Data Warehouse, in which the data is loaded once a day and during the rest of the time the data does not change. There are several heavy reports in SSRS used to cater data to the users, and it really saves the day to cache them. The performance improvement is great, but there is one problem. I do not know exactly when the data is coming, and I need to refresh the chached report dynamically.&lt;/p&gt;&#xD;
&lt;p&gt;In SSRS there are several options for re-loading the chache of the cached reports:&lt;/p&gt;&#xD;
&lt;p&gt;- Either after N minutes, or by a schedule.&lt;/p&gt;&#xD;
&lt;p&gt;As you can see, none of these options work for me, so I looked a bit in detail in what options I have to refresh the cache manually. How do I do that?:&lt;/p&gt;&#xD;
&lt;p&gt;- There is a stored procedure in the Report Server database called:&lt;/p&gt;&#xD;
&lt;p&gt;dbo.SetChacheOptions which takes 4 parameters.&lt;/p&gt;&#xD;
&lt;p&gt;CREATE PROCEDURE dbo.SetCacheOptions &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;@Path&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS NVARCHAR(425), &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;@CacheReport&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS BIT, &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;@ExpirationFlags&amp;nbsp; AS INT, &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;@CacheExpiration&amp;nbsp; AS INT=NULL&lt;/p&gt;&#xD;
&lt;p&gt;- The @Path is the path to the report. I.e. /TestFolder/Report1 . &lt;br /&gt;- The @CacheReport &amp;ndash; is used to flag whether the report is cached or not.&lt;br /&gt;- The @ExpirationFlags &amp;ndash; is the option which points out the expiration type. 1 means that the Report expiration is set to N minutes (defined by the user) and 2 means that the report will expire according to a schedule (also created by a user). &lt;br /&gt;- The @CacheExpiration &amp;ndash; is used if the @ExpirationFlags are set to 1, i.e. to set the time in which the report will expire. The value is in minutes.&lt;/p&gt;&#xD;
&lt;p&gt;So, this said, let&amp;rsquo;s give some examples:&lt;/p&gt;&#xD;
&lt;p&gt;-- Clear Cache EXEC dbo.SetCacheOptions '/TestFolder/Report1',0,1 &lt;br /&gt;-- Recreate the report cache EXEC dbo.SetCacheOptions '/TestFolder/Report1',1,1,1440&lt;/p&gt;&#xD;
&lt;p&gt;In the first example, I just force the report to discard the cache. In the second example I am setting the chache to expire in 24 hours. Here is the question, though:&lt;/p&gt;&#xD;
&lt;p&gt;- how do I refresh the cache only after the data has been loaded in my database, given that there is a 6 hour window in which the data is loaded and the times are different every day?&lt;/p&gt;&#xD;
&lt;p&gt;This is relatively easy: first of all, we do not have to flush the cache before reloading it. Every time we execute the caching of the report, it will refresh the cache automatically and recreate it. So, in my SSIS routine which I use to load the data, I have an extra step after the data is loaded to just create the report cache like this:&lt;/p&gt;&#xD;
&lt;p&gt;-- Recreate the report cache EXEC dbo.SetCacheOptions '/TestFolder/Report1',1,1,1560&lt;/p&gt;&#xD;
&lt;p&gt;I am setting the expiration to 26 hours, just to give some tolerance for the next data load. But this does not really matter, because during the next data load I will execute the cache refresh procedure again.&lt;/p&gt;&#xD;
&lt;p&gt;/Feodor Georgiev&lt;/p&gt;</description><a10:updated>2012-07-24T14:53:53Z</a10:updated></item><item><guid isPermaLink="false">901fb604-8110-46d2-8d24-460490da379e</guid><link>http://sqlservice.se/sv/start/blogg/logga-deadlocks.aspx?lang=sv</link><title>Logga deadlocks</title><description>&lt;p&gt;Om du misst&amp;auml;nker att du har problem med deadlocks &amp;auml;r det n&amp;aring;got du b&amp;ouml;r ta tag i s&amp;aring; snabbt som m&amp;ouml;jligt!&lt;/p&gt;&#xD;
&lt;p&gt;N&amp;auml;r du v&amp;auml;l konstaterat att du faktiskt har deadlocks blir n&amp;auml;sta steg att ta reda p&amp;aring; mera detaljer kring dessa. Mer specifikt s&amp;aring; vill du naturligtvis veta vilken kod som &amp;auml;r orsaken och vilka tabeller som &amp;auml;r inblandade.&lt;/p&gt;&#xD;
&lt;p&gt;En variant f&amp;ouml;r att ta reda p&amp;aring; mer &amp;auml;r att starta en trace och l&amp;auml;gga till f&amp;ouml;ljande events:&lt;br /&gt;Deadlock graph&lt;br /&gt;Lock:Deadlock&lt;br /&gt;Lock:Deadlock Chain&lt;/p&gt;&#xD;
&lt;p&gt;Som vi alla redan k&amp;auml;nner till s&amp;aring; f&amp;aring;r vi med dessa events en grafisk bild &amp;ouml;ver eventuella deadlocks vilket kan vara bra hj&amp;auml;lp n&amp;auml;r man f&amp;ouml;rs&amp;ouml;ker ringa in problemet.&lt;/p&gt;&#xD;
&lt;p&gt;Jag t&amp;auml;nkte h&amp;auml;r ist&amp;auml;llet sl&amp;aring; ett slag f&amp;ouml;r en annan variant och det &amp;auml;r att starta traceflagga 1204 eller 1222. Dessa loggar all info kring deadlocks i SQL Server loggen. Man kan v&amp;auml;lja att enabla b&amp;aring;da flaggorna eller bara en av dem om man vill. B&amp;aring;da levererar lite olika, men n&amp;ouml;dv&amp;auml;ndig, information f&amp;ouml;r att fels&amp;ouml;ka deadlocks.&lt;/p&gt;&#xD;
&lt;p&gt;Vi kan tex ur loggen utl&amp;auml;sa&amp;nbsp;vilken process som&amp;nbsp;&amp;auml;r "deadlock victim", vilken kod som k&amp;ouml;rts av b&amp;aring;da parter i l&amp;aring;sningen, vilken isolationsniv&amp;aring; vi hade mm.&lt;/p&gt;&#xD;
&lt;p&gt;Personligen f&amp;ouml;redrar jag denna framf&amp;ouml;r den grafiska presentationen i Profiler n&amp;auml;r det g&amp;auml;ller att snabbt sp&amp;aring;ra deadlocks, dessutom beh&amp;ouml;ver jag inte starta och bevaka en trace utan kan i efterhand titta i loggen.&lt;/p&gt;&#xD;
&lt;p&gt;Dessa traceflaggor m&amp;aring;ste aktiveras p&amp;aring; global niv&amp;aring; EX:&lt;/p&gt;&#xD;
&lt;p&gt;DBCC TRACEON(1222, -1), alternativt l&amp;auml;gga till T1222 som en startup parameter f&amp;ouml;r att s&amp;auml;kerst&amp;auml;lla att loggning forts&amp;auml;tter &amp;auml;ven efter en omstart av SQL Server.&lt;/p&gt;&#xD;
&lt;p&gt;F&amp;ouml;r en mer ing&amp;aring;ende f&amp;ouml;rklaring av de olika alternativen:&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms178104(SQL.105).aspx"&gt;http://msdn.microsoft.com/en-us/library/ms178104(SQL.105).aspx&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-07-20T15:55:29Z</a10:updated></item><item><guid isPermaLink="false">e85e6df7-21ec-4331-b335-2a22c73aa054</guid><link>http://sqlservice.se/sv/start/blogg/check-your-constraints.aspx?lang=sv</link><title>Check your constraints</title><description>&lt;p&gt;Sometimes you need to quickly import or delete large amounts of data. One way to make this quicker or easier is to disable all constraints, foreign keys and check constraints.&lt;/p&gt;&#xD;
&lt;p&gt;The following command will disable all constraints on a table:&lt;br /&gt;ALTER TABLE [TableName] NOCHECK CONSTRAINT ALL;&lt;/p&gt;&#xD;
&lt;p&gt;Once data is imported you need to make sure the new data is valid according to the declarative rules in the database. &lt;br /&gt;The following will enable all constraints on a table:&lt;/p&gt;&#xD;
&lt;p&gt;ALTER TABLE [TableName] CHECK CONSTRAINT ALL;&lt;/p&gt;&#xD;
&lt;p&gt;But wait! This command will only make sure new data is checked not the existing data!&lt;br /&gt;To check already inserted data run the following:&lt;/p&gt;&#xD;
&lt;p&gt;ALTER TABLE [TableName] WITH CHECK CHECK CONSTRAINT ALL;&lt;/p&gt;&#xD;
&lt;p&gt;If you don't check existing data SQL Server will mark the constraint as not trusted and as a result of this it won't be able&lt;br /&gt;to use the constraint to make a more efficient query plan.&lt;/p&gt;&#xD;
&lt;p&gt;If you want to list all check constraints and foreign key constraints that are not trusted you can query&lt;br /&gt;sys.check_constraints and sys.foreign_keys views where is_not_trusted = 1.&lt;/p&gt;&#xD;
&lt;p&gt;SELECT * FROM sys.foreign_keys WHERE is_not_trusted = 1;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;br /&gt;Bottom line: Make sure all your constraints are checked and trusted.&lt;/p&gt;</description><a10:updated>2012-07-20T15:55:04Z</a10:updated></item><item><guid isPermaLink="false">692eb82c-5fe1-4cf4-8c01-b7e4552af728</guid><link>http://sqlservice.se/sv/start/blogg/get-cpu-utilization-by-database.aspx?lang=sv</link><title>Get CPU utilization by database</title><description>&lt;p&gt;N&amp;auml;r man analyserar och fels&amp;ouml;ker en server som inneh&amp;aring;ller flera databaser &amp;auml;r det v&amp;auml;ldigt intressant att veta vilken av dessa databaser som f&amp;ouml;rbrukar mest CPU resurser. D&amp;aring; anv&amp;auml;nder man som reglel dmv'en&lt;strong&gt; dm_exec_query_stats&lt;/strong&gt;. Problemet med informationen som d&amp;aring; f&amp;aring;r &amp;auml;r att den &amp;auml;r ackumelerad sedan SQL Servern startades om. Ofta vill man ist&amp;auml;llet se nul&amp;auml;get och d&amp;aring; kan man anv&amp;auml;nda nedanst&amp;aring;ende SQL som h&amp;auml;rst&amp;auml;mmar fr&amp;aring;n ett av Glen Berrys skript. Helt enkelt sparar man resultatet i en temptabell, v&amp;auml;ntar en tid t.ex. 1 minut, sparar resultatet i en ny temptabell och sedan j&amp;auml;mf&amp;ouml;r dessa v&amp;auml;rden, ist&amp;auml;llet f&amp;ouml;r att bara presentera utnyttjandet sedan servern startades om. Nedan f&amp;aring;r man b&amp;aring;da dessa v&amp;auml;rden i procent som ger en b&amp;auml;ttre bild av verkligheten just nu.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;-- Get CPU utilization by database&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;WITH DB_CPU_Stats AS (SELECT DatabaseID, DB_Name(DatabaseID) AS [DatabaseName], SUM(total_worker_time) AS [CPU_Time_Ms] &amp;nbsp;FROM sys.dm_exec_query_stats AS qs &amp;nbsp;CROSS APPLY (SELECT CONVERT(int, value) AS [DatabaseID] &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; FROM sys.dm_exec_plan_attributes(qs.plan_handle) &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; WHERE attribute = N'dbid') AS F_DB &amp;nbsp;GROUP BY DatabaseID) SELECT ROW_NUMBER() OVER(ORDER BY [CPU_Time_Ms] DESC) AS [row_num], &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DatabaseName, [CPU_Time_Ms], &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CAST([CPU_Time_Ms] * 1.0 / SUM([CPU_Time_Ms]) OVER() * 100.0 AS DECIMAL(5, 2)) AS [CPUPercent] INTO #tmpDB_CPU_Stats_1 FROM DB_CPU_Stats WHERE DatabaseID &amp;gt; 4 -- system databases AND DatabaseID &amp;lt;&amp;gt; 32767 -- ResourceDB ORDER BY row_num OPTION (RECOMPILE);&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;WAITFOR DELAY '00:01:00';&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;WITH DB_CPU_Stats AS (SELECT DatabaseID, DB_Name(DatabaseID) AS [DatabaseName], SUM(total_worker_time) AS [CPU_Time_Ms] &amp;nbsp;FROM sys.dm_exec_query_stats AS qs &amp;nbsp;CROSS APPLY (SELECT CONVERT(int, value) AS [DatabaseID] &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; FROM sys.dm_exec_plan_attributes(qs.plan_handle) &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; WHERE attribute = N'dbid') AS F_DB &amp;nbsp;GROUP BY DatabaseID) SELECT ROW_NUMBER() OVER(ORDER BY [CPU_Time_Ms] DESC) AS [row_num], &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DatabaseName, [CPU_Time_Ms], &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CAST([CPU_Time_Ms] * 1.0 / SUM([CPU_Time_Ms]) OVER() * 100.0 AS DECIMAL(5, 2)) AS [CPUPercent] INTO #tmpDB_CPU_Stats_2 FROM DB_CPU_Stats WHERE DatabaseID &amp;gt; 4 -- system databases AND DatabaseID &amp;lt;&amp;gt; 32767 -- ResourceDB ORDER BY row_num OPTION (RECOMPILE);&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;SELECT &amp;nbsp;#tmpDB_CPU_Stats_1.DatabaseName, &amp;nbsp;#tmpDB_CPU_Stats_1.CPUPercent,&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;&amp;nbsp;CAST((#tmpDB_CPU_Stats_2.CPU_Time_Ms - #tmpDB_CPU_Stats_1.CPU_Time_Ms) * 1.0 / SUM((#tmpDB_CPU_Stats_2.CPU_Time_Ms - #tmpDB_CPU_Stats_1.CPU_Time_Ms)) OVER() * 100.0 AS DECIMAL(5, 2)) AS [Current_CPUPercent] FROM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;#tmpDB_CPU_Stats_1 INNER JOIN &amp;nbsp;#tmpDB_CPU_Stats_2 ON #tmpDB_CPU_Stats_1.DatabaseName = #tmpDB_CPU_Stats_2.DatabaseName ORDER BY #tmpDB_CPU_Stats_2.CPU_Time_Ms - #tmpDB_CPU_Stats_1.CPU_Time_Ms DESC&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;DROP TABLE #tmpDB_CPU_Stats_1 DROP TABLE #tmpDB_CPU_Stats_2&lt;/em&gt;&lt;/p&gt;</description><a10:updated>2012-07-20T15:54:48Z</a10:updated></item><item><guid isPermaLink="false">c231ffa1-85c0-4d84-b9a9-05ec339659de</guid><link>http://sqlservice.se/sv/start/blogg/sqlug-se-challenge-2012-avgjord.aspx?lang=sv</link><title>SQLug.se challenge 2012 avgjord</title><description>&lt;p&gt;Grattis s&amp;auml;ger vi och lyfter p&amp;aring; hatten p&amp;aring; f&amp;ouml;r v&amp;aring;r &lt;a href="http://www.sqlservice.se/sv/start/blogg.aspx?category=b3271dca-3ff7-4e77-9bc3-d08bbde2504d"&gt;g&amp;auml;stbloggare&lt;/a&gt; Christian Janssen som nu ocks&amp;aring; kan titulera sig Svenska M&amp;auml;stare i&amp;nbsp;SQL Server utveckling. F&amp;ouml;rutom Christian placerar sig Steinar p&amp;aring; 4:e plats, Martin p&amp;aring; 8:e och H&amp;aring;kan p&amp;aring; 11:e plats. Grattis till er alla.&lt;/p&gt;&#xD;
&lt;p&gt;Hela resultatlistan hittar ni h&amp;auml;r.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.sqlug.se/Forum/tabid/80/forumid/22/threadid/803/scope/posts/threadpage/4/language/sv-SE/Default.aspx"&gt;http://www.sqlug.se/Forum/tabid/80/forumid/22/threadid/803/scope/posts/threadpage/4/language/sv-SE/Default.aspx&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-07-20T15:54:25Z</a10:updated></item><item><guid isPermaLink="false">e1efe38a-0fa9-4935-8bd8-7606f7382715</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-performance-with-dynamics-axapta.aspx?lang=sv</link><title>SQL Server performance with Dynamics Axapta</title><description>&lt;p&gt;The last couple of years I have spent a lot of time of and on tuning SQL Server performance in combination with Dynamics Axapta. There are some good blogs on this topic out on the internet, such as this one &lt;a href="http://blogs.msdn.com/b/axinthefield/archive/2010/11/04/sql-server-trace-flags-for-dynamics-ax.aspx"&gt;http://blogs.msdn.com/b/axinthefield/archive/2010/11/04/sql-server-trace-flags-for-dynamics-ax.aspx&lt;/a&gt; and this one &lt;a href="http://sqlcat.com/sqlcat/b/top10lists/archive/2010/05/20/top-tips-for-maximizing-the-performance-amp-scalability-of-dynamics-ax-2009-systems-on-sql-server-2008.aspx"&gt;http://sqlcat.com/sqlcat/b/top10lists/archive/2010/05/20/top-tips-for-maximizing-the-performance-amp-scalability-of-dynamics-ax-2009-systems-on-sql-server-2008.aspx&lt;/a&gt; for example. In this short blog I will summarize a litte bit, and also add my own thoughts and findings on some subjects. Please remember to always test these suggestions first, and that the tips&amp;nbsp;might&amp;nbsp;pre-req good knowledge in SQL Server to make sense in some cases!&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Trace Flags&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;You should consider using the following trace flags in SQL Server in conjunction with Axapta: 1117, 1118, 4136 and 845 (On SQL Standard edition)&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Indexes&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;You will need more than the standard indexes. And thy must be created from within AX. However AX does not generally support all SQL Server index options. The trick then is to CREATE the index from AX, then ALTER it from SQL to suit your needs. Rebuild your indexes when needed. Ola Hallngrens scripts at &lt;a href="http://ola.hallengren.com"&gt;http://ola.hallengren.com&lt;/a&gt; are a very good place to start&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Statistics&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Some tables might need their statistics to be updated several times a day. If you experience declining performance, worse the longer time runs from your UPDATE STATISTICS job, you might have this problem. In addition, some tables needs to have their statistics updated WITH SAMPLE 40 PERCENT or higher Leave AUTO CREATE STATS and AUTO UPDATE STATS on on your AX database&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Query Plans&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Beware of problems with OPTION (FAST 1) wich exists in several places. Use Plan Guides to control this from the SQL side if needed. But the best is if you can get the AX developers to fix it on the application side. Parametersniffing is a big issue, especially if you have several companies in the same database, with uneven amounts of data. Trace Flag 4136 can help.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Other&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Set Max Degree Of Parallellism to 1 Configure Tempdb to use the same number of files as the number of cores in your SQL Server machine. Set the files to the same size, and settings Make sure you limit SQL Server memory usage, so that enough memory is left for Windows, Monitoring, Backups etc. If you run clustered SQL Server, consider using SQL Server 2012, and place Tempdb on local SSD disks, as AX tends to use Tempdb a lot Beware of blocking that can go on for a long time. You might need block monitoring. Orphaned sessions can happen, even if you kill a session in AX, it might not kill the corresponding SPID in SQL Server. Also see blocking above.&lt;/p&gt;&#xD;
&lt;p&gt;And of course, you can always &lt;a href="../sv/start/kontakta-oss.aspx"&gt;contact us&lt;/a&gt; if you need further help!&lt;/p&gt;</description><a10:updated>2012-07-20T15:53:59Z</a10:updated></item><item><guid isPermaLink="false">9d8abcb6-7d73-4454-86ca-8f3f2f0d3186</guid><link>http://sqlservice.se/sv/start/blogg/pass-summit-2012--preconference-sessions.aspx?lang=sv</link><title>PASS Summit 2012 - Pre-Conference Sessions </title><description>&lt;p&gt;Som vi skrivit tidigare kommer PASS Summit &amp;auml;ven i &amp;aring;r h&amp;aring;llas i Seattle mellan 5-9 november. De tv&amp;aring; f&amp;ouml;rsta dagarna, m&amp;aring;ndag och tisdag finns d&amp;aring; m&amp;ouml;jlighet till att g&amp;aring; p&amp;aring; heldagssessioner. Vilka sessioner som finns att v&amp;auml;lja de olika dagarna &amp;auml;r nu tillg&amp;auml;ngligt.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.sqlpass.org/summit/2012/Sessions/PreConferenceSessions.aspx"&gt;Pre-Conference Sessions &lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Alla &amp;ouml;vriga sessioner hittar man h&amp;auml;r:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.sqlpass.org/summit/2012/Sessions/ConferenceSessions.aspx"&gt;Conference Sessions&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T15:53:19Z</a10:updated></item><item><guid isPermaLink="false">91086a8e-b27c-45a7-851f-23a548c2e022</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-2012--different-database-collation.aspx?lang=sv</link><title>SQL server 2012 - different database collation</title><description>&lt;p&gt;A common problem with SQL server consolidation is different default collations between databases and the server default collation. The problem occurs with tempdb that will get the server default collation and when you create a temporary table that you use to compare or join to another database table, you&amp;rsquo;ll get an exception. In SQL server 2012 you can create a partial contained database, and by using contained databases you&amp;rsquo;ll inherit the database default collation when creating the temporary table. This will solved the issue with the exception.&lt;/p&gt;&#xD;
&lt;p&gt;This new feature will save you money, as you can put databases with different collations on the same instance and reduce the number of instances needed. Try the following script:&lt;/p&gt;&#xD;
&lt;p&gt;USE MASTER;&lt;/p&gt;&#xD;
&lt;p&gt;GO&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;CREATE DATABASE [Sommarkollo2012] CONTAINMENT = PARTIAL&amp;nbsp;ON&amp;nbsp; PRIMARY&lt;br /&gt;( NAME = N'Sommarkollo2012', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012\MSSQL\DATA\Sommarkollo2012.mdf' , SIZE = 5120KB , FILEGROWTH = 1024KB )&lt;br /&gt;LOG ON&lt;br /&gt;( NAME = N'Sommarkollo2012_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012\MSSQL\DATA\Sommarkollo2012_log.ldf' , SIZE = 2048KB , FILEGROWTH = 10%)&lt;br /&gt;COLLATE Finnish_Swedish_CS_AI&lt;br /&gt;GO&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;SELECT&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; serverCollation=SERVERPROPERTY('collation'),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sommarKollorCollation = DATABASEPROPERTYEX('SommarKollo2012','collation'),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tempdbCollation=DATABASEPROPERTYEX('tempdb','collation');&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;USE SommarKollo2012;&lt;br /&gt;GO&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;CREATE TABLE CollationTest&lt;br /&gt;(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I INT NOT NULL IDENTITY(1,1),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A VARCHAR(50) NOT NULL&lt;br /&gt;);&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;CREATE TABLE #CollationTest&lt;br /&gt;(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I INT NOT NULL IDENTITY(1,1),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A VARCHAR(50) NOT NULL&lt;br /&gt;);&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;INSERT INTO CollationTest (A) VALUES('H&amp;aring;kan Winther');&lt;br /&gt;INSERT INTO #CollationTest (A) VALUES('H&amp;aring;kan Winther');&lt;/p&gt;&#xD;
&lt;p&gt;SELECT A FROM CollationTest&lt;br /&gt;INTERSECT&lt;br /&gt;SELECT A FROM #CollationTest;&lt;/p&gt;&#xD;
&lt;p&gt;GO&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;BEGIN TRY&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DROP TABLE #CollationTest;&lt;br /&gt;END TRY&lt;br /&gt;BEGIN CATCH&lt;br /&gt;END CATCH&lt;br /&gt;GO&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;USE master;&lt;br /&gt;GO&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;DROP DATABASE [Sommarkollo2012];&lt;br /&gt;GO&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;If you change the containment to none, the exception will occur.&lt;/p&gt;&#xD;
&lt;p&gt;If you have any questions regarding SQL server 2012 and collations, feel free to call us and one of our SQL server experts will help you.&lt;/p&gt;&#xD;
&lt;p&gt;/H&amp;aring;kan Winther&lt;/p&gt;</description><a10:updated>2012-07-20T15:52:45Z</a10:updated></item><item><guid isPermaLink="false">211a16df-e171-4629-a117-9b8db2410ec4</guid><link>http://sqlservice.se/sv/start/blogg/microsoft-sommarkollo-2012.aspx?lang=sv</link><title>Microsoft Sommarkollo 2012</title><description>&lt;p&gt;Denna vecka &amp;auml;r SQL Service p&amp;aring; turne med Microsoft Sommarkollo, d&amp;auml;r vi pratar oss varma om SQL Server 2012!&lt;/p&gt;&#xD;
&lt;p&gt;H&amp;aring;kan h&amp;aring;ller en session om nyheterna p&amp;aring; utvecklar och BI sidan, och Steinar pratar om nyheterna p&amp;aring; DBA sidan, bland annat AlwaysOn Availability Groups. Du tr&amp;auml;ffar oss 26/6 i Stockholm, 27/6 i G&amp;ouml;teborg och 28/6 i Helsingborg, vi ses d&amp;auml;r!&lt;/p&gt;&#xD;
&lt;p&gt;Mer info om Sommarkollo finns p&amp;aring; &lt;a href="http://www.microsoft.com/sv-se/sommarkollo/"&gt;http://www.microsoft.com/sv-se/sommarkollo/&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-07-20T15:52:15Z</a10:updated></item><item><guid isPermaLink="false">c3b41328-59cc-4ad7-9884-90a8ce610d24</guid><link>http://sqlservice.se/sv/start/blogg/behind-the-scenes-of-creating-optimized-productivity.aspx?lang=sv</link><title>Behind the Scenes of Creating Optimized Productivity</title><description>&lt;p&gt;I den elfe episoden av "The Fantastic 12 of SQL Server 2012" kan vi h&amp;ouml;ra och se Tobias Thernstr&amp;ouml;m n&amp;auml;r han ber&amp;auml;ttar om "SQL Generator" som &amp;auml;r en nyhet i SQL Server 2012 och exempel p&amp;aring; hur man kan ta nytta av den.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://blogs.technet.com/b/dataplatforminsider/archive/2012/06/21/the-fantastic-12-of-2012-behind-the-scenes-of-creating-optimized-productivity.aspx"&gt;http://blogs.technet.com/b/dataplatforminsider/archive/2012/06/21/the-fantastic-12-of-2012-behind-the-scenes-of-creating-optimized-productivity.aspx&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Alla avsnitt i "The Fantastic 12 of SQL Server 2012: Behind the Scenes" hittar man &lt;a href="http://www.youtube.com/playlist?list=PLE8BF101A8A2D9B34"&gt;h&amp;auml;r&lt;/a&gt;.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T15:51:51Z</a10:updated></item><item><guid isPermaLink="false">24dd4da0-3f52-4b65-9009-b7f29b5c9410</guid><link>http://sqlservice.se/sv/start/blogg/ny-uppdatering-for-sql-server-2012.aspx?lang=sv</link><title>Ny uppdatering för SQL Server 2012</title><description>&lt;p&gt;Den andra uppdateringen av SQL Server 2012 &amp;auml;r nu tillg&amp;auml;nglig i och med att den att den kumulativa uppdateringen nr 2 har sl&amp;auml;ppts med r&amp;auml;tt m&amp;aring;nga f&amp;ouml;rb&amp;auml;ttringar. Det troliga &amp;auml;r v&amp;auml;l ocks&amp;aring; att nya uppdateringar kommer komma ganska ofta nu som det ocks&amp;aring; har gjort tidigare vid nya versioner.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Som vanligt g&amp;auml;ller det att alltid testa innan man g&amp;ouml;r f&amp;ouml;r&amp;auml;ndringar i produktionsmilj&amp;ouml;n, dock b&amp;ouml;r man alltid kontrollera de f&amp;ouml;rb&amp;auml;ttringar som kommer och d&amp;auml;refter avg&amp;ouml;ra om man skall uppdatera.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2703275"&gt;Cumulative update package 2 for SQL Server 2012&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T15:50:55Z</a10:updated></item><item><guid isPermaLink="false">8c4f8b74-9cca-430c-a2cb-d3bd64e5fef3</guid><link>http://sqlservice.se/sv/start/blogg/pass-summit-2012.aspx?lang=sv</link><title>PASS Summit 2012</title><description>&lt;p&gt;Helt traditionsenligt kommer PASS Summit &amp;auml;ven i &amp;aring;r h&amp;aring;llas i Seattle mellan 5-9 november. De tv&amp;aring; f&amp;ouml;rsta dagarna, m&amp;aring;ndag och tisdag finns d&amp;aring; m&amp;ouml;jlighet till att g&amp;aring; p&amp;aring; heldagssessioner. F&amp;ouml;r dessa kommer man kunna anm&amp;auml;la och boka in sig sista veckan i juni. Dock kan man redan nu se vilka sessioner som finns att v&amp;auml;lja bland. Det samma g&amp;auml;ller faktiskt de &amp;ouml;vriga sessionerna d&amp;auml;r 138 redan finns tillg&amp;auml;ngliga och flera l&amp;auml;r det bli. &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Allt detta hittar&amp;nbsp;man h&amp;auml;r : &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.sqlpass.org/summit/2012/Sessions/PreConferenceSessions.aspx"&gt;Pre-Conference Sessions&lt;br /&gt;&lt;/a&gt;&lt;a href="http://www.sqlpass.org/summit/2012/Sessions/ConferenceSessions.aspx"&gt;Conference Sessions&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Att t&amp;auml;nka p&amp;aring; &amp;auml;r att anm&amp;auml;lniongsavgifterna stiger efter 30/6.&lt;/p&gt;</description><a10:updated>2012-07-20T15:50:34Z</a10:updated></item><item><guid isPermaLink="false">5c1ef019-eafd-454b-b9c3-e761de0bbaee</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-mystery-hekaton-tables-and-hekaton-procedures.aspx?lang=sv</link><title>SQL Server mystery: Hekaton tables and Hekaton Procedures</title><description>&lt;p&gt;Have you ever heard of Hekaton Tables and Hekaton Procedures in SQL Server? Neither had I until recently. And it seems neither have Google. I happened to stumble upon the mention of these mysterious object, and tried to find out more, but had no luck. But I wanted to share what I have seen of is so far, and ask you, the readers of our blog, if you might have some light to shed on this? If so, please comment on this blogpost.&lt;/p&gt;&#xD;
&lt;p&gt;To find the mention of Hekaton on your own SQL Server instance, run the following code:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;select * from syscomments where text like '%hekaton%'&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;That should generate an output that indicates that sp_updatestats, sp_createstats and sp_recompile contains the word Hekaton.&lt;/p&gt;&#xD;
&lt;p&gt;The relevant lines of code are as follows:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;from "sp_helptext sp_createstats":&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;strong&gt;&amp;nbsp;-- filter out local temp tables, Hekaton tables, and tables for which current user has no permissions&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;-- Note that OBJECTPROPERTY returns NULL on type="IT" tables, thus we only call it on type='U' tables&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (@@fetch_status &amp;lt;&amp;gt; -2) and&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (substring(@tablename, 1, 1) &amp;lt;&amp;gt; '#') and -- temp tables&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((@table_type&amp;lt;&amp;gt;'U') or (0 = OBJECTPROPERTY(@table_id, 'TableIsInMemory'))) and -- Hekaton table&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;from "sp_helptext sp_updatestats"&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong&gt;-- filter out local temp tables and Hekaton tables&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;-- Note that OBJECTPROPERTY returns NULL on type="IT" tables, thus we only call it on type='U' tables&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if ((@@fetch_status &amp;lt;&amp;gt; -2) and&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (substring(@table_name, 1, 1) &amp;lt;&amp;gt; '#') and&amp;nbsp;&amp;nbsp;-- temp tables&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((@table_type&amp;lt;&amp;gt;'U') or (0 = OBJECTPROPERTY(@table_id, 'TableIsInMemory'))))&amp;nbsp;-- Hekaton tables&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;from "sp_helptext sp_recompile"&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;strong&gt;&amp;nbsp;-- Hekaton procedure cannot be recompiled&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;-- Make them go through schema version bumping branch, which will fail&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;ObjectProperty(@objid, 'ExecIsCompiledProc') = 0)&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;None of that really tells us exactly what Hekaton tables and Hekaton procedures are, but might give some clues. The undocumented OBJECTPROPERTY(@table_id, 'TableIsInMemory') call (another mystery...) seems to indicate that it could possibly be connected to memory, caching or even the old and removed feature of DBCC PINTABLE? That would be a real surprise in that case.&lt;/p&gt;&#xD;
&lt;p&gt;The comments tells us the following: Hekaton Procedures cannot be recompiled using sp_recompile Hekaton tables can not update or create stats using sp_updatestats and sp_createstats&lt;/p&gt;&#xD;
&lt;p&gt;I know that this is not much, but if you have more information about this little mystery, please comment it on this blogpost or mail me at &lt;a href="mailto:firstname.lastname@sqlservice.se"&gt;firstname.lastname@sqlservice.se&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T15:49:47Z</a10:updated></item><item><guid isPermaLink="false">0e3ed083-7ac6-48a2-ade2-21de8e86a510</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-2012-certifiering.aspx?lang=sv</link><title>SQL server 2012 certifiering</title><description>&lt;p&gt;Nu har certifieringarna till SQL server 2012 kommit. Certifieringarna kan du g&amp;ouml;ra hos bland annat &lt;a href="http://www.addskills.se/Nyheter--Press/Aktuellt/Nu-kan-du-certifiera-dig-i-SQL-Server-2012/?cmpe=mail-SQLUG120611&amp;amp;anp_mid=3723480&amp;amp;anp_rid=221148715" target="_blank"&gt;AddSkills&lt;/a&gt;&amp;nbsp;och &lt;a href="http://www.informator.se/sql_server.aspx" target="_blank"&gt;Informator&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Vill du l&amp;auml;ra dig mer om &lt;a href="http://www.microsoft.com/sqlserver/en/us/default.aspx" target="_blank"&gt;SQL server 2012&lt;/a&gt; s&amp;aring; kan du g&amp;aring; en 2 eller 3 dagars kurs hos &lt;a href="http://www.labcenter.se" target="_blank"&gt;Labcenter&lt;/a&gt; som h&amp;aring;lls av v&amp;aring;ra SQL server konsulter.&lt;/p&gt;</description><a10:updated>2012-07-20T15:48:51Z</a10:updated></item><item><guid isPermaLink="false">560a7535-1b05-4905-a9d6-d7c50e06f768</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-indexing-strategies-part-2--clustered-index.aspx?lang=sv</link><title>SQL Server Indexing strategies part 2 - clustered index</title><description>&lt;p&gt;Indexing strategy&lt;/p&gt;&#xD;
&lt;p&gt;There are some different types of indexes in SQL server:&lt;/p&gt;&#xD;
&lt;p&gt;- Clustered index&lt;br /&gt;- Non clustered index&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;Covering&lt;/li&gt;&#xD;
&lt;li&gt;Filtered&lt;/li&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;- Indexed views&lt;br /&gt;-&amp;nbsp;&lt;a href="http://msdn.microsoft.com/en-us/library/gg492088.aspx" target="_blank"&gt;Column Store&lt;/a&gt; (SQL server 2012)&lt;/p&gt;&#xD;
&lt;p&gt;The most important index is the clustered index and you should choose your clustered index carefully. If you make the wrong decision you may end up with some terrible performance and maintenance issues. What is a wrong decision and what&amp;rsquo;s a right decision? Well, there is no right answer, but you should not create the clustered index without a thought. By creating a primary key with the table designer in SQL server, you automatically create a clustered index.&lt;/p&gt;&#xD;
&lt;p&gt;Is the primary key the best clustered index? Well, it depends! It depends on the datatypes, number of columns and how it&amp;rsquo;s being used.&lt;/p&gt;&#xD;
&lt;p&gt;It&amp;rsquo;s a common practice to use a surrogate key that doesn&amp;rsquo;t have any relation to the data as the primary key, like an IDENTITY column. Is the surrogate key a good candidate? It&amp;rsquo;s only one column, ever increasing and use 4byte for integer or 8byte for bigint. I keep repeating, &amp;ldquo;It depends&amp;rdquo;&lt;/p&gt;&#xD;
&lt;p&gt;How often do you search a range on the surrogate key? Do you keep getting singleton lookups on the surrogate key because you search on other columns, like a date range?&lt;/p&gt;&#xD;
&lt;p&gt;You can look at how your indexes are used with the following code:&lt;/p&gt;&#xD;
&lt;p&gt;SELECT * FROM sys.dm_db_index_usage_stats&lt;/p&gt;&#xD;
&lt;p&gt;SELECT * FROM sys.dm_db_index_operational_stats(DB_ID(),null,null,null)&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;This will tell you how many user seeks, user scans, user lookups and user updates. If you have a lot of lookups and few seeks/scans on the clustered index and a lot seek/scans on another index that might be a more useful index.&lt;/p&gt;&#xD;
&lt;p&gt;The other candidate for clustered index might not be ever increasing, but does it have to be? Well no, but you may experience more fragmentation then with an identity column. BUT using the identity column might give you some other headaches like:&lt;/p&gt;&#xD;
&lt;p&gt;- The identity column has no &amp;ldquo;real&amp;rdquo; meaning and you probably have to create an alternate key to avoid duplicate records. That gives you two indexes just to keep database consistency.&lt;br /&gt;- If you need to insert data into an identity column, you need to use &amp;ldquo;set identity insert on&amp;rdquo; and that gives you a table lock.&lt;br /&gt;- Indexes on increasing columns might give you issues with statistics, which in turn can give you a plan that is terrible from a performance perspective.&lt;/p&gt;&#xD;
&lt;p&gt;The main reason to keep the index column as narrow as possible is because the index columns of the clustered index will be stored in the leaf pages of the non clustered index to create a pointer to the rest of the columns, which is stored in the leaf pages of the clustered index. &amp;nbsp;If you use many and/or wide columns in the clustered index, you will increase the size of the non clustered indexes, the number of IO operations and memory usage.&lt;/p&gt;&#xD;
&lt;p&gt;As you can see, there is a lot to think of when you design your tables, and you should test the best design for your database.&lt;/p&gt;&#xD;
&lt;p&gt;If you want to know more about indexing strategies for SQL server, you are welcome back next week or contact any of our SQL server consultants.&lt;/p&gt;</description><a10:updated>2012-07-20T15:48:03Z</a10:updated></item><item><guid isPermaLink="false">8fd1439d-8bb4-4dd1-b11f-fbd59df76141</guid><link>http://sqlservice.se/sv/start/blogg/langsam-procedur.aspx?lang=sv</link><title>Långsam procedur</title><description>&lt;p&gt;Ibland kan man uppleva att en stored procedure g&amp;aring;r l&amp;aring;ngsamt j&amp;auml;mf&amp;ouml;rt med om man k&amp;ouml;r samma fr&amp;aring;ga i SSMS Query Analyzer. En trolig orsak till detta &amp;auml;r d&amp;aring; att olika exekveringsplaner anv&amp;auml;nds. Dessutom kan man ibland uppt&amp;auml;cka att samma procedur b&amp;ouml;rjar g&amp;aring; l&amp;aring;ngsamt efter ett tag att s&amp;aring; stora skillnader som minuter mot sekunder uppst&amp;aring;r.&lt;/p&gt;&#xD;
&lt;p&gt;Detta fenomen kan bero p&amp;aring; sk &amp;rdquo;Parameter Sniffing&amp;rdquo; som i korthet beror p&amp;aring; att de parametrar som anv&amp;auml;nds f&amp;ouml;rsta g&amp;aring;ngen n&amp;auml;r sp&amp;rsquo;n k&amp;ouml;rs &amp;nbsp;och skapar exekveringsplanen inte &amp;auml;r s&amp;aring; bra representanter f&amp;ouml;r datat.&lt;/p&gt;&#xD;
&lt;p&gt;Det kan man l&amp;ouml;sa p&amp;aring; det n&amp;aring;gra olika s&amp;auml;tt: &amp;nbsp;&lt;br /&gt;- Ett enkelt s&amp;auml;tt &amp;auml;r skapa om proceduren, dock kommer man troligen f&amp;aring; g&amp;ouml;ra det ganska regelbundet.&lt;br /&gt;- Ytterligare ett s&amp;auml;tt &amp;auml;r att l&amp;auml;gga till &amp;rdquo;WITH RECOMPILE&amp;rdquo; i b&amp;ouml;rjan av sp'n f&amp;ouml;r att p&amp;aring; s&amp;auml;tt tvinga fram en omkompilering varje g&amp;aring;ng sp'n&amp;nbsp;&amp;nbsp; &amp;nbsp; anv&amp;auml;nds.&lt;br /&gt;- Ett mera jobbigt s&amp;auml;tt &amp;auml;r att jobba med sk Query Hints f&amp;ouml;r att p&amp;aring; s&amp;aring; s&amp;auml;tt tvinga fram en viss exekveringsplan. Detta s&amp;auml;tt rekommenderar vi inte utan i undantagsfall eftersom det kr&amp;auml;ver en stadig bevakning allteftersom datat i tabellerna &amp;auml;ndras. &amp;nbsp;&lt;br /&gt;- Det b&amp;auml;sta s&amp;auml;ttet till slut &amp;auml;r att anv&amp;auml;nda sk lokala variabler och helt enkelt tilldela inparametrarnas v&amp;auml;rde till dem ist&amp;auml;llet och sedan anv&amp;auml;nda dessa i fr&amp;aring;gan.&lt;/p&gt;&#xD;
&lt;p&gt;Det &amp;auml;r relativt ovanligt att man beh&amp;ouml;ver g&amp;ouml;ra p&amp;aring; n&amp;aring;got av dessa s&amp;auml;tt, men ibland &amp;auml;r det n&amp;ouml;dv&amp;auml;ndigt. H&amp;ouml;r av er till n&amp;aring;gon av oss om ni har ytterligar fr&amp;aring;gor eller funderaringar runt detta omr&amp;aring;de att optimera prestandan p&amp;aring; databaser i SQL Server milj&amp;ouml;er.&lt;/p&gt;</description><a10:updated>2012-07-20T15:45:56Z</a10:updated></item><item><guid isPermaLink="false">5cedc7bf-e279-4ee8-8336-fc640cf505a7</guid><link>http://sqlservice.se/sv/start/blogg/nu-finns-en-ny-uppdatering-for-sql-server-2008-sp3.aspx?lang=sv</link><title>Nu finns en ny uppdatering för SQL Server 2008 SP3</title><description>&lt;p&gt;En av de mindre uppdateringarna f&amp;ouml;r SQL Server 2008 SP3 har nu sl&amp;auml;ppts. Det &amp;auml;r enbart 4 nya buggr&amp;auml;ttningar som nu blivit fixat. Hur som helst finns den nedan f&amp;ouml;r nedladdning.&lt;/p&gt;&#xD;
&lt;p&gt;Som vanligt g&amp;auml;ller det att alltid testa innan man g&amp;ouml;r f&amp;ouml;r&amp;auml;ndringar i sin produktionsmilj&amp;ouml;.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2696626/"&gt;Cumulative update package 5 for SQL Server 2008 Service Pack 3&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T15:44:41Z</a10:updated></item><item><guid isPermaLink="false">6037673c-5b0b-4465-8505-dea09d34eb0b</guid><link>http://sqlservice.se/sv/start/blogg/backup--restore-info.aspx?lang=sv</link><title>Backup &amp; Restore info</title><description>&lt;p&gt;SQL Server inneh&amp;aring;ller ju tonvis med metadata och bla finns det massor av anv&amp;auml;ndbar information om vilka backup/restore som skett p&amp;aring; servern.&lt;/p&gt;&#xD;
&lt;p&gt;I msdb databasen finns ett antal tabeller som var f&amp;ouml;r sig eller kombinerade kan leverera intressant information.&lt;/p&gt;&#xD;
&lt;p&gt;Dessa tabeller &amp;auml;r:&lt;br /&gt;- backupfile&lt;br /&gt;- backupfilegroup&lt;br /&gt;- backupmediafamily&lt;br /&gt;- backupmediaset&lt;br /&gt;- backupset&lt;br /&gt;- restorefile&lt;br /&gt;- restorefilegroup&lt;br /&gt;- restorehistory&lt;/p&gt;&#xD;
&lt;p&gt;Tex kan man f&amp;aring; reda p&amp;aring;:&lt;br /&gt;-N&amp;auml;r restorades min databas senast&lt;br /&gt;-Vilken server kommer backupen ifr&amp;aring;n&lt;br /&gt;-vilken backupfil anv&amp;auml;ndes vid restore&lt;br /&gt;-Backupstorlek, okomprimerad/komprimerad, komprimeringsgrad&lt;br /&gt;-Vad hette databasen n&amp;auml;r backupen togs&lt;br /&gt;-N&amp;auml;r k&amp;ouml;rdes backupen&lt;/p&gt;&#xD;
&lt;p&gt;Och koden f&amp;ouml;r det ser ut s&amp;aring; h&amp;auml;r:&lt;/p&gt;&#xD;
&lt;p&gt;SELECT rh.destination_database_name as [Restored database], &lt;br /&gt;&amp;nbsp;&amp;nbsp;rh.restore_date as [Time of restore], &lt;br /&gt;&amp;nbsp;&amp;nbsp;bs.server_name as [Source server], &lt;br /&gt;&amp;nbsp;&amp;nbsp;bs.database_name as [Source database name],&lt;br /&gt;&amp;nbsp;&amp;nbsp;bmf.physical_device_name as [Backup file name], &lt;br /&gt;&amp;nbsp;&amp;nbsp;bs.backup_start_date as [Time of backup],&lt;br /&gt;&amp;nbsp;&amp;nbsp;bs.backup_size as [Backup size], &lt;br /&gt;&amp;nbsp;&amp;nbsp;bs.compressed_backup_size as [Compressed backup size]&lt;br /&gt;FROM msdb..restorehistory rh&lt;br /&gt;INNER JOIN msdb..backupset bs on bs.backup_set_id = rh.backup_set_id&lt;br /&gt;INNER JOIN msdb..backupmediafamily bmf on bmf.media_set_id = bs.media_set_id&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T15:43:21Z</a10:updated></item><item><guid isPermaLink="false">e6da99f3-8675-46c7-9329-74a89234f7ce</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-indexerings-strategier-del-1--generella-rekommendationer.aspx?lang=sv</link><title>SQL Server indexerings strategier del 1 - Generella rekommendationer</title><description>&lt;p&gt;N&amp;auml;r du designar en databas b&amp;ouml;r du ha prestanda i &amp;aring;tanke, och indexerings strategi &amp;auml;r en av de viktigaste sakerna att t&amp;auml;nka p&amp;aring;. Om du skapar f&amp;ouml;r f&amp;aring; eller f&amp;ouml;r m&amp;aring;nga index lider du av d&amp;aring;lig prestanda. Om du inte har index f&amp;ouml;r att t&amp;auml;cka dina fr&amp;aring;gor, har du l&amp;aring;ngsamma fr&amp;aring;gor, och om du har f&amp;ouml;r m&amp;aring;nga, kommer dina INSERT, UPDATE och DELETE att vara l&amp;aring;ngsamma. Du m&amp;aring;ste balansera detta och det finns alltid avv&amp;auml;gningar och inga enkla svar som fungerar f&amp;ouml;r alla, men det finns vissa riktlinjer du kan f&amp;ouml;lja.&lt;/p&gt;&#xD;
&lt;p&gt;I denna serie av blogginl&amp;auml;gg jag ska f&amp;ouml;rs&amp;ouml;ka ge dig n&amp;aring;gra av dessa riktlinjer.&lt;/p&gt;&#xD;
&lt;p&gt;- Skapa inte f&amp;ouml;r m&amp;aring;nga eller f&amp;ouml;r f&amp;aring;.&lt;br /&gt;- Varje tabell ska ha ett&amp;nbsp;klustrade indexet! Slut p&amp;aring; diskussionen! (kanske en del s&amp;auml;ger att de sm&amp;aring;&amp;nbsp;tabellerna inte ska ha, men jag t&amp;auml;cker det i en senare post)&lt;br /&gt;- V&amp;auml;lj det klustrade index klokt, l&amp;aring;t inte SQL Server Management Studio att v&amp;auml;lja det &amp;aring;t dig (genom att skapa en prim&amp;auml;rnyckel i tabellen designern).&lt;br /&gt;- Indexera kolumner som anv&amp;auml;nds i en foreign key relation&lt;br /&gt;- Testa din workload med dina index&lt;br /&gt;- &amp;Ouml;vervaka din prestanda f&amp;ouml;r&amp;nbsp;att hitta nya index&lt;br /&gt;- Ta bort index som inte anv&amp;auml;nds&lt;br /&gt;- Skapa inte dubbletter av index&lt;br /&gt;- Kolumnordningen i index r&amp;auml;knas, om f&amp;ouml;rsta kolumnen i indexet inte anv&amp;auml;nds i en WHERE / join sats kommer det att sluta med en scan&lt;br /&gt;- Anv&amp;auml;nd r&amp;auml;tt&amp;nbsp;fillfactor f&amp;ouml;r varje index, r&amp;auml;kna inte&amp;nbsp;med serverns standardinst&amp;auml;llningen f&amp;ouml;r fillfactor&lt;br /&gt;- &amp;Ouml;verv&amp;auml;g partitionering f&amp;ouml;r prestanda och underh&amp;aring;ll&lt;br /&gt;- Anv&amp;auml;nd datakomprimering&amp;nbsp;f&amp;ouml;r datawarehouse / rapportering databaser.&lt;br /&gt;- Bygg om index p&amp;aring; en regelbunden basis&lt;br /&gt;- Uppdatera indexstatistik&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;Kom tillbaka en annan dag f&amp;ouml;r mer information om specifika rekommendationer&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;Om du har n&amp;aring;gra fr&amp;aring;gor &amp;auml;r du v&amp;auml;lkommen att kontakta n&amp;aring;gon av v&amp;aring;ra SQL Server konsulter och vi kommer att hj&amp;auml;lpa dig.&lt;/p&gt;</description><a10:updated>2012-07-20T15:37:54Z</a10:updated></item><item><guid isPermaLink="false">f81cbf88-920a-4486-9772-c985123015d3</guid><link>http://sqlservice.se/sv/start/blogg/bids-helper.aspx?lang=sv</link><title>BIDS Helper </title><description>&lt;p&gt;F&amp;ouml;r oss som jobbar med SQL Server Analysis Server kan man f&amp;aring; en otrolig hj&amp;auml;lp av &lt;strong&gt;BIDS Helper&lt;/strong&gt;. Detta &amp;auml;r ett gratisverktyg som integreras i Visual Studio som en add-in och t.ex. &amp;auml;r det mycket l&amp;auml;ttare och b&amp;auml;ttre att skapa aggregeringar &amp;auml;n i sj&amp;auml;lva Visual Studio. Detta &amp;auml;r inte n&amp;aring;got nytt verktyg utan har funnits r&amp;auml;tt l&amp;auml;nge f&amp;ouml;r Visual Studio (BIDS). D&amp;auml;remot &amp;auml;r det r&amp;auml;tt nytt att man nu ocks&amp;aring; kan anv&amp;auml;nda det f&amp;ouml;r SQL Server 2012 och Tabular Mode (SSDT).&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://bidshelper.codeplex.com/"&gt;http://bidshelper.codeplex.com/&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-07-20T15:34:45Z</a10:updated></item><item><guid isPermaLink="false">4c82c08f-d033-4fe0-ad3c-1816d463b722</guid><link>http://sqlservice.se/sv/start/blogg/the-sql-server-2012-core-factor-table.aspx?lang=sv</link><title>The SQL Server 2012 Core Factor Table</title><description>&lt;p&gt;I am sure you have heard of the new SQL Server 2012 licensing model, out with CPU licensing and in with Core licensing. But did you know that all cores are not created equal? In fact that is why we need the Core Factor Table, to describe the relative cost of a core. The core table can be changed over time, so check back at this link to see if there are any chhanges recently: &lt;a href="http://go.microsoft.com/fwlink/?LinkID=229882"&gt;http://go.microsoft.com/fwlink/?LinkID=229882&lt;/a&gt; The current table looks like this:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Processor Type &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; &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; &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Core Factor&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;- All processors not mentioned below &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; &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;br /&gt;- AMD 31XX, 32XX, 41XX, 42XX, 61XX, 62XX Series Processors with 6 or more cores &amp;nbsp; &amp;nbsp; &amp;nbsp;0.75&lt;br /&gt;- Single Core Processors &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; &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4&lt;br /&gt;- Dual Core Processors &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; &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; &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; 2&lt;/p&gt;&#xD;
&lt;p&gt;Interestingly, we see that running on a one or two core processor costs as much as running on a processor with 4 cores. And some specific AMD processors (with 6 or more cores) are cheaper per core than any other processors&lt;/p&gt;&#xD;
&lt;p&gt;Read more about buying SQL Server 2012 at &lt;a href="http://www.microsoft.com/sqlserver/en/us/get-sql-server/how-to-buy.aspx"&gt;http://www.microsoft.com/sqlserver/en/us/get-sql-server/how-to-buy.aspx&lt;/a&gt; or &lt;a href="../sv/start/kontakta-oss.aspx"&gt;contact us&lt;/a&gt;, and we will help you!&lt;/p&gt;</description><a10:updated>2012-07-20T15:33:32Z</a10:updated></item><item><guid isPermaLink="false">2f60ac66-be08-486c-bd57-44d62b131e6d</guid><link>http://sqlservice.se/sv/start/blogg/job-failed--failed-to-notify-via-email--dbmail-in-sql2005.aspx?lang=sv</link><title> Job failed - failed to notify via email - dbmail in SQL2005</title><description>&lt;p&gt;If you have configured Database Mail correct in the Management Studio wizard in SQL Server 2005 (yes, some still use that old but stable chump), with a profile connecting to a user etc, and also have set up a job so that a notification should be sent to you, when the job fails. Then you think you are done? Nope. You're not done yet.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;There are this (agent) service settings to be made as well.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;I read this at the end of a errormessage when a job failed, when I didn't get an errormail of the fact:&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;..."NOTE: Failed to notify 'BI_Mailbox' via email."&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Followed some google advices, and for example, simply restarting SQL Server Agent did not work for our server.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;This did the trick though, not hard to do at all :) had just forgot/did not know I needed to enable mail session in the agent, and unfortunately that requires a restart of the agent service before it works. A task that sometimes needs lots of negotiations and getting approvals, which is not always easy in heavily used environments. You don't want to be forced to wait for a service window a week later for the for the restart so job mails start working. Many admins know what I'm talking about:&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;1. In Management Studio, right-click SQL Server Agent again and select "Properties."&lt;/p&gt;&#xD;
&lt;p&gt;2. Click "Alert System"&lt;/p&gt;&#xD;
&lt;p&gt;3. Click "Enable mail profile"&lt;/p&gt;&#xD;
&lt;p&gt;4. Click "OK"&lt;/p&gt;&#xD;
&lt;p&gt;5. Restart SQL Server Agent.&lt;/p&gt;&#xD;
&lt;p&gt;/Jonas Bergstr&amp;ouml;m&lt;/p&gt;</description><a10:updated>2012-07-20T15:31:15Z</a10:updated></item><item><guid isPermaLink="false">532c4479-f955-4fdd-9535-03b259e28821</guid><link>http://sqlservice.se/sv/start/blogg/guest-blog-keeping-track-of-sql-server-agent-job-durations.aspx?lang=sv</link><title>Guest Blog: Keeping track of SQL Server Agent job durations</title><description>&lt;p&gt;About me My name is Mikael Cedersved, also (un)known as FrozenFishes. I&amp;rsquo;m a 26 year old DBA and BI developer from Sweden, working in the health care industry. I&amp;rsquo;ve been working with SQL server for 4 years. This is actually my first sql server related blog post, and I hope there&amp;rsquo;s several more to come. I&amp;rsquo;m about to launch my own blog at &lt;a href="http://frozenfishes.wordpress.com"&gt;http://frozenfishes.wordpress.com&lt;/a&gt;, so stay tuned on that! You may also follow me on twitter @frozenfishes. First of all I want to thank Steinar Andersen and the people at SQL Service for letting me write a blog post here. And thanks again for putting Sweden on the SQL Server world map!&lt;/p&gt;&#xD;
&lt;p&gt;Recently I started thinking about how to monitor over all performance for our data warehouse and mostly the impacts of different changes to the environment as a whole and over time. Both inside SQL server, but also at HW/OS level. E.g if you're switching over to another SAN solution, making changes to the memory configuration or having table compression turned on. I figured one way to do this is to keep track of sql server agent job durations, since this is often not only used to execute all the SSIS packages for ETL, but also for a lot of cmdexec tasks doing various things in the environment such as processing a large number of files in some way etc. You'll then want to know how big the time saving (or loss) was in the big picture.&lt;/p&gt;&#xD;
&lt;p&gt;This could also be highly interesting numbers to look at if you're bound to specific maintenance time windows, when it's acceptable that your data is unavailable or inconsistent, and you're having trouble fitting everything in there. Then you want to know which job durations are stable and which are not, and which jobs take the longest time to finish when it matters, so that you can focus troubleshooting and performance optimization to these bad guys.&amp;nbsp; Of course this is not very specific, and will barely provide any help at all when it comes to troubleshooting. It's also more of a measure for what's going on in means of modifications to these jobs, than performance in the environment, if your agent jobs changes often and a lot. In my own case we have quite stable jobs that, if changed it's not supposed to affect these durations very much. Although this might give you a hint of when a problem occurs and you need to look at the specifics.&amp;nbsp; In a perfect world the only one making changes to these agent jobs would be the DBA, so that he/she always know what's going on in there. At least I would like it to be like this. Although I'm pretty certain this is not true in many cases.&lt;/p&gt;&#xD;
&lt;p&gt;This might raise an alert to you as a DBA, when a developer has made significant changes to a job - so that you'll get the opportunity to check it out and see how it copes with what you know is the fastest and best way of doing these things and make sure it doesn&amp;rsquo;t affect job durations to the point that it will interfere with other things such as backups or different maintenance tasks.&amp;nbsp; There's some time calculation to be done here.&lt;/p&gt;&#xD;
&lt;p&gt;The following query will return one row per job, and information about the most recent run. If there's jobs that never has been run this will be returned with '1970-01-01' as RunDate. I use this query in a agent job to insert the results into a table, so that I can look at the results and variations over time with the help of a SSRS report. I scheduled this to run once a day.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;SELECT CAST(convert(char(8), CASE a.last_run_date WHEN 0 THEN '19700101' ELSE a.last_run_date END) AS date) as RunDate,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE LEN(a.last_run_time)&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 5 THEN '0' + LEFT(convert(nvarchar(6),a.last_run_time), 1) + ':' + (SUBSTRING(convert(nvarchar(6), a.last_run_time), 2, 2)+ ':' + RIGHT(convert(nvarchar(6), a.last_run_time), 2))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 6 THEN LEFT(convert(nvarchar(6), a.last_run_time), 2) + ':' +(SUBSTRING(convert(nvarchar(6), a.last_run_time), 3, 2) + ':' +RIGHT(convert(nvarchar(6), a.last_run_time), 2))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;ELSE '23:59:59'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END AS RunTime,&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; b.name as JobName,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;(select COUNT(step_id) from [msdb].[dbo].[sysjobsteps] where job_id =a.job_id) as NbrOfSteps,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;CASE a.last_run_outcome WHEN 0 THEN '#FAILED#'&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 1 THEN 'Succeeded'WHEN 3 THEN '#STOPPED#' ELSE 'N/A' END AS Outcome,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;CASE LEN(a.last_run_duration)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 1 THEN a.last_run_duration&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 2 THEN a.last_run_duration&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 3 THEN (convert(decimal, LEFT(a.last_run_duration, 1)) * 60) +RIGHT(a.last_run_duration, 2)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;WHEN 4 THEN (convert(decimal, LEFT(a.last_run_duration, 2)) * 60) +RIGHT(a.last_run_duration, 2)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 5 THEN (convert(decimal, LEFT(a.last_run_duration, 1) * 60) * 60) +(convert(decimal, SUBSTRING(CAST(a.last_run_duration AS nvarchar(5)), 2, 2)) * 60) +RIGHT(a.last_run_duration, 2)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 6 THEN (convert(decimal, LEFT(a.last_run_duration, 2) * 60) * 60) +(convert(decimal, SUBSTRING(CAST(a.last_run_duration AS nvarchar(6)), 3, 2)) * 60) +RIGHT(a.last_run_duration, 2)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;END AS DurationInSecs,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;CASE LEN(a.last_run_duration)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 1 THEN cast(convert(decimal, a.last_run_duration) /60 AS decimal(6,2))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 2 THEN cast(convert(decimal, a.last_run_duration) /60 AS decimal(6,2))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 3 THEN cast(LEFT(a.last_run_duration, 1) + (convert(decimal,RIGHT(a.last_run_duration, 2)) /60) AS decimal(6,2))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 4 THEN cast(LEFT(a.last_run_duration, 2) + (convert(decimal,RIGHT(a.last_run_duration, 2)) /60) AS decimal(6,2))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 5 THEN cast((convert(decimal, (LEFT(a.last_run_duration, 1)) * 60) +SUBSTRING(CAST(a.last_run_duration AS nvarchar(5)), 2, 2) + (convert(decimal,RIGHT(a.last_run_duration, 2)) /60)) AS decimal(6,2))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 6 THEN cast((convert(decimal, (LEFT(a.last_run_duration, 2)) * 60) +SUBSTRING(CAST(a.last_run_duration as nvarchar(6)), 3, 2) + (convert(decimal,RIGHT(a.last_run_duration, 2)) /60)) AS decimal(6,2))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;END AS DurationInMins,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;CASE LEN(a.last_run_duration)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 1 THEN cast(convert(decimal, a.last_run_duration / 60) /60 AS decimal(6, 2))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 2 THEN cast(convert(decimal, a.last_run_duration / 60) /60 AS decimal(6, 2))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 3 THEN cast((convert(decimal, LEFT(a.last_run_duration, 1)) /60) +(convert(decimal, RIGHT(a.last_run_duration, 2)) / 60) /60 AS decimal(6,2))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 4 THEN cast((convert(decimal, LEFT(a.last_run_duration, 2)) /60) +(convert(decimal, RIGHT(a.last_run_duration, 2)) / 60) /60 AS decimal(6,2))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 5 THEN cast(LEFT(a.last_run_duration, 1) + (convert(decimal,SUBSTRING(CAST(a.last_run_duration AS nvarchar(5)), 2, 2)) /60) + (convert(decimal,(RIGHT(a.last_run_duration, 2)) / 60) /60) AS decimal(6,2))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;WHEN 6 THEN cast(LEFT(a.last_run_duration, 2) + (convert(decimal,SUBSTRING(CAST(a.last_run_duration AS nvarchar(6)), 3, 2)) /60) + (convert(decimal,(RIGHT(a.last_run_duration, 2)) / 60) /60) AS decimal(6,2))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;ELSE 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END AS DurationInHrs&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;FROM [msdb].[dbo].[sysjobservers] a&amp;nbsp;&amp;nbsp; inner join [msdb].[dbo].[sysjobs] b on a.job_id = b.job_id&amp;nbsp;&amp;nbsp; order by a.last_run_date, a.last_run_time&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T15:30:49Z</a10:updated></item><item><guid isPermaLink="false">ff57b033-148e-4abc-b1aa-3a389d4bd389</guid><link>http://sqlservice.se/sv/start/blogg/where.aspx?lang=sv</link><title>WHERE</title><description>&lt;p&gt;Ibland &amp;auml;r &lt;strong&gt;WHERE&lt;/strong&gt; inte alltid vad vi t&amp;auml;nker p&amp;aring;, n&amp;auml;mligen i v&amp;aring;ra SQL-satser. Man kan ju ocks&amp;aring; anv&amp;auml;nda det f&amp;ouml;r att s&amp;ouml;ka efter filer. Det g&amp;ouml;r man i kommandof&amp;ouml;nstret och som standar sker s&amp;ouml;kningen d&amp;aring; i den aktuella mappen och i de s&amp;ouml;kv&amp;auml;gar som anges i mij&amp;ouml;variabeln PATH. Ett exempel f&amp;ouml;ljer nedan d&amp;aring; jag s&amp;ouml;ker efter SQLDiag som jag kommer &amp;aring;terkomma till i kommande inl&amp;auml;gg.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=6591af27-99e1-410c-a49d-5a3a64a0f664&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Resulatet kommer sedan blixtsnabbt.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;img src="../ci.axd?sid=b3b852f3-8221-4b1c-b3b3-eb891506da50&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;</description><a10:updated>2012-07-20T15:30:12Z</a10:updated></item><item><guid isPermaLink="false">9d464bbc-01f2-4cc4-9d41-9c20af292d15</guid><link>http://sqlservice.se/sv/start/blogg/which-tables-do-i-have-select-permissions-on.aspx?lang=sv</link><title>Which tables do I have SELECT permissions on?</title><description>&lt;p&gt;I would like to share a little tip form Books Online, that I found the other day. Sometimes it is needed to find out what my permissions are. A good function to use in that case is HAS_PERMS_BY_NAME. If for example I would like to find out what tables I have SELECT permissions on, I could run the following query:&lt;/p&gt;&#xD;
&lt;p&gt;SELECT HAS_PERMS_BY_NAME (QUOTENAME(SCHEMA_NAME(schema_id)) + '.' + QUOTENAME(name), &amp;nbsp;&amp;nbsp;&amp;nbsp; 'OBJECT', 'SELECT') AS have_select, * FROM sys.tables&lt;/p&gt;&#xD;
&lt;p&gt;Read more about HAS_PERMS_BY_NAME at &lt;a href="http://msdn.microsoft.com/en-us/library/ms189802.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms189802.aspx&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-07-20T15:29:46Z</a10:updated></item><item><guid isPermaLink="false">6ce5ada8-921f-40ae-9d21-8821bafb588c</guid><link>http://sqlservice.se/sv/start/blogg/resource-governor-lite-with-query_governor_cost_limit-.aspx?lang=sv</link><title>Resource Governor Lite with QUERY_GOVERNOR_COST_LIMIT ?</title><description>&lt;p&gt;Recently I had an idea about trying to emulate some of the functionality of Resource Governor using options available in Microsoft SQL Server Standard Edtion. The SET Option QUERY_GOVERNOR_COST_LIMIT is available in all versions of SQL Server, and promises to let us configure a maximum limit on the cost of a query that will be allowed to execute. This is what Books Online has to say about it:&lt;/p&gt;&#xD;
&lt;p&gt;"Use the query governor cost limit option to specify an upper limit on the time period in which a query can run. Queries that have estimated run times greater than this limit, return an error and are not executed. Query cost refers to the estimated elapsed time, in seconds, required to complete a query on a specific hardware configuration.&lt;/p&gt;&#xD;
&lt;p&gt;If you specify a nonzero, nonnegative value, the query governor disallows execution of any query that has an estimated cost exceeding that value. Specifying 0 (the default) for this option turns off the query governor, and all queries are allowed to run without any time limitation.&lt;/p&gt;&#xD;
&lt;p&gt;If you use sp_configure to change the value of query governor cost limit, the changed value is server wide. To change the value on a per-connection basis, use the SET QUERY_GOVERNOR_COST_LIMIT statement.&lt;/p&gt;&#xD;
&lt;p&gt;The query governor cost limit option is an advanced option. If you are using the sp_configure system stored procedure to change the setting, you can change query governor cost limit only when show advanced options is set to 1. The setting takes effect immediately (without a server restart)."&lt;/p&gt;&#xD;
&lt;p&gt;So, in other words we can set it on the server level but that affects all queries even the too costly ones that we would like to let run anyway, and the users themselves can change it on the session level.&lt;/p&gt;&#xD;
&lt;p&gt;Scenario: You have a SQL Server instance with a homegrown application. Users are not only connection via the application, but also via Excel, Access, Query Analyzer, PowerPivot or other similar uncontrolled ways. You would like to let the continue with that, but not in a way that kills the performance of the entire server, and all other users of your application.&lt;/p&gt;&#xD;
&lt;p&gt;The plan is as follows:&lt;/p&gt;&#xD;
&lt;p&gt;Configure QUERY_GOVERNOR_COST_LIMIT to 100 on the server level using the following code.&lt;/p&gt;&#xD;
&lt;p&gt;exec sp_configure 'show advanced options', 1&lt;/p&gt;&#xD;
&lt;p&gt;go&lt;/p&gt;&#xD;
&lt;p&gt;exec sp_configure 'query governor cost limit', 10 --(For our testing purposes only. In real life you would likely set it higher, for example 200)&lt;/p&gt;&#xD;
&lt;p&gt;go reconfigure&lt;/p&gt;&#xD;
&lt;p&gt;go&lt;/p&gt;&#xD;
&lt;p&gt;Then, since this is a homegrown application, you configure your application to remove the limit on its own sessions at logon time, using the following statement:&lt;/p&gt;&#xD;
&lt;p&gt;SET QUERY_GOVERNOR_COST_LIMIT&amp;nbsp; 0&lt;/p&gt;&#xD;
&lt;p&gt;This would work well, atleast until your rouge users read this blog post :-)&lt;/p&gt;&#xD;
&lt;p&gt;To verify the functionality of this, log on to SQL Server and run the following query:&lt;/p&gt;&#xD;
&lt;p&gt;select * from master.sys.objects ma cross apply msdb.sys.objects ms&lt;/p&gt;&#xD;
&lt;p&gt;You should get the following error: Msg 8649, Level 17, State 1, Line 2 The query has been canceled because the estimated cost of this query (34) exceeds the configured threshold of 1. Contact the system administrator.&lt;/p&gt;&#xD;
&lt;p&gt;Now run our secret command to give you access to the unlimited power of SQL Server:&lt;/p&gt;&#xD;
&lt;p&gt;SET QUERY_GOVERNOR_COST_LIMIT&amp;nbsp; 0&lt;/p&gt;&#xD;
&lt;p&gt;Run the query again: select * from master.sys.objects ma cross apply msdb.sys.objects ms&lt;/p&gt;&#xD;
&lt;p&gt;...and you should succeed!&lt;/p&gt;&#xD;
&lt;p&gt;Good luck!&lt;/p&gt;</description><a10:updated>2012-07-20T15:29:10Z</a10:updated></item><item><guid isPermaLink="false">26098f3e-6c8e-4e67-9737-9afaba92e9c8</guid><link>http://sqlservice.se/sv/start/blogg/database-mirroring--checkdb.aspx?lang=sv</link><title>Database Mirroring &amp; CHECKDB</title><description>&lt;p&gt;Att man skall k&amp;ouml;ra CHECKDB p&amp;aring; sina databaser regelbundet har v&amp;auml;l de allra flesta koll p&amp;aring; hoppas jag.&lt;br /&gt;Datat man lagrar i databaserna kan vara mer eller mindre v&amp;auml;rdefullt, i vissa fall kan verksamheten vara direkt beroende av att datat &amp;auml;r intakt och &amp;auml;ven tillg&amp;auml;ngligt dygnet runt utan avbrott.&lt;/p&gt;&#xD;
&lt;p&gt;F&amp;ouml;r att uppn&amp;aring; en form av redundans kan man anv&amp;auml;nda sig av Database Mirroring. Till skillnad fr&amp;aring;n kluster d&amp;auml;r databasfilerna befinner sig p&amp;aring; ett st&amp;auml;lle rent fysiskt s&amp;aring; har en Database Mirroring installation en prim&amp;auml;r databas och en spegel databas som helst befinner sig p&amp;aring; en annan server och d&amp;auml;rmed &amp;auml;ven en annan disk.&lt;/p&gt;&#xD;
&lt;p&gt;I klusterfallet kan man k&amp;ouml;ra CHECKDB p&amp;aring; sin databas och d&amp;auml;rmed vara s&amp;auml;ker p&amp;aring; att man gjort vad man kan f&amp;ouml;r att uppt&amp;auml;cka korruption.&lt;/p&gt;&#xD;
&lt;p&gt;I Database Mirroring fallet blir det lite mer komplicerat eftersom vi ju faktiskt har en sekund&amp;auml;r server d&amp;auml;r databasen speglas. Antag att du regelbundet k&amp;ouml;rt CHECKDB p&amp;aring; den prim&amp;auml;ra databasen och i och med det tror att allt &amp;auml;r ok och sedan r&amp;aring;kar ut f&amp;ouml;r n&amp;aring;gon form av problem vilket orsakar en failover till spegeln. I det h&amp;auml;r l&amp;auml;get skall man vara medveten om att man anv&amp;auml;nder en databas som man aldrig kontrollerat. I v&amp;auml;rsta fall &amp;auml;r en failover inte ens m&amp;ouml;jlig och det &amp;auml;r v&amp;auml;l inte riktigt vad man f&amp;ouml;rv&amp;auml;ntar sig n&amp;auml;r man investerat i mer h&amp;aring;rdvara, lagt ner tid p&amp;aring; att s&amp;auml;tta upp Mirroring mm...&lt;/p&gt;&#xD;
&lt;p&gt;Vad kan man d&amp;aring; g&amp;ouml;ra f&amp;ouml;r att undvika detta? &lt;br /&gt;Spegeldatabasen &amp;auml;r ju i "restoring" l&amp;auml;ge och &amp;auml;r i och med det&amp;nbsp;inte online. Man kan dock skapa en shapshot av databasen och mot den kan man k&amp;ouml;ra CHECKDB. Eftersom vi fortfarande inte k&amp;ouml;r p&amp;aring; den faktiska databasen s&amp;aring; kan vi &amp;auml;nd&amp;aring; inte vara helt s&amp;auml;kra men det &amp;auml;r i alla fall b&amp;auml;ttre &amp;auml;n att inte g&amp;ouml;ra n&amp;aring;gra kontroller alls p&amp;aring; spegeln. &lt;br /&gt;Ett database snapshot kan man ju &amp;auml;ven anv&amp;auml;nda till annat &amp;auml;n att k&amp;ouml;ra CHECKDB mot, tex rapportering om man vill avlasta den prim&amp;auml;ra databasen.&lt;/p&gt;&#xD;
&lt;p&gt;Enda s&amp;auml;ttet att vara helt s&amp;auml;ker &amp;auml;r att periodvis v&amp;auml;xla till spegeldatabasen och d&amp;auml;r k&amp;ouml;ra CHECKDB.&lt;/p&gt;&#xD;
&lt;p&gt;Tveka inte att &lt;a href="http://www.sqlservice.se/sv/start/kontakta-oss.aspx" target="_blank"&gt;kontakta oss&lt;/a&gt; om ni &amp;auml;r det minsta os&amp;auml;kra p&amp;aring; hur man s&amp;auml;krar upp SQL Server databaser p&amp;aring; b&amp;auml;sta s&amp;auml;tt.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T15:28:08Z</a10:updated></item><item><guid isPermaLink="false">b1eb0c44-50f2-4608-a5dc-b21a72d85d01</guid><link>http://sqlservice.se/sv/start/blogg/is-dynamic-tsql-a-good-design-pattern.aspx?lang=sv</link><title>Is Dynamic T-SQL a Good Design Pattern?</title><description>&lt;p&gt;In a recent discussion it was suggested to me that not only is dynamic T-SQL useful for things like catch-all queries or some really hard to solve problems involving variable table lists, but is, in fact, a perfectly acceptable design pattern for all queries against a database. Note, in this case, we&amp;rsquo;re not talking about an ORM tool which takes control of the system through parameterized queries, but rather an intentional choice to build nothing but dynamic T-SQL directly on the system.&lt;/p&gt;&#xD;
&lt;p&gt;To me, this was immediately problematic. I absolutely agree, you&amp;rsquo;re going to have dynamic T-SQL for some of those odd-ball catch-all search queries. But to simply expand that out to include all your queries is nuts. There really is a reason that stored procedures exist, and it&amp;rsquo;s not to build dynamic T-SQL. First things first, we are talking about using sp_executesql so we can avoid problems with SQL Injection, although that should be the very first concern that comes from this methodology. But after that, you need to worry about your management of the system. Here&amp;rsquo;s an example query:&lt;/p&gt;&#xD;
&lt;p&gt;CREATE PROCEDURE [dbo].[SearchRecords] @searchQuery AS NVARCHAR(100), @col AS VARCHAR(100) AS BEGIN&lt;/p&gt;&#xD;
&lt;p&gt;SET NOCOUNT ON; DECLARE @SQL NVARCHAR(1000); DECLARE @value NVARCHAR(100);&lt;/p&gt;&#xD;
&lt;p&gt;SET @value = @searchQuery;&lt;/p&gt;&#xD;
&lt;p&gt;IF (@col = 'PERSON_ID') BEGIN SET @SQL = 'SELECT * FROM dbo.Movie WHERE MovieId = @value'; END ELSE IF (@col = 'FIRST_NAME') BEGIN SET @SQL = 'SELECT * FROM dbo.Movie WHERE MovieName = @value';&lt;/p&gt;&#xD;
&lt;p&gt;END&lt;/p&gt;&#xD;
&lt;p&gt;EXEC sp_executesql @SQL,N'@value nvarchar(20)',@value=@value;&lt;/p&gt;&#xD;
&lt;p&gt;END&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;No chance of SQL injection with this, but there are other problems. The first one that comes up for me is that I&amp;rsquo;ve had to use a generic data type for @value, NVARCHAR(100). I&amp;rsquo;m passing that to both an ID and a NVARCHAR which means, when passing it to the ID I&amp;rsquo;m going to get a implicit conversion, possibly affecting index use for that part of the query. But it gets worse. Let&amp;rsquo;s execute the query twice, but I want clear the cache (please only do this on test systems):&lt;/p&gt;&#xD;
&lt;p&gt;DBCC FREEPROCCACHE();&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;EXEC dbo.SearchRecords @searchQuery = N'42', -- nvarchar(100) @col = 'PERSON_ID' -- varchar(100);&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;EXEC dbo.SearchRecords @searchQuery = N'Serpico', -- nvarchar(100) @col = 'FIRST_NAME' -- varchar(100);&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;So now we have two different plans in cache. If I query the cache like this:&lt;/p&gt;&#xD;
&lt;p&gt;SELECT deqp.query_plan, deqs.execution_count, deqs.query_hash, deqs.query_plan_hash, dest.text, OBJECT_NAME(dest.objectid)&lt;/p&gt;&#xD;
&lt;p&gt;FROM sys.dm_exec_query_stats AS deqs&lt;/p&gt;&#xD;
&lt;p&gt;CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest&lt;/p&gt;&#xD;
&lt;p&gt;CROSS APPLY sys.dm_exec_query_plan(deqs.plan_handle) AS deqp;&lt;/p&gt;&#xD;
&lt;p&gt;GO&lt;/p&gt;&#xD;
&lt;p&gt;I get a set of results that looks like this:&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;img src="../ci.axd?sid=d4e6a5e6-b68b-469f-8b46-93a968e7ba9e&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Note the&amp;nbsp; lack of of an OBJECT_NAME. This is because there is no objectid stored with the plan created by sp_executesql. So, if I had hundreds of procedures that generated hundreds or even thousands of different queries through a dynamic process like this, I have absolutely no way of know which of the hundreds of procedures generated which query without going through and doing text searches against the code. I have to worry about SQL injection and I&amp;rsquo;m going to be doing all kinds of crazy searches to find the code that I need to tune or modify? No, for me, this is a very poor design pattern and not one I would suggest people adopt.&lt;/p&gt;</description><a10:updated>2012-07-20T15:27:42Z</a10:updated></item><item><guid isPermaLink="false">25031e28-d05a-45e7-b158-c9d16b927400</guid><link>http://sqlservice.se/sv/start/blogg/veckans-fraga-med-svar--vecka-18.aspx?lang=sv</link><title>Veckans fråga med svar - vecka 18</title><description>&lt;p&gt;En av nyheterna n&amp;auml;r det g&amp;auml;ller SQL Server 2012 &amp;auml;r m&amp;ouml;jlighet till 15 000 partitioner.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Veckans fr&amp;aring;ga v 18&lt;/strong&gt; till H&amp;aring;kan Winther handlar om just partitionering.&lt;/p&gt;&#xD;
&lt;p&gt;N&amp;auml;r skall man anv&amp;auml;nda det och finns det n&amp;aring;gon bra tumregel f&amp;ouml;r hur stora tabellerna skall vara ?&lt;br /&gt;Vilka &amp;auml;r f&amp;ouml;rdelarna med partitionering och vilka eventuella nackdelar inneb&amp;auml;r det?&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Svar:&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Datakomprimering och partitionering &amp;auml;r n&amp;aring;gra av mina favorit features i SQL server som mycket v&amp;auml;l kan motivera kostnaden f&amp;ouml;r Enterprise edition fast&amp;auml;n den &amp;auml;r dyrare. I sj&amp;auml;lva verket s&amp;aring; kan man minska sina kostnader, &amp;ouml;ka tillg&amp;auml;nglighet och prestanda med komprimering och partitionering.&lt;/p&gt;&#xD;
&lt;p&gt;N&amp;auml;r ska man anv&amp;auml;nda partitionering? Som vanligt n&amp;auml;r det g&amp;auml;ller SQL server s&amp;aring; beror det p&amp;aring; (&amp;rdquo;it depends&amp;rdquo;). Det finns dock flera scenarier d&amp;auml;r man ska &amp;ouml;verv&amp;auml;ga, testa och implementera partitionering:&lt;/p&gt;&#xD;
&lt;p&gt;- Laddning, arkivering eller borttagning av data skapar l&amp;aring;sningar som p&amp;aring;verkar andra processer, eller tar f&amp;ouml;r l&amp;aring;ng tid&lt;br /&gt;- Omindexering av en hel tabell tar f&amp;ouml;r l&amp;aring;ng tid, p&amp;aring;verkar f&amp;ouml;r mycket eller service f&amp;ouml;nster saknas&lt;br /&gt;- Man har fr&amp;aring;gor som enbart s&amp;ouml;ker p&amp;aring; delm&amp;auml;ngder (partitioner) av data&lt;br /&gt;- Tabeller med columnstore index ska laddas med ny data&lt;br /&gt;- Man vill spara p&amp;aring; diskkostnad utan att f&amp;ouml;rlora prestanda p&amp;aring; den mest frekvent anv&amp;auml;nda partitionen&lt;/p&gt;&#xD;
&lt;p&gt;Det finns dock inte n&amp;aring;gra f&amp;ouml;rdelar som inte har n&amp;aring;gra nackdelar, framf&amp;ouml;rallt s&amp;aring; finns det en del begr&amp;auml;nsningar om man vill kunna nyttja &amp;rdquo;fast partition switching&amp;rdquo; f&amp;ouml;r att ladda eller arkivera data.&lt;/p&gt;&#xD;
&lt;p&gt;N&amp;aring;gra av f&amp;ouml;rdelarna med partitionering &amp;auml;r:&lt;/p&gt;&#xD;
&lt;p&gt;- Snabbare fr&amp;aring;gor som enbart hanterar ett f&amp;aring;tal paritioner&lt;br /&gt;- Olika komprimeringsniv&amp;aring; kan st&amp;auml;llas f&amp;ouml;r olika partitioner&lt;br /&gt;- En tabell kan spridas p&amp;aring; flera filgrupper som kan placeras mot olika typer av disksystem&lt;br /&gt;- Omindexering kan g&amp;ouml;ras p&amp;aring; enskilda partitioner, dock ej online&lt;br /&gt;- Data kan flyttas blixtrande snabbt mellan tabller tack vare fast partition switching&lt;/p&gt;&#xD;
&lt;p&gt;Vid sm&amp;aring; tabeller s&amp;aring; &amp;ouml;verv&amp;auml;ger nackdelarna men vid stor tabeller s&amp;aring; &amp;ouml;verstiger normalt f&amp;ouml;rdelarna, vilket g&amp;ouml;r att vinsten med partitionering p&amp;aring; sm&amp;aring; tabeller inte &amp;auml;r s&amp;aring; stor. Finns det d&amp;aring; n&amp;aring;gon bra tumregel som s&amp;auml;ger hur stor tabellen ska vara innan man utv&amp;auml;rderar partitionering? Inte n&amp;aring;gon direkt officiell tumregel, men personligen s&amp;aring; brukar jag &amp;ouml;verv&amp;auml;ga det vid tabeller p&amp;aring; &amp;ouml;ver 100GB eller om det finns problem som kan l&amp;ouml;sas av partitionering.&lt;/p&gt;&#xD;
&lt;p&gt;Det &amp;auml;r relativt l&amp;auml;tt att implementera partitioner, men det viktigaste att t&amp;auml;nka p&amp;aring; innan &amp;auml;r att v&amp;auml;lja en bra partitioneringsnyckel&lt;/p&gt;&#xD;
&lt;p&gt;Du kan l&amp;auml;sa mer om partitionering i kommande bloginl&amp;auml;gg, men om du har n&amp;aring;gra fr&amp;aring;gor som du vill ha svar p&amp;aring; redan nu s&amp;aring; &amp;auml;r du varmt v&amp;auml;lkommen att kontakta mig eller n&amp;aring;gra av v&amp;aring;ra SQL server konsulter.&lt;/p&gt;&#xD;
&lt;p&gt;/H&amp;aring;kan Winther&lt;/p&gt;</description><a10:updated>2012-07-20T15:27:07Z</a10:updated></item><item><guid isPermaLink="false">7f05b348-b15a-4933-9047-30c31a4fdf5b</guid><link>http://sqlservice.se/sv/start/blogg/slowly-changing-dimension--ssis-2012.aspx?lang=sv</link><title>Slowly Changing Dimension - SSIS 2012</title><description>&lt;p&gt;En klar f&amp;ouml;rb&amp;auml;ttring bland m&amp;aring;nga andra i nya SQL Server 2012 &amp;auml;r faktiskt den s&amp;aring; ofta hatade "Slowly Changing Dimension" i SSIS. Den har ju sina nackdelar n&amp;auml;r det g&amp;auml;ller prestanda, men f&amp;ouml;r mindre m&amp;auml;ngder &amp;auml;r den ganska ok. Det som tidigare har varit r&amp;auml;tt jobbigt &amp;auml;r n&amp;auml;r man gjort en uppdatering mha den. Detta &amp;auml;r nu l&amp;ouml;st p&amp;aring; detta s&amp;auml;tt som jag tycker &amp;auml;r helt ok, &amp;auml;n s&amp;aring; l&amp;auml;nge i alla fall :-). Visst blir det lite handp&amp;aring;l&amp;auml;ggning men klart b&amp;auml;ttre &amp;auml;n tidigare.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;F&amp;ouml;re :&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=266d4fdc-cf95-48de-9547-aa2ffff5e6a3&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Efter &amp;auml;ndringen:&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img src="../ci.axd?sid=d8f821b1-d85f-4b9e-ac8d-c44eccfd1fa1&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp; &lt;img src="../ci.axd?sid=55f84e3d-3c23-4725-96fd-5050e9340883&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;</description><a10:updated>2012-07-20T15:25:11Z</a10:updated></item><item><guid isPermaLink="false">1002aaa1-8539-418f-abdd-e90f7e6e2b8b</guid><link>http://sqlservice.se/sv/start/blogg/techdays-2012.aspx?lang=sv</link><title>TechDays 2012 </title><description>&lt;p&gt;&lt;img src="../ci.axd?sid=4db9688e-ea2c-41ec-9045-998a81558df8&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;SQL Service &amp;auml;r som vanligt representerade p&amp;aring; TechDays, b&amp;aring;de som talare och utst&amp;auml;llare. I &amp;aring;r visar vi bland annat SQL Server 2012, SQL Azure och givetvis visar vi upp v&amp;aring;r nya site som &amp;auml;r byggt p&amp;aring; SQL Azure och Windows Azure. Vi pratar &amp;auml;ven g&amp;auml;rna om v&amp;aring;rt kursutbud inom SQL Server, som vi genomf&amp;ouml;r i samarbete med LabCenter.&lt;/p&gt;&#xD;
&lt;p&gt;Kom g&amp;auml;rna f&amp;ouml;rbi v&amp;aring;r monter och h&amp;auml;lsa p&amp;aring;!&lt;/p&gt;</description><a10:updated>2012-07-20T15:24:49Z</a10:updated></item><item><guid isPermaLink="false">98699e87-2b2b-42ca-bd72-5ce693b518b9</guid><link>http://sqlservice.se/sv/start/blogg/what-is-the-difference-between-a-predicate-and-a-seek-predicate.aspx?lang=sv</link><title>What is the difference between a predicate and a seek predicate?</title><description>&lt;p&gt;If you look at the Index Seek operator in a query plan of a SQL Server SELECT query, you will sometimes see that you have both a Seek Predicate and also a Predicate.&lt;/p&gt;&#xD;
&lt;p&gt;So what is the difference between these two properties of the Index seek?&lt;/p&gt;&#xD;
&lt;p&gt;Seek Predicate is the seek operation that uses the b-tree part of the index to find matching rows.&lt;/p&gt;&#xD;
&lt;p&gt;Predicate is an operation that after the Seek Predicate operation does additional filterin using non-key columns (and sometimes also on indexed columns). If this is a non clustered index it seems unintuitive to me that we would not use only Seek Predicate (except on included columns) but I have seen i happen, and my theory so far is that it might be related to statistics.&lt;/p&gt;&#xD;
&lt;p&gt;In any case, you should expect much better performance from Seek Predicate operations only Index seeks compared to Index Seeks that include both Seek Predicate and Predicate properties.&lt;/p&gt;</description><a10:updated>2012-07-20T15:19:34Z</a10:updated></item><item><guid isPermaLink="false">0ca33b1b-1b9e-431c-b88c-8cb6d0ea6645</guid><link>http://sqlservice.se/sv/start/blogg/joke-time.aspx?lang=sv</link><title>Joke time!</title><description>&lt;p&gt;People think that we who work with databases are boring people -I say NO, we&amp;acute;re not:&lt;br /&gt;Proof (and one of my personal favorites!):&lt;/p&gt;&#xD;
&lt;p&gt;Q1: What did the DBA say to the Developer? A: It doesn&amp;rsquo;t matter, he wasn&amp;rsquo;t&amp;nbsp; listening anyway. &lt;br /&gt;Q2: What did the Developer say to the DBA? A: It doesn&amp;rsquo;t&amp;nbsp; matter, the answer was no.&lt;/p&gt;&#xD;
&lt;p&gt;Read more:&amp;nbsp; &lt;a href="http://www.bradmcgehee.com/2010/05/may-question-favorite-dba-joke/#ixzz1sQHD7wpE"&gt;http://www.bradmcgehee.com/2010/05/may-question-favorite-dba-joke/#ixzz1sQHD7wpE&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Under Creative Commons License: &lt;a href="http://creativecommons.org/licenses/by/3.0"&gt;Attribution&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Don&amp;acute;t forget to have fun out there, at least occasionally:)&lt;/p&gt;</description><a10:updated>2012-07-20T15:19:05Z</a10:updated></item><item><guid isPermaLink="false">4b00767a-71b2-4fad-9e9a-b15b36f71d53</guid><link>http://sqlservice.se/sv/start/blogg/forsta-uppdateringen-av-sql-server-2012.aspx?lang=sv</link><title>Första uppdateringen av SQL Server 2012</title><description>&lt;p&gt;Som f&amp;ouml;rv&amp;auml;ntat kom den f&amp;ouml;rsta s.k kumulativa uppdateringen av SQL Server 2012 ganska snabbt efter lanseringen. Man kan v&amp;auml;l ocks&amp;aring; anta att det varit l&amp;aring;st f&amp;ouml;r uppdateringar ganska l&amp;auml;nge f&amp;ouml;r utvecklingsteamet. Hur som helst finns den nu &lt;a href="http://support.microsoft.com/kb/2679368/en-us" target="_blank"&gt;h&amp;auml;r &lt;/a&gt;f&amp;ouml;r nedladdning.&lt;/p&gt;&#xD;
&lt;p&gt;Som vanligt g&amp;auml;ller det att alltid testa innan man g&amp;ouml;r f&amp;ouml;r&amp;auml;ndringar i produktionsmilj&amp;ouml;n.&lt;/p&gt;</description><a10:updated>2012-07-20T15:16:38Z</a10:updated></item><item><guid isPermaLink="false">0676ac94-234f-4f46-890b-6cc0ec714288</guid><link>http://sqlservice.se/sv/start/blogg/move-tsql-templates.aspx?lang=sv</link><title>Move T-SQL templates</title><description>&lt;p&gt;If you are a frequent user of templates in Management Studio you might have stumbled on the problem that when you change computer or reinstall your computer all your custom templates are gone. My first thought was that there must be an option to export the templates in Management Studio but there doesn't seem to be one. Ok, i guess they must be stored in the file system somewhere and if so, you can move your templates from one computer to another. Now we&amp;nbsp;just have to find them... It seems the templates are stored locally in&amp;nbsp;the profile and in my case i found them here: C:\Documents and Settings\JANNE\Application Data\Microsoft\Microsoft SQL Server\100\Tools\Shell\Templates\Sql&lt;/p&gt;&#xD;
&lt;p&gt;Where "JANNE" is a placeholder for whatever account name you might have. Now you just have to copy the parts you want and put them in the new location. There are a lot of pre-defined templates that you might not want to move but you can just copy the parts you want and that's all there is to it. Just remember to copy your custom templates before you reinstall. Same goes for your help favorites in Books Online. These can also be moved and i found them here: C:\Documents and Settings\Janne\Application Data\Microsoft\Microsoft SQL Server\100\Tools\Shell\vs help data The help favorites are located in a file called: Favorites.xml so all you have to do is move this file to the new location. &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T15:15:28Z</a10:updated></item><item><guid isPermaLink="false">71586d01-ff51-41a1-b97b-b550fccc6f9c</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-2012-+-sql-azure-=-sant.aspx?lang=sv</link><title>SQL server 2012 + SQL Azure = Sant</title><description>&lt;p&gt;Passa p&amp;aring; att tr&amp;auml;ffa och lyssna p&amp;aring; H&amp;aring;kan Winter i &amp;Ouml;rebro under TechDays den 26/4 och h&amp;ouml;r om &lt;a href="http://www.techdays.se/sessioner#/sessions/7672" target="_blank"&gt;SQL server 2012 + SQL Azure = Sant&lt;/a&gt;. Kom &amp;auml;ven och m&amp;ouml;t oss i v&amp;aring;r monter. Ses d&amp;auml;r! &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T15:15:03Z</a10:updated></item><item><guid isPermaLink="false">13dda71a-a4eb-41ac-b952-414399e0d45e</guid><link>http://sqlservice.se/sv/start/blogg/traffa-alberto-ferrari.aspx?lang=sv</link><title>Träffa Alberto Ferrari!</title><description>&lt;p&gt;Passa p&amp;aring; att tr&amp;auml;ffa och h&amp;ouml;ra Alberto Ferrari som kommer vara i Stockholm den 24/5. Tr&amp;auml;ffen sker p&amp;aring; n&amp;auml;sta m&amp;ouml;te i den svenska SQL Server anv&amp;auml;ndarf&amp;ouml;reningen. Anm&amp;auml;lan kan g&amp;ouml;ras &lt;a href="http://www.eventbrite.com/event/2916568535" target="_blank"&gt;h&amp;auml;r&lt;/a&gt;. Alberto Ferrari &amp;auml;r en v&amp;auml;lk&amp;auml;nd talare n&amp;auml;r det g&amp;auml;ller SSAS och bl.a. &amp;nbsp;medf&amp;ouml;rfattare till boken "Expert Cube Development with Microsoft SQL Server 2008 Analysis Services" som jag kan varmt rekommendera med m&amp;aring;nga tips &amp;amp; tricks, t.ex. n&amp;auml;r det g&amp;auml;ller prestandaoptimeringar av kuber.&lt;/p&gt;</description><a10:updated>2012-07-20T15:14:40Z</a10:updated></item><item><guid isPermaLink="false">aa978265-613f-405a-8635-48b9fab48bcd</guid><link>http://sqlservice.se/sv/start/blogg/veckans-fraga-med-svar--vecka-14.aspx?lang=sv</link><title>Veckans fråga med svar - vecka 14</title><description>&lt;p&gt;Martin skrev i senaste "Veckans fr&amp;aring;ga" en hel del om exekveringsplaner. Av erfarenheter vet vi att dessa inte &amp;auml;r helt l&amp;auml;tta att l&amp;auml;sa.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Veckans fr&amp;aring;ga vecka 14&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Finns det n&amp;aring;got tips&amp;nbsp;p&amp;aring; hur man kan l&amp;auml;ra sig att l&amp;auml;sa dem?&lt;/p&gt;&#xD;
&lt;p&gt;Svar : Jag brukar studera f&amp;ouml;ljande gratisbok: SQL Server Execution Plans&amp;nbsp;av &amp;nbsp;&lt;a href="http://www.sqlservercentral.com/Authors/Articles/Grant_Fritchey/21410/"&gt;Grant Fritchey&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Som finns tillg&amp;auml;nglig h&amp;auml;r: &lt;a href="http://downloads.sqlservercentral.com/Books/dissecting_complete.pdf?utm_source=ssc&amp;amp;utm_medium=weblink&amp;amp;utm_content=Grant&amp;amp;utm_campaign=sqltoolbelt"&gt;http://downloads.sqlservercentral.com/Books/dissecting_complete.pdf?utm_source=ssc&amp;amp;utm_medium=weblink&amp;amp;utm_content=Grant&amp;amp;utm_campaign=sqltoolbelt&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;/Joakim Nystr&amp;ouml;m&lt;/p&gt;</description><a10:updated>2012-07-20T15:12:02Z</a10:updated></item><item><guid isPermaLink="false">eea850e3-1257-4bf2-9acc-8170d617b84c</guid><link>http://sqlservice.se/sv/start/blogg/lagre-priser-pa-sql-azure.aspx?lang=sv</link><title>Lägre priser på SQL Azure!</title><description>&lt;p&gt;Microsoft har justerat ned priserna p&amp;aring; &lt;a href="http://www.windowsazure.com"&gt;SQL Azure&lt;/a&gt;&amp;nbsp;och &amp;auml;ven &amp;auml;ndrat debiteringsmodellen n&amp;aring;got. H&amp;auml;r nedan ser du de nya priserna i Svenska kronor. Som det framg&amp;aring;r av tabellen kan det inneb&amp;auml;ra upp till 95% l&amp;auml;gre pris i vissa fall!&lt;/p&gt;&#xD;
&lt;table style="width: 450px; height: 414px;" border="1" cellspacing="0" cellpadding="0"&gt;&#xD;
&lt;tbody&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td rowspan="2" width="120"&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;Databasstorlek&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td rowspan="2" width="210"&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;Pris Per Databas Per M&amp;aring;nad&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td colspan="2" valign="bottom"&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;Besparing j&amp;auml;mf&amp;ouml;rt med tidigare pris&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td width="123"&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;Web Edition&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td width="115"&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;Business Edition&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td width="120"&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;Upp till 100 MB&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;33,5290 kr&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td width="123"&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;50%&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td width="115"&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;95%&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td width="120"&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;Mer &amp;auml;n 100 MB upp till 1 GB&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;67,0579 kr&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td width="123"&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;Samma pris&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td width="115"&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;90%&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;Mer &amp;auml;n 1 GB upp till 10 GB&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;67,0579 kr f&amp;ouml;r f&amp;ouml;rsta GB&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;26,8232 kr f&amp;ouml;r varje extra GB &lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;30% till 48%&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;54% till 86%&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;Mer &amp;auml;n 10 GB upp till 50 GB&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;308,4667 kr f&amp;ouml;r f&amp;ouml;rsta GB&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;13,4116 kr f&amp;ouml;r varje extra GB&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;N/A&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;75% till 76%&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;tr&gt;&#xD;
&lt;td width="120"&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;Mer &amp;auml;n 50 GB upp till 150 GB&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;844,9307 kr f&amp;ouml;r f&amp;ouml;rsta GB&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;6,7058 kr f&amp;ouml;r varje extra GB&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td width="123"&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;N/A&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;td width="115"&gt;&#xD;
&lt;p align="center"&gt;&lt;strong&gt;55% till 75%&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;/td&gt;&#xD;
&lt;/tr&gt;&#xD;
&lt;/tbody&gt;&#xD;
&lt;/table&gt;</description><a10:updated>2012-07-20T15:10:24Z</a10:updated></item><item><guid isPermaLink="false">f5e42d18-f242-44c8-a2b7-5a34dbaea270</guid><link>http://sqlservice.se/sv/start/blogg/optimize-for-ad-hoc.aspx?lang=sv</link><title>Optimize for Ad hoc</title><description>&lt;p&gt;Ett problem som kan intr&amp;auml;ffa om man har m&amp;aring;nga olika varianter av ad hoc fr&amp;aring;gor som aldrig upprepas &amp;auml;r att plan cachen kan fyllas upp med en massa planer som aldrig kommer anv&amp;auml;ndas. F&amp;ouml;r att undvika detta scenario finns kan man konfigurera SQL Server s&amp;aring; att effekten av detta minimeras. Detta kan man dels g&amp;ouml;ra i Management Studio under Server Properties/Advanced d&amp;auml;r man hittar flaggan "Optimize for Ad hoc Workloads" eller med sp_configure. Denna ser till s&amp;aring; att f&amp;ouml;rsta g&amp;aring;ngen en plan sparas s&amp;aring; sparas endast en liten del av planen och d&amp;auml;rmed utnyttjas cachen b&amp;auml;ttre. Skulle nu samma fr&amp;aring;ga komma en g&amp;aring;ng till s&amp;aring; kommer SQL Server att spara en fullst&amp;auml;ndig plan i cachen och fr&amp;aring;gan behandlas d&amp;auml;refter som vanligt. Innan man ger sig p&amp;aring; detta m&amp;aring;ste man ha koll p&amp;aring; vad som finns i plan cachen. Detta kan man ta reda p&amp;aring; genom att studera sys.dm_exec_cached_plans som visar hur f&amp;ouml;rdelningen ser ut men vad vi egentligen &amp;auml;r intresserade av &amp;auml;r hur mycket av cachen som upptas av planer f&amp;ouml;r ad hoc fr&amp;aring;gor som bara k&amp;ouml;rts en g&amp;aring;ng.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://www.sqlskills.com/BLOGS/KIMBERLY/post/Procedure-cache-and-optimizing-for-adhoc-workloads.aspx"&gt;H&amp;auml;r&lt;/a&gt; kan man hitta ett skript som visar hur mycket utrymme som upptas av respektive objekttyp i cachen. Om du uppt&amp;auml;cker att st&amp;ouml;rre delen av cachen upptas av planer f&amp;ouml;r ad hoc fr&amp;aring;gor som bara k&amp;ouml;rts en g&amp;aring;ng kan det vara l&amp;auml;ge att anv&amp;auml;nda sig av "Optimize for Ad hoc Workloads".&lt;/p&gt;&#xD;
&lt;p&gt;Om du beh&amp;ouml;ver hj&amp;auml;lp med att avg&amp;ouml;ra vad som &amp;auml;r b&amp;auml;st f&amp;ouml;r just din milj&amp;ouml; s&amp;aring; hj&amp;auml;lper v&amp;aring;ra SQL Server konsulter g&amp;auml;rna till.&lt;/p&gt;</description><a10:updated>2012-07-20T15:09:52Z</a10:updated></item><item><guid isPermaLink="false">7ac92091-6787-43d1-b897-6a3c848aceab</guid><link>http://sqlservice.se/sv/start/blogg/24-hours-of-pass-sql-server-2012.aspx?lang=sv</link><title>24 Hours of PASS: SQL Server 2012</title><description>&lt;p&gt;Nu finns samtliga sessioner tillg&amp;auml;ngliga fr&amp;aring;n 24 Hours of Pass som h&amp;ouml;lls f&amp;ouml;r tv&amp;aring; veckor sedan under ett helt dygn. Detta kr&amp;auml;ver att man &amp;auml;r registrerad anv&amp;auml;ndare hos PASS, men detta &amp;auml;r helt gratis och n&amp;aring;got som jag hursomhelst rekommenderar. Tyv&amp;auml;rr h&amp;ouml;ll inte &amp;aring;rets dragningar, uppl&amp;auml;gg och tekniska l&amp;ouml;sning samma h&amp;ouml;ga kvalitet som tidigare &amp;aring;r. Dock hittar man alltid n&amp;aring;got guldkorn och Grant Fritchley h&amp;aring;ller som vanligt h&amp;ouml;g klass. Allting hittar ni &lt;a href="http://www.sqlpass.org/UserLogin.aspx?returnurl=%2fLearningCenter%2fSessionRecordings%2f24HoursSpring2012.aspx" target="_blank"&gt;h&amp;auml;r&lt;/a&gt;. &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T15:08:57Z</a10:updated></item><item><guid isPermaLink="false">801b9f7b-4c03-42e3-b32d-3a3cdec9a62c</guid><link>http://sqlservice.se/sv/start/blogg/microsoft-business-intelligence-conference--power-to-the-user.aspx?lang=sv</link><title>Microsoft Business Intelligence Conference - Power to the User! </title><description>&lt;p&gt;F&amp;ouml;rra veckan h&amp;ouml;lls den &amp;aring;rliga BI-konferansdagen med &lt;a href="http://projectbotticelli.com/" target="_blank"&gt;Rafal Lukawiecki&lt;/a&gt;. Denna g&amp;aring;ng f&amp;ouml;r Stockholm p&amp;aring; Cirkus och en mycket bra dag d&amp;auml;r det mesta var riktigt bra. Lite f&amp;ouml;rv&amp;aring;nad var Rafal n&amp;auml;r s&amp;aring; f&amp;aring; av deltagarna hade anv&amp;auml;nt Power Pivot som inte &amp;auml;r en nyhet f&amp;ouml;r SQL Server 2012, men d&amp;auml;remot klart f&amp;ouml;rb&amp;auml;ttrad med den nya versionen d&amp;auml;r man f&amp;aring;tt ihop helheten med SQL Servers nya version. Passa d&amp;auml;rf&amp;ouml;r p&amp;aring; att sj&amp;auml;lv prova p&amp;aring; nyheterna genom att boka upp er f&amp;ouml;r v&amp;aring;ra kommande utbildningar som vi h&amp;aring;ller ihop med LabCenter d&amp;auml;r vi g&amp;aring;r igenom m&amp;aring;nga av nyheterna och bjuder p&amp;aring; rikligt med exempel. N&amp;auml;sta tillf&amp;auml;lle g&amp;aring;r i Stockholm om tv&amp;aring; veckor&amp;nbsp;och anm&amp;auml;lan sker direkt i mail till &lt;a href="mailto:patrik.sandqvist@labcenter.se"&gt;patrik.sandqvist@labcenter.se&lt;/a&gt;.&lt;/p&gt;</description><a10:updated>2012-07-20T15:08:12Z</a10:updated></item><item><guid isPermaLink="false">c9b2f661-e833-4f69-995f-6f3ee918a20a</guid><link>http://sqlservice.se/sv/start/blogg/nya-forbattringar-av-sql-server-2008.aspx?lang=sv</link><title>Nya förbättringar av SQL Server 2008</title><description>&lt;p&gt;F&amp;ouml;r er som anv&amp;auml;nder SQL Server 2008 &amp;auml;r det v&amp;auml;rt att kontrollera de f&amp;ouml;rb&amp;auml;ttringar som nu &amp;auml;r tillg&amp;auml;ngliga i nya sk kumulativa uppdateringar. &lt;a href="http://support.microsoft.com/kb/2673382" target="_blank"&gt;SQL Server 2008 SP2 Cumulative Update 9 &lt;/a&gt;&lt;a href="http://support.microsoft.com/kb/2673383" target="_blank"&gt;SQL Server 2008 SP3 Cumulative Update 4 &lt;/a&gt; Som vanligt g&amp;auml;ller det att alltid testa innan man g&amp;ouml;r f&amp;ouml;r&amp;auml;ndringar i produktionsmilj&amp;ouml;n.&lt;/p&gt;</description><a10:updated>2012-07-20T15:07:28Z</a10:updated></item><item><guid isPermaLink="false">27cb5424-4adc-4ecf-b6bb-87f7fce9b6c9</guid><link>http://sqlservice.se/sv/start/blogg/server-side-trace.aspx?lang=sv</link><title>Server side trace</title><description>&lt;p&gt;T&amp;auml;nkte ta tillf&amp;auml;llet i akt och sl&amp;aring; ett slag f&amp;ouml;r server side trace. Server side tracing har m&amp;aring;nga f&amp;ouml;rdelar framf&amp;ouml;r att k&amp;ouml;ra trace med Profiler.&lt;/p&gt;&#xD;
&lt;p&gt;Den fr&amp;auml;msta f&amp;ouml;rdelen &amp;auml;r att den &amp;auml;r betydligt mindre resurskr&amp;auml;vande. En server side trace har en n&amp;auml;stintill obetydlig p&amp;aring;verkan p&amp;aring; serverns prestanda medan en trace med Profiler faktiskt har viss inverkan. Den som vill veta mer om detta kan l&amp;auml;sa &lt;a href="http://sqlblog.com/blogs/linchi_shea/archive/2007/08/01/trace-profiler-test.aspx" target="_blank"&gt;h&amp;auml;r&lt;/a&gt;: Personligen tycker jag att server side trace &amp;auml;ven &amp;auml;r mycket mer flexibel. T. ex. kan man med hj&amp;auml;lp av SQL Server Agent schemal&amp;auml;gga en trace med start tid och skripta in stop tid.&lt;br /&gt;En f&amp;ouml;rdel om man inte vill sitta uppe kl 03.30 en l&amp;ouml;rdagsnatt med profiler i h&amp;ouml;gsta hugg f&amp;ouml;r att starta en trace...&lt;/p&gt;&#xD;
&lt;p&gt;En annan sak som talar emot att k&amp;ouml;ra trace med Profiler &amp;auml;r det faktum att den tempor&amp;auml;rt lagrar resultatet under anv&amp;auml;ndarens profil vilket kan resultera i att man fyller upp diskutrymme snabbt om man har en h&amp;aring;rt belastad server, n&amp;aring;got jag sj&amp;auml;lv r&amp;aring;kade ut f&amp;ouml;r en g&amp;aring;ng f&amp;ouml;r l&amp;auml;nge sedan innan jag visste b&amp;auml;ttre, och att fylla upp C: brukar s&amp;auml;llan vara en god id&amp;eacute;.&lt;/p&gt;&#xD;
&lt;p&gt;Om man, f&amp;ouml;r att undvika ovanst&amp;aring;nde, k&amp;ouml;r Profiler fr&amp;aring;n en annan dator och inte direkt p&amp;aring; servern skall man vara medveten om att man ist&amp;auml;llet f&amp;ouml;rbrukar bandbredd som st&amp;aring;r i direkt proportion till belastningen p&amp;aring; servern. Nu vill jag inte p&amp;aring;st&amp;aring; att man aldrig skall anv&amp;auml;nda Profiler. Om man tex snabbt vill k&amp;ouml;ra en trace f&amp;ouml;r att studera n&amp;aring;got specifikt under en begr&amp;auml;nsad tid s&amp;aring; &amp;auml;r det troligtvis enklare att bara anv&amp;auml;nda Profiler, g&amp;ouml;ra det man skall och sedan stoppa tracen. Att skapa en server side trace &amp;auml;r enkelt. Anv&amp;auml;nd Profiler f&amp;ouml;r att g&amp;ouml;ra alla inst&amp;auml;llningar, skripta ut trace definitionen, editera l&amp;auml;mpliga parametrar och starta sedan din trace i ett queryf&amp;ouml;nster eller schemal&amp;auml;gg med SQL Server Agent. Oavsett vilket man v&amp;auml;ljer s&amp;aring; skall man alltid se till att filtrera noga annars riskerar man att datam&amp;auml;ngden&amp;nbsp;blir&amp;nbsp;v&amp;auml;ldigt stor&amp;nbsp;och med det &amp;auml;ven ens m&amp;ouml;jligheter att hitta det man s&amp;ouml;ker. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T15:06:28Z</a10:updated></item><item><guid isPermaLink="false">d145b6f3-bda5-465b-8f61-c6b41131aa4a</guid><link>http://sqlservice.se/sv/start/blogg/how-to-redirect-ssrs-url.aspx?lang=sv</link><title>How to redirect SSRS URL</title><description>&lt;p&gt;When you install &lt;a href="http://microsoft.com/sql"&gt;SQL Server&lt;/a&gt; Reporting Services version 2008 and 2008 R2, you do not need to install IIS. Even so the reports are web based, and accessed through a browser. This works because SSRS uses windows HTTP.SYS functionality to listen to &lt;a href="http://servername:80/reports"&gt;http://servername:80/reports&lt;/a&gt; wich is your default reports URL. But what if you instead want to access your reports at &lt;a href="http://servername"&gt;http://servername&lt;/a&gt; ? Out of the box, you can't do that. So I wanted to share a little tips on how to accomplish that with minimum effort: 1. Install the "Web Server" Windows Server Role, and include the "HTTP Redirect" feature 2. Click on your server name and HTTP Redirect in IIS Manager (From Server Manager) and redirect from the default path to"/reports". Apply changes 3.&lt;/p&gt;&#xD;
&lt;p&gt;Done! &amp;nbsp; &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T15:03:35Z</a10:updated></item><item><guid isPermaLink="false">1747bd51-3348-42e2-8d2b-979352385ff0</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-2012--alwayson-2.aspx?lang=sv</link><title>SQL Server 2012 - AlwaysOn #2</title><description>&lt;p&gt;In previous blog post I wrote about one of the main benefits of AlwaysOn in SQL server 2012 and today I writing about another interesting benefit of AlwaysOn. Backups can actually be conducted on any of the replicas participating in the availability group, and you can even spread the log backups between multiple replicas! The log backups on the secondaries form a single log chain. If you experience performance issues in your primary database, you can move the workload of backups from your primary database to increase the performance. I haven&amp;rsquo;t tried it myself yet and I would have serious thoughts and serious testing before I would try it myself. If you spread the log backups to multiple secondaries you should store all the backups in a central location as you would need the complete log chain&amp;nbsp;WHEN, not if,&amp;nbsp;you need to restore the database. Backups is not something you would play around with, and you should make sure you have a well-documented and tested backup AND restore strategy. If you don&amp;rsquo;t have one, you can contact any of our SQL server experts and we will help you with that. Don&amp;rsquo;t wait with the backup/restore strategy to it`&amp;acute;s to late!&lt;/p&gt;</description><a10:updated>2012-07-20T15:02:54Z</a10:updated></item><item><guid isPermaLink="false">7f9ebc21-dc26-408a-8129-602e0214f28e</guid><link>http://sqlservice.se/sv/start/blogg/veckans-fraga-med-svar--vecka-12.aspx?lang=sv</link><title>Veckans fråga med svar - vecka 12</title><description>&lt;p&gt;&lt;span style="font-size: x-small;"&gt;Veckans fr&amp;aring;ga kommer ovan molnen p&amp;aring; v&amp;auml;g till v&amp;aring;r n&amp;auml;sta utbildning i G&amp;ouml;teborg. Steinar skrev f&amp;ouml;rra veckan att det blir viktigt att kunna klara sig p&amp;aring; s&amp;aring; f&amp;aring; CORE som m&amp;ouml;jligt av kostnadssk&amp;auml;l med SQL Server 2012 pga den nya licensmodellen. &lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: x-small;"&gt;Fr&amp;aring;ga vecka 12&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Vad kan vi som utvecklare g&amp;ouml;ra f&amp;ouml;r att klara oss med f&amp;auml;rre CORE ?&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Svar:&lt;/strong&gt; Hittills har vi som utvecklare kommit ganska lindrigt undan &amp;auml;ven om vi skulle slarva med att kontrollera hur v&amp;aring;ra fr&amp;aring;gor verkligen exekveras. Saknas det t. ex. ett index och SQL&amp;nbsp;Servers optimerare v&amp;auml;ljer&amp;nbsp; att g&amp;ouml;ra en "table scan" s&amp;aring; kan dessa ofta g&amp;ouml;ras parallellt. Har vi d&amp;aring; tillg&amp;aring;ng till m&amp;aring;nga k&amp;auml;rnor s&amp;aring; g&amp;aring;r det ganska fort i alla fall. Nu &amp;auml;r det slut med det. Sj&amp;auml;lvfallet skall vi &amp;auml;ven i forts&amp;auml;ttningen utnyttja flera k&amp;auml;rnor n&amp;auml;r vi beh&amp;ouml;ver det - men det blir &amp;auml;n viktigare att g&amp;ouml;ra det i R&amp;Auml;TT fr&amp;aring;gor och inte sl&amp;ouml;sa med det. &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Orsaker till parallellism och hur vi hanterar den:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;- Komplexa och/eller l&amp;aring;nga fr&amp;aring;gor&lt;br /&gt;&lt;/strong&gt;Vissa typer av fr&amp;aring;gor kr&amp;auml;ver hantering av stora datam&amp;auml;ngder, t.ex. rapporter med aggregerad information. Dessa har ofta mycket att vinna p&amp;aring; att utnyttja flera k&amp;auml;rnor och ska f&amp;aring; g&amp;ouml;ra det i forts&amp;auml;ttningen ocks&amp;aring;. &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;strong&gt;- Saknade/felaktiga index&lt;br /&gt;&lt;/strong&gt;Ett saknat index kan leda till on&amp;ouml;dig parallellisering av fr&amp;aring;gor som med r&amp;auml;tt index skulle kunna exekvera snabbt &amp;auml;ven p&amp;aring; en k&amp;auml;rna.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;- Ta f&amp;ouml;r vana att inte bara kontrollera att du f&amp;aring;r r&amp;auml;tt svar - utan kasta ocks&amp;aring; ett &amp;ouml;ga p&amp;aring; exekveringsplanen.&lt;br /&gt;&lt;/strong&gt;Titta efter de typiska bl&amp;aring;a symbolerna, du ser dem snabbt. &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;strong&gt;- Konfiguration&lt;br /&gt;&lt;/strong&gt;SQL Server har huvudsakligen tv&amp;aring; inst&amp;auml;llningar som avg&amp;ouml;r om en viss fr&amp;aring;ga kommer att k&amp;ouml;ras parallellt eller ej (f&amp;ouml;rutsatt att det g&amp;aring;r!). Dessa inst&amp;auml;llningar ligger ibland utanf&amp;ouml;r utvecklarens kontroll, men det &amp;auml;r viktigt att k&amp;auml;nna till hur de fungerar. (Och m&amp;aring;nga utvecklare dubblerar ju som DBA ocks&amp;aring;!) Du kan enkelt kontrollera vilka inst&amp;auml;llningar du har med denna fr&amp;aring;ga: &lt;em&gt;&amp;nbsp;SELECT name, value_in_use&lt;/em&gt; &lt;em&gt;FROM sys.configurations c&lt;/em&gt; &lt;em&gt;WHERE c.name LIKE '%max degree%'&lt;/em&gt; &lt;em&gt;OR c.name LIKE '%cost threshold%'&lt;/em&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;strong&gt;- Max degree of parallelism (MAXDOP)&lt;/strong&gt; &lt;br /&gt;Anger hur m&amp;aring;nga k&amp;auml;rnor varje steg i exekveringsplanen maximalt kan utnyttja och kan st&amp;auml;llas in mellan 0 och max antal k&amp;auml;rnor p&amp;aring; servern. (0=parallellisera maximalt, 1="avst&amp;auml;ngd" parallellisering). Vilket v&amp;auml;rde som &amp;auml;r optimalt beror bland annat p&amp;aring; antalet tillg&amp;auml;ngliga k&amp;auml;rnor, vilket typ av fr&amp;aring;gor som st&amp;auml;lls (komplexa eller enkla) mm, men det f&amp;aring;r vi &amp;aring;terkomma till. &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;- Cost threshold for parallelism&lt;/strong&gt; &lt;br /&gt;F&amp;ouml;r varje exekveringsplan som SQL Server tar fram ber&amp;auml;knas en total "kostnad" f&amp;ouml;r exekveringen &amp;nbsp;("Estimated subtree cost" i bilden nedan). Om den kostnaden f&amp;ouml;r den sekvensiella planen &amp;auml;r h&amp;ouml;gre &amp;auml;n "cost threshold" s&amp;aring; f&amp;ouml;rs&amp;ouml;ker SQL Server hitta en billigare parallell plan ist&amp;auml;llet. Denna inst&amp;auml;llning har haft defaultv&amp;auml;rdet 5 &amp;auml;nda sedan SQL 2000 (och har det fortfarande i SQL 2012!), vilket &amp;auml;r alldeles f&amp;ouml;r l&amp;aring;gt i de flesta sammanhang. En fr&amp;aring;ga med s&amp;aring; l&amp;aring;g kostnad vinner oftast inte mycket p&amp;aring; att parallelliseras. Vad &amp;auml;r d&amp;aring; "r&amp;auml;tt" inst&amp;auml;llning? Som vanligt; det beror p&amp;aring;. Ett s&amp;auml;tt att hitta en hyfsad niv&amp;aring; &amp;auml;r att titta p&amp;aring; de planer som SQL Server har sparat i cachen. D&amp;auml;r plockar vi fram alla fr&amp;aring;gor som k&amp;ouml;rs parallellt och g&amp;aring;r igenom de med l&amp;auml;gst kostnad. Dessa testk&amp;ouml;r vi b&amp;aring;de parallellt och sekventiellt (anv&amp;auml;nd query hint OPTION (MAXDOP 1)) och j&amp;auml;mf&amp;ouml;r exekveringstiderna. &amp;Auml;r den inte avsev&amp;auml;rt l&amp;auml;ngre s&amp;aring; kan vi h&amp;ouml;ja cost threshold till strax &amp;ouml;ver den (sekventiella) kostnaden. &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Var ska jag b&amp;ouml;rja d&amp;aring;?&lt;/strong&gt; &lt;br /&gt;Titta p&amp;aring; de aktuella fr&amp;aring;gorna i cachen med hj&amp;auml;lp av denna fr&amp;aring;ga. Sedan &amp;auml;r det bara till att beta av dem en efter en. OBS! P&amp;aring; st&amp;ouml;rre system kan den ta l&amp;aring;ng tid att k&amp;ouml;ra och det &amp;auml;r b&amp;auml;st att k&amp;ouml;ra den n&amp;auml;r det inte &amp;auml;r s&amp;aring; h&amp;ouml;g belastning! &amp;nbsp;&lt;/p&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier;"&gt;WITH XMLNAMESPACES (DEFAULT 'http://schemas.microsoft.com/sqlserver/2004/07/showplan')&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="font-family: courier new,courier;"&gt;SELECT&amp;nbsp; n.value('(@StatementSubTreeCost)[1]', 'VARCHAR(128)') AS Cost &amp;nbsp;&lt;br /&gt; , n.query('.').exist('//RelOp[@PhysicalOp="Parallelism"]') AS IsParallel &amp;nbsp;&lt;br /&gt; , cp.objtype &amp;nbsp;&lt;br /&gt; , cp.usecounts &amp;nbsp;&lt;br /&gt; , cp.size_in_bytes &amp;nbsp;&lt;br /&gt; , st.text AS SQLStatement &amp;nbsp;&lt;br /&gt; , query_plan &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;FROM sys.dm_exec_cached_plans AS cp &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;CROSS APPLY sys.dm_exec_query_plan(plan_handle) AS eqp &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;CROSS APPLY sys.dm_exec_sql_text(plan_handle) AS st &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;CROSS APPLY query_plan.nodes('/ShowPlanXML/BatchSequence/Batch/Statements/StmtSimple') AS qn(n) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;WHERE&amp;nbsp; n.query('.').exist('//RelOp[@PhysicalOp="Parallelism"]')&amp;nbsp; = 1 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;ORDER BY IsParallel DESC, Cost&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;p&gt;&amp;nbsp;/Martin H&amp;ouml;glund&lt;/p&gt;</description><a10:updated>2012-07-20T15:02:05Z</a10:updated></item><item><guid isPermaLink="false">32e6ac5c-4fb8-4d64-a249-085b1774fd65</guid><link>http://sqlservice.se/sv/start/blogg/the-eternal-search-for-missing-indexes,-part-3.aspx?lang=sv</link><title>The eternal search for missing indexes, part 3</title><description>&lt;p&gt;Hi again and thank you for all replies! &lt;br /&gt;Now that you aquainted yourself with the missing index dmv:s, it is time to set the tools into proper work!&lt;/p&gt;&#xD;
&lt;p&gt;The best use of the dmv:s is actually to get a quick notice about which table is having the most problem trying to stay up to date. The top table in the dmv list is having issues. Key key for you as dba is to find out WHAT exactly the problem IS...&lt;/p&gt;&#xD;
&lt;p&gt;I normally start by setting ut a (server) trace of table access (as&amp;nbsp;I&amp;nbsp; normally am not involved in the software development process, for some strange reason; google: "developer dba conflict"). By analyzign the trace I will get two major results:&lt;/p&gt;&#xD;
&lt;p&gt;1. The highest average CPU process&amp;nbsp;&lt;br /&gt;2. The most frequent process.&lt;/p&gt;&#xD;
&lt;p&gt;The highest CPU is normally located to a poorly designed stored procedure, which is a fun problem for a DBD to chew on, the second problem is something you will have to contact the dev. team to have corrected (Q: Why the "&amp;amp;# are you asking "SELECT * FROM table" 60 times per minute in your application, ever heard of caching?). Finally, you will NOT use the dmv:s to create your new indexes, but instead via the steps above find the slow parts of the stored procedure and feed these parts into the Database Enging Tuning Advisor, which is a MUCH more qualified tool than the dmv:s. Don't forget, however, that the dmv:s will always tell you WHERE the problem lies, which the DETA will not.&lt;/p&gt;&#xD;
&lt;p&gt;Happy hunting!&lt;/p&gt;</description><a10:updated>2012-07-20T14:58:07Z</a10:updated></item><item><guid isPermaLink="false">941521f9-2e0d-4642-8681-c3608c39c0d4</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-virtual-labs.aspx?lang=sv</link><title>SQL Server virtual labs</title><description>&lt;p&gt;Have you ever wanted to just quickly have a look at a specific feature of SQL Server, without having to install the whole product on your computer? That is exacly what &lt;a href="http://www.microsoft.com/sqlserver/en/us/learning-center/virtual-labs.aspx"&gt;SQL Server Virtual Labs&lt;/a&gt; are for! Just klick in on &lt;a href="http://www.microsoft.com/sqlserver/en/us/learning-center/virtual-labs.aspx"&gt;http://www.microsoft.com/sqlserver/en/us/learning-center/virtual-labs.aspx&lt;/a&gt; and choose a lab, you will be up and running in minutes! At the moment there are 16 SQL Server labs available, covering SQL 2012 and SQL 2008 R2. If you want to do real life labs, SQL Service and LabCenter is giving SQL Server 2012 related labs in, more information about that is &lt;a href="http://sqlservice.se/events/sql-server-2012-administrator-skills-upgrade/"&gt;here&lt;/a&gt;, &lt;a href="http://sqlservice.se/events/sql-server-2012-business-intelligencedeveloper-skills-upgrade/"&gt;here&amp;nbsp;&lt;/a&gt;and &lt;a href="http://labcenter.se/labs.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;</description><a10:updated>2012-07-20T14:54:07Z</a10:updated></item><item><guid isPermaLink="false">f7108aef-2d1b-406b-9d91-a81ee4ead253</guid><link>http://sqlservice.se/sv/start/blogg/24-hours-of-pass-sql-server-2012.aspx?lang=sv</link><title>24 Hours of PASS: SQL Server 2012</title><description>&lt;p&gt;P&amp;aring; onsdag &amp;auml;r det dags f&amp;ouml;r &lt;a href="http://www.sqlpass.org/24hours/spring2012/" target="_blank"&gt;24 Hours of PASS: SQL Server 2012&lt;/a&gt;. Under ett helt dygn h&amp;aring;lls 24 stycken sessioner om SQL Server. Sj&amp;auml;lvklart handlar mycket om SQL Server 2012 och man f&amp;aring;r ocks&amp;aring; ett smakprov av vad som skall komma i Seattle i november. Allts&amp;aring; v&amp;auml;l v&amp;auml;rt tid f&amp;ouml;r att l&amp;auml;ra sig mer om SQL Server. &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T11:40:07Z</a10:updated></item><item><guid isPermaLink="false">8a7fe433-c29f-46db-953d-e2deb6e18c0b</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-2012--alwayson-1.aspx?lang=sv</link><title>SQL Server 2012 - alwayson #1</title><description>&lt;p&gt;In the newly released &lt;a href="http://www.microsoft.com/sqlserver/en/us/product-info/overview-capabilities.aspx" target="_blank"&gt;SQL server 2012&lt;/a&gt; you get some nice features and one of the best is &lt;a href="http://msdn.microsoft.com/en-us/library/ff877884(v=sql.110).aspx" target="_blank"&gt;AlwaysOn&lt;/a&gt;. You can use AlwaysOn to create a high availability &amp;amp; disaster recovery solution without the shared storage requirement as you have in a normal &lt;a href="http://msdn.microsoft.com/en-us/library/ms189134.aspx" target="_blank"&gt;clustered &lt;/a&gt;environment. A side effect of this is that you can place your tempdb on local storage with some super fast SSD drives. That will increase the performance of queries that depend heavily on tempdb usage. Tempdb is used for temporary storage for sorting, &lt;a href="http://msdn.microsoft.com/en-us/library/ms177673.aspx" target="_blank"&gt;grouping&lt;/a&gt;, hash matching, &lt;a href="http://msdn.microsoft.com/en-us/library/ms175492.aspx" target="_blank"&gt;row versioning &lt;/a&gt;and temporary object. Using SSD drives in your SAN is may be very expensive, depending on how many SSD drives you need, but as SSD drives give you a lot more IOPS, you don't need as many as you would with FibreChannel disks and a couple of local SSD drives for your tempdb files may give you a real heavy performance boost. If you want to know more about SQL server 2012 you may contact any of our SQL server experts and we will help you.&lt;/p&gt;&#xD;
&lt;p&gt;You can also sign up for&amp;nbsp;our 2 day course held at &lt;a href="http://labcenter.se/lab/2111" target="_blank"&gt;LabCenter&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-07-20T11:39:47Z</a10:updated></item><item><guid isPermaLink="false">1a85de6e-67db-4f9e-9ec6-61830320704b</guid><link>http://sqlservice.se/sv/start/blogg/guest-blog-keeping-track-of-sql-server-agent-job-durations.aspx?lang=sv</link><title>Guest Blog: Keeping track of SQL Server Agent job durations</title><description>&lt;p&gt;About me My name is Mikael Cedersved, also (un)known as FrozenFishes. I&amp;rsquo;m a 26 year old DBA and BI developer from Sweden, working in the health care industry. I&amp;rsquo;ve been working with SQL server for 4 years. This is actually my first sql server related blog post, and I hope there&amp;rsquo;s several more to come. I&amp;rsquo;m about to launch my own blog at &lt;a href="http://frozenfishes.wordpress.com/"&gt;http://frozenfishes.wordpress.com&lt;/a&gt;, so stay tuned on that!&lt;/p&gt;&#xD;
&lt;p&gt;You may also follow me on twitter @frozenfishes. First of all I want to thank Steinar Andersen and the people at SQL Service for letting me write a blog post here. And thanks again for putting Sweden on the SQL Server world map! Recently I started thinking about how to monitor over all performance for our data warehouse and mostly the impacts of different changes to the environment as a whole and over time. Both inside SQL server, but also at HW/OS level. E.g if you're switching over to another SAN solution, making changes to the memory configuration or having table compression turned on. I figured one way to do this is to keep track of sql server agent job durations, since this is often not only used to execute all the SSIS packages for ETL, but also for a lot of cmdexec tasks doing various things in the environment such as processing a large number of files in some way etc. You'll then want to know how big the time saving (or loss) was in the big picture.&lt;/p&gt;&#xD;
&lt;p&gt;This could also be highly interesting numbers to look at if you're bound to specific maintenance time windows, when it's acceptable that your data is unavailable or inconsistent, and you're having trouble fitting everything in there. Then you want to know which job durations are stable and which are not, and which jobs take the longest time to finish when it matters, so that you can focus troubleshooting and performance optimization to these bad guys. &amp;nbsp;Of course this is not very specific, and will barely provide any help at all when it comes to troubleshooting. It's also more of a measure for what's going on in means of modifications to these jobs, than performance in the environment, if your agent jobs changes often and a lot. In my own case we have quite stable jobs that, if changed it's not supposed to affect these durations very much. Although this might give you a hint of when a problem occurs and you need to look at the specifics. &amp;nbsp;In a perfect world the only one making changes to these agent jobs would be the DBA, so that he/she always know what's going on in there.&lt;/p&gt;&#xD;
&lt;p&gt;At least I would like it to be like this. Although I'm pretty certain this is not true in many cases. This might raise an alert to you as a DBA, when a developer has made significant changes to a job - so that you'll get the opportunity to check it out and see how it copes with what you know is the fastest and best way of doing these things and make sure it doesn&amp;rsquo;t affect job durations to the point that it will interfere with other things such as backups or different maintenance tasks. &amp;nbsp;There's some time calculation to be done here. The following query will return one row per job, and information about the most recent run. If there's jobs that never has been run this will be returned with '1970-01-01' as RunDate. I use this query in a agent job to insert the results into a table, so that I can look at the results and variations over time with the help of a SSRS report.&amp;nbsp;I scheduled this to run once a day. &amp;nbsp; &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;SELECT CAST(convert(char(8), CASE a.last_run_date WHEN 0 THEN '19700101' ELSE a.last_run_date END) AS date) as RunDate, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE LEN(a.last_run_time) WHEN 5 THEN '0' + LEFT(convert(nvarchar(6),a.last_run_time), 1) + ':' + (SUBSTRING(convert(nvarchar(6), a.last_run_time), 2, 2)+ ':' + RIGHT(convert(nvarchar(6), a.last_run_time), 2)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 6 THEN LEFT(convert(nvarchar(6), a.last_run_time), 2) + ':' +(SUBSTRING(convert(nvarchar(6), a.last_run_time), 3, 2) + ':' +RIGHT(convert(nvarchar(6), a.last_run_time), 2)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE '23:59:59' &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END AS RunTime, &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; b.name as JobName, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (select COUNT(step_id) from [msdb].[dbo].[sysjobsteps] where job_id =a.job_id) as NbrOfSteps, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE a.last_run_outcome WHEN 0 THEN '#FAILED#' WHEN 1 THEN 'Succeeded'WHEN 3 THEN '#STOPPED#' ELSE 'N/A' END AS Outcome, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE LEN(a.last_run_duration) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 1 THEN a.last_run_duration &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 2 THEN a.last_run_duration &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 3 THEN (convert(decimal, LEFT(a.last_run_duration, 1)) * 60) +RIGHT(a.last_run_duration, 2) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 4 THEN (convert(decimal, LEFT(a.last_run_duration, 2)) * 60) +RIGHT(a.last_run_duration, 2) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 5 THEN (convert(decimal, LEFT(a.last_run_duration, 1) * 60) * 60) +(convert(decimal, SUBSTRING(CAST(a.last_run_duration AS nvarchar(5)), 2, 2)) * 60) +RIGHT(a.last_run_duration, 2) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 6 THEN (convert(decimal, LEFT(a.last_run_duration, 2) * 60) * 60) +(convert(decimal, SUBSTRING(CAST(a.last_run_duration AS nvarchar(6)), 3, 2)) * 60) +RIGHT(a.last_run_duration, 2) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END AS DurationInSecs, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE LEN(a.last_run_duration) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 1 THEN cast(convert(decimal, a.last_run_duration) /60 AS decimal(6,2)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 2 THEN cast(convert(decimal, a.last_run_duration) /60 AS decimal(6,2)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 3 THEN cast(LEFT(a.last_run_duration, 1) + (convert(decimal,RIGHT(a.last_run_duration, 2)) /60) AS decimal(6,2)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 4 THEN cast(LEFT(a.last_run_duration, 2) + (convert(decimal,RIGHT(a.last_run_duration, 2)) /60) AS decimal(6,2)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 5 THEN cast((convert(decimal, (LEFT(a.last_run_duration, 1)) * 60) +SUBSTRING(CAST(a.last_run_duration AS nvarchar(5)), 2, 2) + (convert(decimal,RIGHT(a.last_run_duration, 2)) /60)) AS decimal(6,2)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 6 THEN cast((convert(decimal, (LEFT(a.last_run_duration, 2)) * 60) +SUBSTRING(CAST(a.last_run_duration as nvarchar(6)), 3, 2) + (convert(decimal,RIGHT(a.last_run_duration, 2)) /60)) AS decimal(6,2)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END AS DurationInMins, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE LEN(a.last_run_duration) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 1 THEN cast(convert(decimal, a.last_run_duration / 60) /60 AS decimal(6, 2)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 2 THEN cast(convert(decimal, a.last_run_duration / 60) /60 AS decimal(6, 2)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 3 THEN cast((convert(decimal, LEFT(a.last_run_duration, 1)) /60) +(convert(decimal, RIGHT(a.last_run_duration, 2)) / 60) /60 AS decimal(6,2)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 4 THEN cast((convert(decimal, LEFT(a.last_run_duration, 2)) /60) +(convert(decimal, RIGHT(a.last_run_duration, 2)) / 60) /60 AS decimal(6,2)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 5 THEN cast(LEFT(a.last_run_duration, 1) + (convert(decimal,SUBSTRING(CAST(a.last_run_duration AS nvarchar(5)), 2, 2)) /60) + (convert(decimal,(RIGHT(a.last_run_duration, 2)) / 60) /60) AS decimal(6,2)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 6 THEN cast(LEFT(a.last_run_duration, 2) + (convert(decimal,SUBSTRING(CAST(a.last_run_duration AS nvarchar(6)), 3, 2)) /60) + (convert(decimal,(RIGHT(a.last_run_duration, 2)) / 60) /60) AS decimal(6,2)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE 0 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END AS DurationInHrs &amp;nbsp; FROM [msdb].[dbo].[sysjobservers] a &amp;nbsp; inner join [msdb].[dbo].[sysjobs] b on a.job_id = b.job_id &amp;nbsp; order by a.last_run_date, a.last_run_time &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T11:39:25Z</a10:updated></item><item><guid isPermaLink="false">bf43af4a-3218-4ea2-aec1-67ad7f6d3f8b</guid><link>http://sqlservice.se/sv/start/blogg/identity-function.aspx?lang=sv</link><title>IDENTITY function</title><description>&lt;p&gt;As we all know we can create a table with an identity column, add rows and automatically get every row numbered sequentially. This requires that we first create a table with a column that has an identity property set. If you want to have a new table with a column that gives every row an increasing (or decreasing) number you don't have to make the extra move to first create the table with an identity column and then insert the data. Instead you can use the IDENTITY function. I recently found myself in a situation where i had to migrate some data and needed to assign every row a unique number. One alternative would have been to create a cursor, loop through all the records and have a variable that would increase it's value by 1 for every record and then insert the row. Not a very appealing solution. Instead i decided to select the data with an added identity column into a new table (which was the desired result by the way).&lt;/p&gt;&#xD;
&lt;p&gt;Here's an example: SELECT IDENTITY(INT, 1,1) AS ID, COL1, COL2....INTO NewTable FROM SomeTable This statement will create a new table, called NewTable, with a column called ID with datatype INT and the rest of the columns that are listed in the select statement. Note that the new column, ID, is created as an integer and does not have the IDENTITY property set so it does not behave like a IDENTITY after table creation. One restriction to this is that you can only use the IDENTITY function in a SELECT INTO statement. Why?? It would have been nice if you could use it with a plain regular insert...&lt;/p&gt;</description><a10:updated>2012-07-20T11:38:18Z</a10:updated></item><item><guid isPermaLink="false">0355361e-7c8d-4201-8e41-7bb75bd7af88</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-2012--parse()--try_parse().aspx?lang=sv</link><title>SQL server 2012 - PARSE() &amp; TRY_PARSE()</title><description>&lt;p&gt;In &lt;a href="http://www.microsoft.com/sqlserver/en/us/sql-2012-editions.aspx" target="_blank"&gt;SQL Server 2012 &lt;/a&gt;you have a lot new features to use and some of the improvements are in T-SQL. If you ever tried to convert a string value into a date or numeric datatype, you probably have been facing incompatible string values that are not possible to convert without some easy or complex string manipulations. I guess you have been facing issues like this: SELECT CONVERT(datetime,'Monday, 13 December 2010') AS Result SELECT CAST('m&amp;aring;ndag 13 december 2010 kl 10:12' AS datetime2) AS Result SELECT CONVERT(money,'3 455,98') AS Result SELECT CONVERT(datetime2, '12/16/2010') All of these statements will fail and you have to manipulate the strings&amp;nbsp;to&amp;nbsp;be able to&amp;nbsp;convert them. Sometimes&amp;nbsp;these issues will arise in implicit&amp;nbsp;conversions when you try to insert&amp;nbsp;string values into date or numeric columns&amp;nbsp;and you need to&amp;nbsp;find the record&amp;nbsp;that is causing the&amp;nbsp;problem. These issues can be solved by two of the new functions in SQL server 2012, &lt;a href="http://msdn.microsoft.com/en-us/library/hh213316(v=sql.110).aspx"&gt;PARSE&lt;/a&gt;() &amp;amp; &lt;a href="http://msdn.microsoft.com/en-us/library/hh213126(v=sql.110).aspx"&gt;TRY_PARSE&lt;/a&gt;().&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;With these functions you can use a language culture to handle different string formats. SELECT PARSE('Monday, 13 December 2010' AS datetime2 using 'en-US') AS Result SELECT PARSE('M&amp;aring;ndag 13 December 2010' AS datetime2 using 'sv-SE') AS Result SELECT PARSE('M&amp;aring;ndag den 13 December 2010' AS datetime2 using 'sv-SE') AS Result SELECT PARSE('m&amp;aring;ndag 13 december 2010 kl 10:12' AS datetime2 using 'sv-SE') AS Result SELECT PARSE('m&amp;aring;ndag 13 december 2010 klockan 10:12' AS datetime2 using 'sv-SE') AS Result --- Error! All of the selects above will return a valid datetime2 except the last on results in an error. To avoid the error you can replace the PARSE function with TRY_PARSE that will give you a NULL value instead of an error.&lt;/p&gt;&#xD;
&lt;p&gt;SELECT PARSE('&amp;euro;345,98' AS money using 'de-DE') AS Result SELECT PARSE('&amp;pound;345,98' AS money using 'de-DE') AS Result --- Error! SELECT TRY_PARSE('&amp;pound;345,98' AS money using 'de-DE') AS Result SELECT TRY_PARSE('&amp;euro;345,98' AS money using 'de-DE') AS Result In the example above you'll get an error on the second statement, becuase the &amp;pound; sign is not a valid currency prefix for German language culture. The most interesting result you'll get for the following code: SELECT PARSE('1 53' AS DECIMAL(10,2)) AS Result SELECT PARSE('1,53' AS DECIMAL(10,2)) AS Result SELECT TRY_PARSE('1,53' AS DECIMAL(10,2) USING 'sv-SE') AS Result SELECT PARSE('1 53' AS DECIMAL(10,2) USING 'sv-SE') AS&lt;/p&gt;&#xD;
&lt;p&gt;Result As you can see in the result is that the&amp;nbsp;Thousand sign&amp;nbsp;for the specified language culture is just removed, causing 1,53 and 1 53 to become 153,&amp;nbsp;instead of causing an exception.&amp;nbsp;The thousand sign doesn't&amp;nbsp;seem to have a meaning in PARSE, and&amp;nbsp;this might cause you some sleepless nights if you thought you would get a different result.&lt;/p&gt;&#xD;
&lt;p&gt;If you have any questions regarding SQL server, feel free to contact us and our SQL server experts will help you.&lt;/p&gt;</description><a10:updated>2012-07-20T11:37:37Z</a10:updated></item><item><guid isPermaLink="false">904514d1-8b8f-4cfb-ba02-abc7a8afd8b6</guid><link>http://sqlservice.se/sv/start/blogg/the-eternal-search-for-missing-indexes,-part-2.aspx?lang=sv</link><title>The eternal search for missing indexes, part 2</title><description>&lt;p&gt;Now that you have tried the script I presented last wednesday on your production server(s) I would like to fill you in on how I use it: The first column in the result set, &lt;span style="color: #000000;"&gt;&lt;em&gt;improvement_measure&lt;/em&gt;&lt;/span&gt;, shows a weighted measure of several of the other columns in the result set. I usually do not concern myself about values below 1000 for this column. Secondly it is important to group the result into relevant tables. My procedure is to add a filter to the top 1 table in the result set as follows: AND mid.statement LIKE '%tablename%'&lt;/p&gt;&#xD;
&lt;p&gt;The result set with this extra WHERE clause will normally contain many similar rows with almost identical CREATE statements in the &lt;em&gt;create_index_statement&lt;/em&gt; column. Now you should look at the differences between the statements and find a statement that covers all other statements (normally the most difference is in the INCLUDE part. Now, if your fellow programmer has done som bad programming here, AND you have a many column table, you will find INCLUDE statements that look ridiculous (= every column in the table included). Primary solution is to contact your fellow programmer and in a nice way explain that he (or she) cannot possibly be needing EVERY SINGLE column in the table!&lt;/p&gt;&#xD;
&lt;p&gt;The secondary solution is to make a loud heavy sigh, accept the fact, and try to exclude irrelevant columns yourself. Once you have executed the CREATE INDEX for the chosen index configuration, the DMVs will be reset for the table involved. Therefore you will have to patiently wait until the statistics build up again before you add new indexes to the table. Now you can reiterate the procedure above until you are below your chosen threshold value for the &lt;em&gt;improvement_measure.&lt;/em&gt; &lt;em&gt;to be continued...&lt;/em&gt;&lt;/p&gt;</description><a10:updated>2012-07-20T11:36:46Z</a10:updated></item><item><guid isPermaLink="false">194c20ff-6df5-4178-a5ee-e50bf8cef5c8</guid><link>http://sqlservice.se/sv/start/blogg/veckans-fraga-med-svar--vecka-11.aspx?lang=sv</link><title>Veckans fråga med svar - vecka 11</title><description>&lt;p&gt;Nu introducerar vi veckans fr&amp;aring;ga till n&amp;aring;gon av v&amp;aring;ra konsulter. Fr&amp;aring;gan kommer p&amp;aring; m&amp;aring;ndagar och svaret senere under veckan.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="text-decoration: underline;"&gt;Fr&amp;aring;ga vecka 11&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Ofta kan man se att SQL Server g&amp;aring;r p&amp;aring; olika processorer, t.ex. E5540, X5650, L5640. Vad &amp;auml;r dessa f&amp;ouml;rkortningar och spelar det n&amp;aring;gon roll f&amp;ouml;r SQL Server och vad &amp;auml;r i s&amp;aring; fall rekommendationen ?&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Svar:&lt;/strong&gt; Tack G&amp;ouml;ran f&amp;ouml;r en fr&amp;aring;ga som n&amp;auml;stan &amp;auml;r om&amp;ouml;jlig att svara p&amp;aring;, p&amp;aring; ett begripligt s&amp;auml;tt :-) Dessa f&amp;ouml;rkortningar &amp;auml;r namnen p&amp;aring; olika Intel server processorer (Det vill s&amp;auml;ga inte processorer till din laptop eller station&amp;auml;ra dator). I detta svar kommer jag d&amp;auml;rf&amp;ouml;r att fokusera p&amp;aring; Intels processorer, men vi skall inte gl&amp;ouml;mma bort att det &amp;auml;ven finns AMD. Att beskriva alla i detalj &amp;auml;r en om&amp;ouml;jlighet, det &amp;auml;r helt enkelt f&amp;ouml;r mycket information.&lt;/p&gt;&#xD;
&lt;p&gt;D&amp;aring; h&amp;auml;nvisar jag till:&amp;nbsp;&lt;br /&gt;&lt;a href="http://www.intel.com"&gt;www.intel.com&lt;/a&gt; , &lt;br /&gt;&lt;a href="http://www.intel.com/content/www/us/en/processors/processor-numbers.html"&gt;http://www.intel.com/content/www/us/en/processors/processor-numbers.html&lt;/a&gt; &lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Xeon"&gt;http://en.wikipedia.org/wiki/Xeon&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;D&amp;auml;remot kan en &amp;ouml;vergripande beskrivning nog vara till nytta, och det kommer jag att f&amp;ouml;rs&amp;ouml;ka mig p&amp;aring; h&amp;auml;r. &amp;nbsp; Intels olika processorer kan delas upp i ett antal familjer, som kort kan beskrivas s&amp;aring; h&amp;auml;r: E3: F&amp;ouml;r servrar med 1 CPU, med 2-4 cores per CPU (Ers&amp;auml;tter gamla 3000 serien). Billigast E5: F&amp;ouml;r servrar med upp till 2 CPU&amp;rsquo;er, med 4-8 cores per CPU (Ers&amp;auml;tter gamla 5000 serien) B&amp;auml;st pris/prestanda E7: F&amp;ouml;r servrar med 2-256&amp;nbsp; CPU&amp;rsquo;er, med 6-10 cores per CPU (Ers&amp;auml;tter gamla 7000 serien) Dyrast &amp;nbsp; Vad d&amp;aring; med bokst&amp;auml;verna X, E och L som brukar ligga med f&amp;ouml;rst eller sist i CPU namnen fr&amp;aring;n Intel? &amp;nbsp; L: Low Voltage, &amp;auml;r som namnet antyder en variant med l&amp;auml;gre str&amp;ouml;mf&amp;ouml;rbrukning. Detta har givetvis inverkan p&amp;aring; prestanda, s&amp;aring; om prestanda &amp;auml;r viktigt skall du undvika dessa processorer E: Mainstream, eller mellanklass. Fokus p&amp;aring; pris/prestanda f&amp;ouml;rh&amp;aring;llandet. X: Performance. Kostar det s&amp;aring; smakar det :-) &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Det viktigaste att ta i beaktande fram&amp;ouml;ver n&amp;auml;r du skall v&amp;auml;lja CPU till din SQL Server server, kommer oftast att vara price/performance eftersom SQL Server 2012 inneb&amp;auml;r ett byte av licensieringsmodell fr&amp;aring;n per CPU till per CORE. I alla fall om du skall k&amp;ouml;ra Enterprise Edition, som nu bara kommer att s&amp;auml;ljas per CORE, och inte l&amp;auml;ngre finns tillg&amp;auml;nglig under licensmodellen Server/CAL. Tidigare var det vid CPU licensiering l&amp;ouml;nsamt att k&amp;ouml;ra CPU&amp;rsquo;er med s&amp;aring; m&amp;aring;nga CORE&amp;rsquo;s som m&amp;ouml;jligt, vilket gjorde att vi ofta rekommenderade AMD 12 CORE processorer. &amp;nbsp;Nu kommer det bli precis tv&amp;auml;rt emot, dvs att nu blir det viktigt att kunna klara sig p&amp;aring; s&amp;aring; f&amp;aring;r CORE som m&amp;ouml;jligt av kostnadssk&amp;auml;l. D&amp;aring; kommer vi antagligen oftare att rekommendera Intel 4 CORE CPU&amp;rsquo;er med s&amp;aring; mycket kraft som m&amp;ouml;jligt i varje CORE. &lt;br /&gt;/Steinar Andersen &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T11:36:06Z</a10:updated></item><item><guid isPermaLink="false">07637915-d5c6-4096-9647-86a15f0809b2</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-version-11-0-2100-60.aspx?lang=sv</link><title>SQL Server version 11.0.2100.60</title><description>&lt;p&gt;Som ni s&amp;auml;kert k&amp;auml;nner till, har &lt;a href="http://www.microsoft.com/sql"&gt;SQL Server 2012&lt;/a&gt; lanserats. Faktum &amp;auml;r att lanseringen fortfarande p&amp;aring;g&amp;aring;r, det &amp;auml;r inte f&amp;ouml;r sent att logga in p&amp;aring; &lt;a href="http://www.sqlserverlaunch.com"&gt;www.sqlserverlaunch.com&lt;/a&gt; och ta del av m&amp;auml;ngder av sessioner om alla nya sp&amp;auml;nnande nyheter! I rubriken har jag dock inte skrivit version 2012 utan version 11.0.2100.60. Detta &amp;auml;r alts&amp;aring; build numret f&amp;ouml;r RTM (Release To Manufacturing) versionen av SQL 2012. S&amp;aring; om din installation har ett l&amp;auml;gre nummer &amp;auml;r det antagligen CTP1, CTP3 eller RC0 av SQL 2012. F&amp;ouml;r att kolla vilken version av SQL Server du k&amp;ouml;r kan du antigen h&amp;ouml;gerklicka p&amp;aring; servernamnet i SQL Server Management Studio och v&amp;auml;lja properties. Eller s&amp;aring; kan du k&amp;ouml;ra f&amp;ouml;ljande lilla kodsnutt: &lt;span style="color: #0000ff;"&gt;SELECT &lt;/span&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-family: Consolas; font-size: x-small;"&gt;SERVERPROPERTY&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-family: Consolas; font-size: x-small;"&gt;'ProductVersion'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #808080; font-family: Consolas; font-size: x-small;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Vi har redan m&amp;aring;nga kunder som h&amp;aring;ller p&amp;aring; att komma ig&amp;aring;ng med SQL 2012, eller planerar att g&amp;ouml;ra det snart. Om ni vill att vi skall hj&amp;auml;lpa er med att utnyttja m&amp;ouml;jligheterna i den nya SQL Server versionen, eller bara komma och ber&amp;auml;tta vilka m&amp;ouml;jligheterna &amp;auml;r, &lt;a href="http://www.sqlservice.se/kontakta-oss/"&gt;kontakta oss&lt;/a&gt; s&amp;aring; kommer n&amp;aring;gon av v&amp;aring;ra erfarna &lt;a href="http://sqlservice.se/category/konsulter/"&gt;SQL Server&lt;/a&gt; konsulter ut till er. Som &lt;a href="http://pinpoint.microsoft.com/sv-SE/PartnerDetails.aspx?PartnerId=4297674978"&gt;Microsoft Gold Data Platform Partner &lt;/a&gt;&amp;auml;r vi r&amp;auml;tt partner f&amp;ouml;r er n&amp;auml;r det g&amp;auml;ller SQL Server!&lt;/p&gt;</description><a10:updated>2012-07-20T11:33:34Z</a10:updated></item><item><guid isPermaLink="false">ade765a2-5bee-4f08-8d0f-8219f9547e9d</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-2012-business-intelligence-developer-skills-upgrade.aspx?lang=sv</link><title>SQL Server 2012 Business Intelligence/Developer Skills Upgrade </title><description>&lt;p&gt;SQL Service h&amp;aring;ller tillsammans med LabCenter en 2 dagarslabb i Stockholm och&amp;nbsp;G&amp;ouml;teborg. I denna tv&amp;aring;dagarslabb framtagen av H&amp;aring;kan Winther COO p&amp;aring; SQL Service och G&amp;ouml;ran R&amp;ouml;nnb&amp;auml;ck, konsult p&amp;aring; SQL Service, l&amp;auml;r du dig de relevanta nyheterna i Microsoft SQL Server 2012 f&amp;ouml;r dig som idag &amp;auml;r utvecklare eller BI utvecklare p&amp;aring; tidigare versioner av SQL Server. Vi g&amp;aring;r igenom relevanta nyheter och tittar p&amp;aring; hur de kan anv&amp;auml;ndas i verkligheten f&amp;ouml;r att uppn&amp;aring; h&amp;ouml;gre prestanda och b&amp;auml;ttre funktionalitet! Dag 1: -&amp;Ouml;versikt &amp;ouml;ver nyheterna i SQL 2012 -Editions, features och licensiering i SQL 2012 -Installation av SQL Server 2012 -T-SQL nyheter Dag2: - Columnstore Index - Online operations - Full Text Search och Semantic Search - Nyheter i SSAS, SSIS och SSRS - Powerview och PowerPivot &lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Datum &lt;/strong&gt; &lt;strong&gt;G&amp;ouml;teborg: 21-22 mars &lt;/strong&gt;&lt;strong&gt;Stockholm 19-20 april&lt;/strong&gt; &lt;strong&gt;L&amp;auml;ngd: 2 dagar&lt;/strong&gt; &lt;strong&gt;Pris per plats: 6.500 sek exkl moms&lt;/strong&gt; &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Anm&amp;auml;lan sker direkt Patrik p&amp;aring; LabCenter till mail: &lt;a href="mailto:Patrik.sandqvist@labcenter.se"&gt;Patrik.sandqvist@labcenter.se&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Beh&amp;ouml;ver d&amp;aring; informationen:&lt;br /&gt;1.Val av datum&lt;br /&gt;2. deltagarnamn&lt;br /&gt;3. Email&lt;br /&gt;4.full fakturadress.&lt;/p&gt;</description><a10:updated>2012-07-20T11:32:31Z</a10:updated></item><item><guid isPermaLink="false">ac7b23cd-aee2-4b00-ad8a-591fc1b4a7ae</guid><link>http://sqlservice.se/sv/start/blogg/backup-till-nul-device.aspx?lang=sv</link><title>Backup till NUL device</title><description>&lt;p&gt;Att g&amp;ouml;ra prestandam&amp;auml;tningar kan ibland vara en tidskr&amp;auml;vande process. Ofta beh&amp;ouml;ver man titta p&amp;aring; ett system en l&amp;auml;ngre tid f&amp;ouml;r att f&amp;aring; en r&amp;auml;ttvis bild av m&amp;auml;tdatat. En v&amp;auml;ldigt viktig parameter f&amp;ouml;r hur bra SQL Server presterar &amp;auml;r skrivhastigheten i disksystemet. Ett litet knep man kan anv&amp;auml;nda f&amp;ouml;r att snabbt bilda sig en uppfattning om hur skrivhastigheten p&amp;aring; disk, eller hur l&amp;aring;ng tid en backup tar, &amp;auml;r att ta en backup och skicka filen till ett sk NUL device. Observera att det &amp;auml;r NUL med ett L inget annat. NUL kan v&amp;auml;l n&amp;auml;rmast betraktas som en fil som tar bort allt som skrivs till den men &amp;auml;nd&amp;aring; rapporterar att allt &amp;auml;r normalt. Att ta backup brukar kunna ge en indikation av hur snabbt disksystem man har i bakgrunden. F&amp;ouml;r att f&amp;aring; lite mer matnyttig information kan skall man dock inte g&amp;ouml;ra backupen med Management Studio utan via TSQL d&amp;aring; man f&amp;aring;r mer detaljerad information om hur mycket som skrivits och hastigheten.&lt;/p&gt;&#xD;
&lt;p&gt;EX: Processed 6540000 pages for database 'XXXXX', file 'XXXXX_Data' on file 1. Processed 1 pages for database 'XXXXX', file 'XXXXX_Log' on file 1. BACKUP DATABASE successfully processed 6540001 pages in 420.212 seconds (121.590 MB/sec) Se bara till att g&amp;ouml;ra backupen med COPY_ONLY option s&amp;aring; du inte bryter backupkedjan. Ex: BACKUP DATABASE [Databasnamn] TO DISK = 'NUL' WITH COPY_ONLY;&lt;/p&gt;</description><a10:updated>2012-07-20T11:31:28Z</a10:updated></item><item><guid isPermaLink="false">eb49f82f-478b-497d-9977-a95c679d856f</guid><link>http://sqlservice.se/sv/start/blogg/the-eternal-search-for-missing-indexes,-part-1.aspx?lang=sv</link><title>The eternal search for missing indexes, part 1</title><description>&lt;p&gt;Hi eveyone! I will begin my participation in this column by honoring Bart Duncan for a script utilizing dynamic management views (also known as DMV:s for short). The script simply lists up to 500 CREATE INDEX statements from three joined DMV:s. For the DBA user it is as simple as: cut - paste&amp;nbsp;- execute. Here is the script:&lt;/p&gt;&#xD;
&lt;pre&gt;SELECT&lt;span style="color: #000000;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="color: #000000;"&gt;migs&lt;/span&gt;.&lt;span style="color: #000000;"&gt;avg_total_user_cost &lt;/span&gt;* (&lt;span style="color: #000000;"&gt;migs&lt;/span&gt;.&lt;span style="color: #000000;"&gt;avg_user_impact &lt;/span&gt;/&lt;span style="color: #000000;"&gt; 100.0&lt;/span&gt;) * (&lt;span style="color: #000000;"&gt;migs&lt;/span&gt;.&lt;span style="color: #000000;"&gt;user_seeks &lt;/span&gt;+&lt;span style="color: #000000;"&gt; migs&lt;/span&gt;.&lt;span style="color: #000000;"&gt;user_scans&lt;/span&gt;) AS&lt;span style="color: #000000;"&gt; improvement_measure&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;, 'CREATE INDEX [missing_index_' + CONVERT (varchar,&lt;span style="color: #000000;"&gt; mig&lt;/span&gt;.&lt;span style="color: #000000;"&gt;index_group_handle&lt;/span&gt;) + '_' + CONVERT (varchar,&lt;span style="color: #000000;"&gt; mid&lt;/span&gt;.&lt;span style="color: #000000;"&gt;index_handle&lt;/span&gt;)&lt;/pre&gt;&#xD;
&lt;pre&gt;+ '_' + LEFT (PARSENAME(&lt;span style="color: #000000;"&gt;mid&lt;/span&gt;.statement,&lt;span style="color: #000000;"&gt; 1&lt;/span&gt;),&lt;span style="color: #000000;"&gt; 32&lt;/span&gt;) + ']' + ' ON ' +&lt;span style="color: #000000;"&gt; mid&lt;/span&gt;.statement+ ' (' + ISNULL (&lt;span style="color: #000000;"&gt;mid&lt;/span&gt;.&lt;span style="color: #000000;"&gt;equality_columns&lt;/span&gt;,'')&lt;/pre&gt;&#xD;
&lt;pre&gt;+ CASE WHEN&lt;span style="color: #000000;"&gt; mid&lt;/span&gt;.&lt;span style="color: #000000;"&gt;equality_columns &lt;/span&gt;IS NOT NULL AND&lt;span style="color: #000000;"&gt; mid&lt;/span&gt;.&lt;span style="color: #000000;"&gt;inequality_columns &lt;/span&gt;IS NOT NULL THEN ',' ELSE '' END&lt;span style="color: #000000;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;+ ISNULL (&lt;span style="color: #000000;"&gt;mid&lt;/span&gt;.&lt;span style="color: #000000;"&gt;inequality_columns&lt;/span&gt;,'') + ')'&lt;span style="color: #000000;"&gt;&amp;nbsp;&lt;/span&gt;+ ISNULL (' INCLUDE ('+&lt;span style="color: #000000;"&gt; mid&lt;/span&gt;.&lt;span style="color: #000000;"&gt;included_columns &lt;/span&gt;+')','') AS&lt;span style="color: #000000;"&gt; create_index_statement&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #000000;"&gt;migs&lt;/span&gt;.*&lt;/pre&gt;&#xD;
&lt;pre&gt;,&lt;span style="color: #000000;"&gt; mid&lt;/span&gt;.&lt;span style="color: #000000;"&gt;database_id&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;,&lt;span style="color: #000000;"&gt; mid&lt;/span&gt;.&lt;span style="color: #000000;"&gt;[object_id] &lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;FROM sys.dm_db_missing_index_groups&lt;span style="color: #000000;"&gt; mig&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;INNER JOIN sys.dm_db_missing_index_group_stats&lt;span style="color: #000000;"&gt; migs &lt;/span&gt;ON&lt;span style="color: #000000;"&gt; migs&lt;/span&gt;.&lt;span style="color: #000000;"&gt;group_handle &lt;/span&gt;=&lt;span style="color: #000000;"&gt; mig&lt;/span&gt;.&lt;span style="color: #000000;"&gt;index_group_handle&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;INNER JOIN sys.dm_db_missing_index_details&lt;span style="color: #000000;"&gt; mid &lt;/span&gt;ON&lt;span style="color: #000000;"&gt; mig&lt;/span&gt;.&lt;span style="color: #000000;"&gt;index_handle &lt;/span&gt;=&lt;span style="color: #000000;"&gt; mid&lt;/span&gt;.&lt;span style="color: #000000;"&gt;index_handle&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;WHERE&lt;span style="color: #000000;"&gt; migs&lt;/span&gt;.&lt;span style="color: #000000;"&gt;avg_total_user_cost &lt;/span&gt;* (&lt;span style="color: #000000;"&gt;migs&lt;/span&gt;.&lt;span style="color: #000000;"&gt;avg_user_impact &lt;/span&gt;/&lt;span style="color: #000000;"&gt; 100.0&lt;/span&gt;)* (&lt;span style="color: #000000;"&gt;migs&lt;/span&gt;.&lt;span style="color: #000000;"&gt;user_seeks &lt;/span&gt;+&lt;span style="color: #000000;"&gt; migs&lt;/span&gt;.&lt;span style="color: #000000;"&gt;user_scans&lt;/span&gt;) &amp;gt;&lt;span style="color: #000000;"&gt; 10&lt;/span&gt;&lt;/pre&gt;&#xD;
&lt;pre&gt;ORDER BY&lt;span style="color: #000000;"&gt; migs&lt;/span&gt;.&lt;span style="color: #000000;"&gt;avg_total_user_cost &lt;/span&gt;*&lt;span style="color: #000000;"&gt; migs&lt;/span&gt;.&lt;span style="color: #000000;"&gt;avg_user_impact &lt;/span&gt;* (&lt;span style="color: #000000;"&gt;migs&lt;/span&gt;.&lt;span style="color: #000000;"&gt;user_seeks &lt;/span&gt;+&lt;span style="color: #000000;"&gt; migs&lt;/span&gt;.&lt;span style="color: #000000;"&gt;user_scans&lt;/span&gt;) DESC&lt;/pre&gt;&#xD;
&lt;p&gt;Bart Duncan&amp;acute;s original post can be found here: &lt;a href="http://blogs.msdn.com/b/bartd/archive/2007/07/19/are-you-using-sql-s-missing-index-dmvs.aspx"&gt;http://blogs.msdn.com/b/bartd/archive/2007/07/19/are-you-using-sql-s-missing-index-dmvs.aspx&lt;/a&gt; Now, test this at home and I will return next week with my usage recommendations :)&lt;/p&gt;</description><a10:updated>2012-07-20T11:30:32Z</a10:updated></item><item><guid isPermaLink="false">fd5b7e35-31a9-45dc-8039-253aa9a4b05c</guid><link>http://sqlservice.se/sv/start/blogg/microsoft-releases-sql-server-2012.aspx?lang=sv</link><title>Microsoft Releases SQL Server 2012</title><description>&lt;p&gt;Alldeles nyligt meddelar Microsoft att SQL Server 2012 RTM nu sl&amp;auml;pps. &lt;a href="http://blogs.technet.com/b/stbnewsbytes/archive/2012/03/06/microsoft-releases-sql-server-2012-drives-advancements-in-big-data.aspx" target="_blank"&gt;SQL Server 2012 RTM&lt;/a&gt;&amp;nbsp;allts&amp;aring; och det finns redan nu m&amp;ouml;jlighet att ladda ned &lt;a href="http://www.microsoft.com/download/en/details.aspx?id=29066" target="_blank"&gt;Microsoft&amp;reg; SQL Server 2012 Evaluation &lt;/a&gt;innan den 1 april :-) D&amp;aring; det stora sl&amp;auml;ppet inleds. Noterbart &amp;auml;r att den inneh&amp;aring;ller Performance Dashboard f&amp;ouml;r SQL Server 2012. Gl&amp;ouml;m inte heller bort den&amp;nbsp;virtuella lanseringen nu p&amp;aring; onsdag 7/3 kv&amp;auml;ll med 20-minuters sessioner mellan kl 17-23. &lt;a href="http://www.sqlserverlaunch.com/ww/Home" target="_blank"&gt;Go Further. Forward. Faster. with Microsoft SQL Server 2012!&lt;/a&gt; F&amp;ouml;r &amp;ouml;vrigt h&amp;aring;ller vi l&amp;ouml;pande kurser p&amp;aring; just SQL Server 2012 i samarbete med &lt;a href="http://www.labcenter.se/" target="_blank"&gt;LabCenter&lt;/a&gt;&amp;nbsp;under v&amp;aring;ren d&amp;aring; vi g&amp;aring;r igenom de flesta nyheterna som nu blir tillg&amp;auml;ngliga f&amp;ouml;r DBA'er och utvecklare. &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T11:30:04Z</a10:updated></item><item><guid isPermaLink="false">e5df89ec-b949-44d1-aec7-df8df12225d9</guid><link>http://sqlservice.se/sv/start/blogg/fa-sql-server-hjalp-med-sqlhelp.aspx?lang=sv</link><title>Få SQL Server hjälp med #sqlhelp</title><description>&lt;p&gt;Om du &amp;auml;r en &lt;a href="http://microsoft.com/sql"&gt;SQL Server&lt;/a&gt; n&amp;ouml;rd, och anv&amp;auml;nder &lt;a href="http://www.twitter.com"&gt;twitter &lt;/a&gt;k&amp;auml;nner du s&amp;auml;kert till att det finns en blomstrande SQL Server community d&amp;auml;r. Ifall du inte &amp;auml;nnu har testat det, t&amp;auml;nkte jag ge lite tips s&amp;aring; att du kan komma ig&amp;aring;ng l&amp;auml;ttare.&lt;/p&gt;&#xD;
&lt;p&gt;Twitter best&amp;aring;r i grunden av tre element: &lt;br /&gt;1. Du kan registrera dig med ett eget Twitter namn, (Mitt &amp;auml;r @SQLSteinar) &lt;br /&gt;2. Du kan f&amp;ouml;lja och skriva till andra twittrare&lt;br /&gt;3. Du kan f&amp;ouml;lja och skriva till/med s&amp;aring; kallade hash taggar (Till exempel &lt;a href="https://twitter.com/#!/search/%23sqlhelp"&gt;#sqlhelp&lt;/a&gt; &amp;nbsp;eller &lt;a href="https://twitter.com/#!/search/%23sqlserver"&gt;#sqlserver&lt;/a&gt;)&lt;/p&gt;&#xD;
&lt;p&gt;H&amp;auml;r f&amp;ouml;ljer n&amp;aring;gra tips p&amp;aring; SQL Server relaterade hashtaggar och twittrare: Hashtaggar: #sqlhelp (F&amp;ouml;r att beg&amp;auml;ra och ge SQL Server relaterad hj&amp;auml;lp till andra twittrare) #sqlserver (Inneh&amp;aring;ller&amp;nbsp;massor av&amp;nbsp;SQL Server relaterad information) #sqlblog (L&amp;auml;nkar till SQL Server relaterade blogg inl&amp;auml;gg) #sqlmcm (Info om SQL Server Master programmet) #sqlserver2012 och #sql2012 (SQL Server 2012 s&amp;aring;klart...) #sqlfamily och #sqlpeople (Om SQL Server intresserade personer) #sqlpass (PASS, Professional Association for SQL Server, den internationella SQL Server usergroup) #SSRS #SSAS #SSIS (Japp, SSRS, SSAS och SSIS :-)) &amp;nbsp; SQL Server relaterade personer&amp;nbsp;/twitterkonton&amp;nbsp;att f&amp;ouml;lja: EDIT: (Denna lista finns &amp;auml;ven p&amp;aring; Twitter, s&amp;aring; blir det l&amp;auml;ttare att f&amp;ouml;lja alla: &amp;nbsp;&lt;a href="https://twitter.com/#!/SQLSteinar/sql-must-follows" rel="nofollow"&gt;https://twitter.com/#!/SQLSteinar/sql-must-follows&lt;/a&gt;&amp;nbsp;) @PaulRandal (Paul Randal) @unclebiguns (Jack Corbett, DBA och SQL Server MVP) @simon_sabin (Simon Sabin, SQL Bits organizer) @MicrosoftBI (Microsofts BI) @DBARoadmap (Guide&amp;nbsp;till att bli&amp;nbsp;SQL Server databas administrator) @jenstirrup (Jen Stirrup, Business Intelligence) @kekline (Kevin Kline) @GlennAlanBerry (Glenn Berry) @SQLSoldier (Robert Davis, PM f&amp;ouml;r SQL Server MCM programmet) @thomaskejser (Thomas Kejser) @mark_sqlcat (Mark Souza, SQL Server General Manager) @improvedk (Mark Rasmussen, upphovsman till OrcaMDF) @sqlcat (SQL Customer Advisory Teamet) @AdamMachanic (Adam Machanic) @BrentO (Brent Ozar) @SQLGoddess (Pam Lahoud, SQL Server MCM) @h_winther (H&amp;aring;kan Winther, SQL Server geni och Vice VD p&amp;aring; SQL Service) @AaronBertrand (Aaron Bertrand, SQL Server MVP) @DBArgenis (Argenis Fernandez, Microsoft Certified Master f&amp;ouml;r SQL Server 2008) @banerjeeamit (Microsoft Premier Field Engineer. Bidrar till&amp;nbsp;SQL Nexus/Diag Manager) @SSWUGorg (SSWUG.ORG) @sqlqueen (Kalen Delaney) @statisticsio (Jason Massie, &amp;nbsp;SQL Server MVP) @rob_farley (Rob Farley, SQL Server MVP) @way0utwest (Steve Jones, Editor, SQLServerCentral.com) @Phil_Factor (MystiskSQL Server k&amp;auml;ndis) @TimCost (Business Intelligence, T-SQL och Tableu) @frozenfishes (Svensk SQL Server DBA) @MidnightDBA (2 SQL Server DBA'er som &amp;auml;r gifta med varandra) @SQLSteinar (Mig!) @HanSQL (SQL Server DBA specialicerad p&amp;aring; administration och SSIS) @SQLTechCenter (SQL Server TechNet TechCenter) @bobbeauch (Bob Beauchemin) @SirSQL (Nicholas Cain, SQL DBA N&amp;ouml;rd) @sqlagentman (Tim Ford, Microsoft SQL Server DBA och MVP) @buckwoody (Buck Woody) @sqlpass (PASS) @SQLChicken (Jorge Segarra, SQL Server MVP och mycket flitig twittrare) och s&amp;aring;klart: @SQLServer Lycka till!&lt;/p&gt;</description><a10:updated>2012-07-20T11:29:29Z</a10:updated></item><item><guid isPermaLink="false">70b8e0c3-58cd-4a79-a754-38a1594ec687</guid><link>http://sqlservice.se/sv/start/blogg/cannot-retrieve-trace-defintion-for-sql-server-version.aspx?lang=sv</link><title>Cannot retrieve trace defintion for SQL Server version</title><description>&lt;p&gt;Ett vanligt fel n&amp;auml;r man skall anv&amp;auml;nda SQL Server Profiler mot Analysis Server &amp;auml;r detta meddelande "Cannot retrieve trace defintion&amp;nbsp;for SQL Server version ...".&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img class="alignnone size-medium wp-image-3054" title="Profiler Error" src="../ci.axd?sid=a456e17c-340e-45e2-90de-d09c72606ea9&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="300" height="121" /&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Detta &amp;auml;r en rapporterad bugg till Microsoft som &amp;auml;nnu inte f&amp;aring;tt n&amp;aring;gon l&amp;ouml;sning. F&amp;ouml;rhoppningsvis f&amp;aring;r vi en l&amp;ouml;sning p&amp;aring; detta i en framtida uppdatering. Som tur var finns det dock ett enkelt s&amp;auml;tt komma runt detta fel. Detta genom att &amp;auml;ndra "Regional Settings" till "English(United States)" och sedan tillbaka till det ursprungliga spr&amp;aring;ket. D&amp;auml;refter &amp;auml;r det m&amp;ouml;jligt att anv&amp;auml;nda profiler'n &amp;auml;ven mot Analysis Server. Detta &amp;auml;r en ocks&amp;aring; en f&amp;ouml;ruts&amp;auml;ttning f&amp;ouml;r att&amp;nbsp;&amp;auml;ven kunna optimera och f&amp;ouml;rb&amp;auml;ttra sina kuber att veta vad som egentligen h&amp;auml;nder med fr&amp;aring;gorna.&lt;/p&gt;</description><a10:updated>2012-07-20T10:46:33Z</a10:updated></item><item><guid isPermaLink="false">2837e502-9a40-4598-ba5c-1c7e75d10666</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-versioner.aspx?lang=sv</link><title>SQL Server versioner</title><description>&lt;p&gt;Ibland kan det vara bra att ha en &amp;ouml;versikt &amp;ouml;ver vilka versioner av SQL Server som finns g&amp;auml;llande service packar, hotfixar och uppdateringar. Jag kan &amp;auml;ven t&amp;auml;nka mig att g&amp;aring; ett steg l&amp;auml;ngre och s&amp;auml;ga att som SQL Server DBA m&amp;aring;ste man ha koll p&amp;aring; de senaste uppdateringarna. Nedanst&amp;aring;ende l&amp;auml;nk inneh&amp;aring;ller information om hur man tar reda p&amp;aring; vilken version man anv&amp;auml;nder. H&amp;auml;r finns &amp;auml;ven en sammanst&amp;auml;llning av alla uppdateringar som sl&amp;auml;ppts fram till nu:&amp;nbsp;&lt;a href="http://support.microsoft.com/kb/321185"&gt;http://support.microsoft.com/kb/321185&lt;/a&gt; Nedanst&amp;aring;ende l&amp;auml;nk inneh&amp;aring;ller ocks&amp;aring; en sammanst&amp;auml;llning av alla uppdateringar men denna har &amp;auml;ven en l&amp;auml;nk f&amp;ouml;r varje uppdatering s&amp;aring; man kan l&amp;auml;sa mer och ladda ner:&amp;nbsp;&lt;a href="http://sqlserverbuilds.blogspot.com/"&gt;http://sqlserverbuilds.blogspot.com/&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-07-20T10:45:46Z</a10:updated></item><item><guid isPermaLink="false">c0bc4780-c6ec-4dd9-bc8e-dd1f4dd6a5e6</guid><link>http://sqlservice.se/sv/start/blogg/sql-server--auto-update-stats-part-3.aspx?lang=sv</link><title>SQL server - Auto update stats part 3</title><description>&lt;p&gt;This is a sequal to previous blog posts about auto update stats in SQL Server, but the focus of this post is how to handle when you know for sure that the statistics will be out of date when you depend on it. As I mentioned in previous blog post, you could use the OPTIMIZE FOR UNKNOWN, but there is some other issues with this query hint. The hint is applied on all tables in your select, even if there are only one table with bad statistics. That means that you might get a good plan, but probably not the most optimal plan. If you know for sure that you always&amp;nbsp;will get more records from one of the tables than what the&amp;nbsp;optimizer&amp;nbsp;will estimate depending on the statistics,&amp;nbsp;you can try to hint the optimizer to use a hash join instead of a&amp;nbsp;nested loop. Well, is hash join faster than nested loop? It depends, nested loop is much faster than hash match when handling few records, and vice versa. I am not a fan of hints in SQL server, but sometimes a hint can perform miracles (at least for a while).&lt;/p&gt;&#xD;
&lt;p&gt;You can try the impact of having missguiding statistics by using the following code:&lt;/p&gt;&#xD;
&lt;p&gt;SET NOCOUNT ON; SELECT * FROM Production.Product P INNER JOIN Production.TransactionHistoryArchive tha ON P.ProductID=tha.ProductID WHERE P.DaysToManufacture&amp;gt;3 UPDATE Production.Product SET DaysToManufacture=10 WHERE ProductID=875 SELECT * FROM Production.Product P INNER JOIN Production.TransactionHistoryArchive tha ON P.ProductID=tha.ProductID WHERE P.DaysToManufacture&amp;gt;=10 ALTER DATABASE AdventureWorks2008R2 SET AUTO_UPDATE_STATISTICS OFF; BEGIN TRAN UPDATE Production.Product SET DaysToManufacture=10 SET STATISTICS IO ON; SET STATISTICS TIME ON; SELECT * FROM Production.Product P INNER JOIN Production.TransactionHistoryArchive tha ON P.ProductID=tha.ProductID WHERE P.DaysToManufacture&amp;gt;=10 SELECT * FROM Production.Product P INNER HASH JOIN Production.TransactionHistoryArchive tha ON P.ProductID=tha.ProductID WHERE P.DaysToManufacture&amp;gt;=10 UPDATE STATISTICS Production.Product; SELECT * FROM Production.Product P INNER JOIN Production.TransactionHistoryArchive tha ON P.ProductID=tha.ProductID WHERE P.DaysToManufacture&amp;gt;=10 SET STATISTICS IO OFF; SET STATISTICS TIME OFF; ROLLBACK TRAN ALTER DATABASE AdventureWorks2008R2 SET AUTO_UPDATE_STATISTICS ON;&lt;/p&gt;&#xD;
&lt;p&gt;As you can see, when the optimizer thinks that there are few records in the product table that matches your condition, it creates a plan with nested loop and you should take a look at the number of logical reads in that case. When you force the HASH join the number of logical reads decreases and when you update the statistics the optimizer choose the hash join by itself.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;I am not saying that you should turn of auto update statistics, I am saying that you can get performance issues in some cases if you rely on the automatic updates.&lt;/strong&gt;&lt;/p&gt;</description><a10:updated>2012-07-20T10:45:09Z</a10:updated></item><item><guid isPermaLink="false">cc9a8032-f3db-47b9-9639-9b0c054ce201</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-performance--death-by-correlated-subqueries.aspx?lang=sv</link><title>SQL server performance - Death by correlated subqueries</title><description>&lt;p&gt;There are many different methods to kill SQL server performance and one of the most bullet proof methods is correleated subqueries. In this blog post I'll try to explain what correlated subqueries are, why they kill the performance and how to avoid them.&lt;/p&gt;&#xD;
&lt;h4&gt;First of all, what is a correlated subquery?&lt;/h4&gt;&#xD;
&lt;p&gt;Well, it's an inner query&amp;nbsp;that is filtered by values from the outer query. Crystal Clear? Not really, lets give an example instead. First of all, I create two tables .... CREATE&amp;nbsp;TABLE table1 ( col1 INT IDENTITY(1,1) NOT NULL, col2 DATE NOT NULL ) CREATE TABLE table2 ( col1 INT IDENTITY(100000,1) NOT NULL, col2 DATE NOT NULL ) ...and then I write a correlated subquery... SELECT T1.COL2, (SELECT t2.[col1] FROM [table2] AS t2 WHERE t2.[col2]=t1.[col2]) AS col1 --The inner query that is correlated with the outer&amp;nbsp;query INTO #TABLE3 FROM [table1] AS T1 Does this make sense? Well, as you can see, for every record in table1 I'll want to get a record from table2 that is matching on col2. As a matter of fact, this query will fail if table2 will return more than one record for any of the records in table1. Do you see any problem with this approach? Well, in this case, if you execute the code, you will not have any performance&amp;nbsp;issues as the tables are empty, but what will happen if you add a large&amp;nbsp;number of records? You'll kill the SQL server performance!&lt;/p&gt;&#xD;
&lt;h4&gt;Why do correlated subqueries kill the performance?&lt;/h4&gt;&#xD;
&lt;p&gt;Well, for every record you add in table1, SQL server has to&amp;nbsp;execute the inner query in a nested loop. Lets add some data! In this case I add 1 000 000 records in table1 and table2, just for fun and to show the consequences. ;WITH cteNums AS( -- I use this common table expression to create a list of numbers from 1 to 1 000 000 SELECT top 1000000 ROW_NUMBER() OVER(ORDER BY o1.object_ID) AS n FROM master.sys.columns o1 CROSS JOIN master.sys.columns o2 CROSS JOIN master.sys.columns o3 ) INSERT INTO table1 (col2) --insert into table1 OUTPUT INSERTED.col2 INTO table2 (col2) --use the output clause to insert into table2 SELECT DATEADD(d,n,GETDATE()) -- create dates from the list of numbers FROM cteNums; Now I have two tables with 1 000 000 records in each, they contain the same set of data and it's time to compare a correlate subquery with a simple join. SET STATISTICS IO ON; SET STATISTICS TIME ON; DBCC DROPCLEANBUFFERS; --first use a correlated subquery to populate a temp table to avoid the data transfer to the client SELECT T1.COL2, (SELECT t2.[col1] FROM [table2] AS t2 WHERE t2.[col2]=t1.[col2]) AS col1 INTO #TABLE3 FROM [table1] AS T1 DBCC DROPCLEANBUFFERS; --second use a simple join to populate a temp table to avoid the data transfer to the client SELECT T1.COL2, T3.col1 INTO #TABLE4 FROM [table1] AS T1 INNER JOIN (SELECT t2.[col1],T2.COL2 FROM [table2] AS t2) AS t3 ON T3.[col2]=t1.[col2] SET STATISTICS TIME OFF; SET STATISTICS IO OFF; DROP TABLE [#table3] DROP TABLE [#table4] If you click the button "include actual execution plan" before you execute the code, you would get something like this:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/02/correlated_qp.png"&gt;&lt;img class="alignnone size-large wp-image-3017" title="correlated_qp" src="../ci.axd?sid=b58a4a3c-492f-48fd-b429-85d68c56804f&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="1024" height="389" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;As you can see, two completely different execution plans and according to Management Studio the cost of the first query is about 90% of the complete batch! Well, this is the estimate cost and may or may not reflect the reallity, but don't forget that SQL server is using cost based optimizations to get "the best" execution plan. Anyway, estimated cost or not, it's no rocket sience to understand that the second query is faster. To understand the difference, you can take a look at the join operators, nested loops vs hash match. When you have a nested loop you are going to execute the bottom branch for every record in the top branch. With the hash match join you get a result from both branches and match them together. If you need evidence for that statement you can hover with the mouse pointer over the index spool operator and "voil&amp;aacute;"!&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/02/correlated_balloon.png"&gt;&lt;img class="size-full wp-image-3018 alignnone" title="correlated_balloon" src="../ci.axd?sid=c7544aeb-c81a-401a-baf4-b12a633fa1dc&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="324" height="467" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;As you can see in this popup is that this operation is executed 1 000 000 times, and this is only a "reformatting" of data into a temporary index. The actual join operation is performed in the nested loop. In the second execution plan you can see that you have to table scans with a hash match and the table scans are only performed once. What impact did the execution plans have on elapsed time and number of reads? Well lets take a look at that! I guess you will not be surprised by now. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -- I add some options for the index to increase the read performance, you&amp;nbsp;should avoid these settings in a "normal" table, --but&amp;nbsp;in temp tables you can actually gain some&amp;nbsp;performance as the indexes will be compact and --SQL server doesn't need to care about&amp;nbsp;row or page locks CREATE CLUSTERED INDEX IX1 ON [table1] (COL2) WITH(FILLFACTOR=100, PAD_INDEX=ON, ALLOW_ROW_LOCKS=OFF, ALLOW_PAGE_LOCKS=OFF) CREATE CLUSTERED INDEX IX1 ON [table2] (COL2) WITH(FILLFACTOR=100, PAD_INDEX=ON, ALLOW_ROW_LOCKS=OFF, ALLOW_PAGE_LOCKS=OFF) DROP TABLE [#table3] DROP TABLE [#table4] SET STATISTICS TIME ON; SET STATISTICS IO ON; DBCC DROPCLEANBUFFERS; SELECT T1.COL2, (SELECT t2.[col1] FROM [table2] AS t2 WHERE t2.[col2]=t1.[col2]) AS col1 INTO #TABLE3 FROM [table1] AS T1 DBCC DROPCLEANBUFFERS; SELECT T1.COL2, T3.col1 INTO #TABLE4 FROM [table1] AS T1 INNER JOIN (SELECT t2.[col1],T2.COL2 FROM [table2] AS t2) AS t3 ON T3.[col2]=t1.[col2] SET STATISTICS TIME OFF; SET STATISTICS IO OFF;&lt;/p&gt;&#xD;
&lt;p&gt;As you can see, the queries&amp;nbsp;executes much faster with the clustered indexes, but the number of executions and the logical reads are still high and might affect the performance. Another thing to be aware of is that the correlated subquery migth return NULL if there are no match in the inner query and if that is the intended behaviour you need to change the INNER JOIN to a LEFT JOIN to get the same behaviour. &amp;nbsp; &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T10:21:44Z</a10:updated></item><item><guid isPermaLink="false">d5f05b73-22d5-4daf-9cea-af8420936f36</guid><link>http://sqlservice.se/sv/start/blogg/enable-parallellism-for-specific-query.aspx?lang=sv</link><title>Enable parallellism for specific query</title><description>&lt;p&gt;Many times when we work with &lt;a href="http://www.microsoft.com/sql"&gt;SQL Server&lt;/a&gt; based applications, we solve performance problems by adjusting parallellism settings to limit the genereration of parallell query plans. However, sometimes we need to do the opposite, that is allow certain queries to run with a parallell plan even if the server settings restrict or disable it. There are two settings that control this: Max Degree of Parallellism wich limits the number of worker threads that the individual operators in the query plan can use, and Cost Threshold for parallellism, wich defines the query plan cost limit beyond wich SQL Server starts evaluating parallell plans. So if you want to limit your query plan to use 2 CPU cores/Worker threads per operator you would use OPTION (MAXDOP 2) in the query. But what if you would like SQL Server to always allow parallell plans for this particular query only? This is not so well known, but there are actually an undocumented trace flag that will help you with that. I is called 8649 and what it does is effectively the same as setting Cost Threshold for parallellism to 0. But how do we do that for just one query? Well, we combine the trace flag with the &lt;a href="http://sqlservice.se/sql-server/allmant/querytraceon/"&gt;QUERYTRACEON&lt;/a&gt; option, and viola :-)&amp;nbsp; The&amp;nbsp; syntax is OPTION (QUERYTRACEON 8649)&lt;/p&gt;</description><a10:updated>2012-07-20T10:19:53Z</a10:updated></item><item><guid isPermaLink="false">cd92e875-7247-4de8-9283-7985cbda5663</guid><link>http://sqlservice.se/sv/start/blogg/24-hours-of-pass-sql-server-2012.aspx?lang=sv</link><title>24 Hours of PASS: SQL Server 2012</title><description>&lt;p&gt;Snart &amp;auml;r det dags f&amp;ouml;r &lt;a href="http://www.sqlpass.org/24hours/spring2012/Home.aspx" target="_blank"&gt;24 Hours of PASS: SQL Server 2012&lt;/a&gt;. Under ett helt dygn h&amp;aring;lls 24 stycken sessioner om SQL Server. Datumet f&amp;ouml;r detta &amp;auml;r den 21/3 s&amp;aring; passa p&amp;aring; att registrera er f&amp;ouml;r intressanta dragningar varav m&amp;aring;nga f&amp;ouml;rst&amp;aring;s handlar om SQL Server 2012. T&amp;auml;nk att f&amp;aring; l&amp;auml;ra sig mer om "SSIS Tips &amp;amp; Tricks" vid midnatt eller 4 timmar senare l&amp;auml;ra sig mer om n&amp;aring;gra gratisverktyg som man kan anv&amp;auml;nda f&amp;ouml;r att f&amp;ouml;rb&amp;auml;ttra prestandan av sin SQL Server milj&amp;ouml;. Dygnet avslutas med session om den stora nyheten "Always On". Ett tips &amp;auml;r att registrera sig snabbt eftersom antalet platser &amp;auml;r begr&amp;auml;nsat.&amp;nbsp; Allt &amp;auml;r ocks&amp;aring; gratis. Det finns ocks&amp;aring; ett utm&amp;auml;rkt tillf&amp;auml;lle att l&amp;auml;ra sig mer om "Always On"&amp;nbsp;och andra&amp;nbsp;nyheter och annat i egna labbar som vi h&amp;aring;ller tillsammans med &lt;a href="http://www.labcenter.se/lab/2111" target="_blank"&gt;Lab Center&lt;/a&gt;. &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T10:19:23Z</a10:updated></item><item><guid isPermaLink="false">31b4a481-5486-45b1-aab9-910924bfbfc2</guid><link>http://sqlservice.se/sv/start/blogg/auto_update_statistics.aspx?lang=sv</link><title>AUTO_UPDATE_STATISTICS</title><description>&lt;p&gt;Eftersom statistik verkar vara ett hett &amp;auml;mne just nu :-) ... s&amp;aring; t&amp;auml;nkte jag spinna vidare lite p&amp;aring; det temat. Om man har AUTO_UPDATE_STATISTICS p&amp;aring;slaget i databasen kommer automatiskt all statistik uppdateras. Detta &amp;auml;r bra och smidigt eftersom all statistik automatiskt underh&amp;aring;lls men om man av n&amp;aring;gon anledning har en eller flera tabeller, kolumner eller index d&amp;auml;r man inte vill uppdatera statistiken automatiskt eller vill uppdatera statistiken med andra v&amp;auml;rden p&amp;aring; t. ex. sample rate &amp;auml;n &amp;ouml;vriga pga att tabellen &amp;auml;r v&amp;auml;ldigt stor eller n&amp;aring;got annat kan man undanta dessa.&lt;/p&gt;&#xD;
&lt;p&gt;Detta g&amp;ouml;r man s&amp;aring;h&amp;auml;r: EXEC SP_AUTOSTATS 'Tabellnamn', OFF, 'Indexnamn'; Ovanst&amp;aring;ende undantar automatisk uppdatering av statistik p&amp;aring; specifikt index i en tabell. Man kan &amp;auml;ven anv&amp;auml;nda sp_autostats f&amp;ouml;r att visa hur autostats &amp;auml;r inst&amp;auml;lld f&amp;ouml;r all statistik p&amp;aring; en specifik tabell. EXEC SP_AUTOSTATS 'Tabellnamn'; Detta &amp;auml;r s&amp;aring;klart inte enda s&amp;auml;ttet att undanta statistik fr&amp;aring;n att bli auto uppdaterad, man kan &amp;auml;ven anv&amp;auml;nda: CREATE STATISTICS Tabellnamn Statistiknamn WITH NORECOMPUTE; Om man skapar statistiken manuellt. Eller om man redan skapat statistiken: UPDATE STATISTICS Tabellnamn Statistiknamn WITH NORECOMPUTE; Eller ett redan skapat index: ALTER INDEX Indexnamn ON Tabellnamn SET (STATISTICS_NORECOMPUTE = ON); AUTO_UPDATE_STATISTICS &amp;auml;r en inst&amp;auml;llning p&amp;aring; databasniv&amp;aring; och f&amp;ouml;r att se hur detta &amp;auml;r inst&amp;auml;llt kan man antingen titta i Management Studio under properties/options eller k&amp;ouml;ra: SELECT is_auto_update_stats_on FROM sys.databases WHERE name = 'Databasnamn'&lt;/p&gt;</description><a10:updated>2012-07-20T10:18:02Z</a10:updated></item><item><guid isPermaLink="false">48463151-9e68-4760-94ad-6c2aa822263f</guid><link>http://sqlservice.se/sv/start/blogg/sql-server--auto-update-stats-part-2.aspx?lang=sv</link><title>SQL server - Auto update stats part 2</title><description>&lt;p&gt;The last week I posted a blog about auto update stats and this is a sequal to that blog post. I case you haven't read it you should &lt;a title="SQL server &amp;ndash; Auto update stats part 1" href="http://sqlservice.se/okategoriserade/sql-server-auto-update-stats-part-1/"&gt;read it first&lt;/a&gt;. If you tried the script last week, you noticed that&amp;nbsp; :&lt;/p&gt;&#xD;
&lt;p&gt;- the statistics didn't update when the data was added&lt;br /&gt;- the statistics didn't update when you selected from the table unless you recompiled the procedure.&lt;br /&gt;- the less accurat statistics was the larger difference between estimated and actual number of records was.&lt;br /&gt;- the statistics was updated when you recompiled the procedure, selected from the table and at least 20% of the data was changed&lt;br /&gt;- the statistics updated less frequent when more data was added. 20% of 100 000 records is a lot more than 20% of 10 000 records.&lt;/p&gt;&#xD;
&lt;p&gt;If this would have been a real case scenario you would probably get into some serious performance problem as the statistics become inaccurat and the procedure get a new execution plan for some reason. The execution plan may get flushed from the cache due to some memory constraint and the procedure gets compiled with the assumption that you have less record than you actually have. The problem gets even worse when the data in the index is incrementing and you wants to get the last added records. Lets assume you want to get the last 19% of&amp;nbsp;a table with&amp;nbsp;100 000 000 of records and the statistics is out of&amp;nbsp;date. You want to get 19 000 000 records and SQL server statistics estimate the number of records of 1! That's a big difference and SQL server will give you a plan that would use a nested loop instead of a merge or hash join when joining a second table. The nested loop gets executed 19 000 000 times instead of the estimated 1. Should you depend on the auto update stats? Well, the short answer is, "it depends". I guess you've heard that before. In most cases auto update stats is a good thing, but in some cases you have to force the update stats by yourself. One good thing is that statistics are updated when you rebuild your indexes, BUT it's not updated when you reorganize the indexes. I guess some of you always rebuild all your indexes on a regular bases, and some of you are using a smart script to rebuild or reorganize your indexes depending of the fragmentation. If you are using a smart script you can &lt;strong&gt;get some serious trouble&lt;/strong&gt;, because not every index gets fragmented! An index with data that is increasing, like an identity column, adds&amp;nbsp;data&amp;nbsp;in the last&amp;nbsp;page and creates a new one when it's full. And if the index doesn't get fragmented, it&amp;nbsp;will not&amp;nbsp;be rebuilt&amp;nbsp;with your&amp;nbsp;script and the&amp;nbsp;statistics will not be updated.&lt;/p&gt;&#xD;
&lt;p&gt;If this is your case, you have&amp;nbsp;a couple of options:&lt;/p&gt;&#xD;
&lt;p&gt;- Schedule an update statisticse&lt;br /&gt;- Add update statistics in a procedure that you know is depending on fresh statistics&lt;br /&gt;- Add the trace flag 2371 to change the threshold for the auto update stats. The threshold will change depending on the amount of data that exist in the table. You can read more about about the trace flag &lt;a href="http://blogs.msdn.com/b/saponsqlserver/archive/2011/09/07/changes-to-automatic-update-statistics-in-sql-server-traceflag-2371.aspx" target="_blank"&gt;here&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Enable the trace flag with: DBCC TRACEON(2371) Execute the code from my previous post&amp;nbsp;and&amp;nbsp;compare with previous results and you can see that the statistics are updated more&amp;nbsp;frequent. I have seen some terrible issues with bad statistics, like a procedure that took about 7hours to execute. After adding update stats in the procedure it took only a couple of minutes.&lt;/p&gt;&#xD;
&lt;p&gt;If you are having performance issues with your SQL server, call us and our SQL server consultants will do what they&amp;nbsp;can to investigate and solve your issues. &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T10:16:00Z</a10:updated></item><item><guid isPermaLink="false">45556cb3-cbb7-4b6a-99d6-3c3f14a58a10</guid><link>http://sqlservice.se/sv/start/blogg/optimizing-performance-of-update-statistics.aspx?lang=sv</link><title>Optimizing performance of UPDATE STATISTICS</title><description>&lt;p&gt;Recently while working on a TB size &lt;a href="http://www.microsoft.com/sql"&gt;SQL Server &lt;/a&gt;database, I got the opportunity to verify something that I have suspected for some time, but not yet looked into properly.&lt;/p&gt;&#xD;
&lt;p&gt;I am talking about how to optimize UPDATE STATISTICS performance by utilizing the &lt;a href="http://www.sqlservice.se/sql"&gt;SQL Server 2008 R2 &lt;/a&gt;Enterprise Edition Compression feature. It is a common scenario today to have a SQL Server cluster with plenty of CPU available, on top of SAN disks.&amp;nbsp;So too in this case. And usually, you tend to be IO bound in this scenario. The problem escalates when your tables are so big that they do not fit in the cache. And what seems to happen when you rebuild statistics on a table is that the statistics are rebuild one by one.&lt;/p&gt;&#xD;
&lt;p&gt;So if you for example have statistics on 10 columns (index statistics aside), SQL Server will scan the table for the first column (from disk mostly), updating the statistics. But since the table does not fit in memory, when the time comes to scan the table to find information about the second column, the table have to be read from disk again. And so on for every column. Obviously this is a slow and tedious process. But what happens if you compress your tables, specifically the clustered index of your big tables? The theory is that since the table/index will stay compressed in memory as well, more of the table should fit there at one, dramatically speeding up the process described in the previous paragraph. And as mentioned, I finally got around to verifying this in a real production environment.&lt;/p&gt;&#xD;
&lt;p&gt;The result? Absolutely fantastic! I saw a 5 - 8 times improvement in running "UPDATE STATISTICS WITH SAMPLE 40 PERCENT" wich is what we use at this particular customer. And that just from enabling a feature that the customer had already paid for, and is completely transparent to the application. There are a lot of other advantages to SQL Server compression (and other enterprise features), but more on that later :-)&lt;/p&gt;&#xD;
&lt;p&gt;If you need SQL Server assistance, don't hesitate to &lt;a href="http://sqlservice.se/kontakta-oss/"&gt;contact us&lt;/a&gt;!&lt;/p&gt;</description><a10:updated>2012-07-20T10:14:23Z</a10:updated></item><item><guid isPermaLink="false">002f1342-b30a-4ebe-afe9-10b638909027</guid><link>http://sqlservice.se/sv/start/blogg/auto-shrink-=-true.aspx?lang=sv</link><title>Auto Shrink = True </title><description>&lt;p&gt;Som jag skrivit tidigare s&amp;aring; skall man aldrig ha &lt;strong&gt;Auto Shrink&lt;/strong&gt; aktiverat f&amp;ouml;r n&amp;aring;gon databas i sin SQL Server milj&amp;ouml;. Hur detta kan sl&amp;aring; i kombination med &lt;strong&gt;Auto Grow&lt;/strong&gt; visar jag l&amp;auml;ngre ned&amp;nbsp;detta blogginl&amp;auml;gg. Att Auto Shrink &amp;ouml;verhuvudtaget finns kvar brukar man s&amp;auml;ga beror p&amp;aring; bak&amp;aring;tkompatibilitet med tidigare SQL Server versioner. Det &amp;auml;r ocks&amp;aring; s&amp;auml;llan man h&amp;ouml;r n&amp;aring;gon vara s&amp;aring; missn&amp;ouml;jd men sin kod som Paul Randal &amp;auml;r &amp;ouml;ver Auto Shrink. F&amp;ouml;r att konstatera om n&amp;aring;gon databas har Auto Shrink aktiverat kan man anv&amp;auml;nda denna SQL: &lt;em&gt;SELECT name, is_auto_shrink_on&lt;/em&gt; &lt;em&gt; FROM sys.databases&lt;/em&gt; &lt;em&gt; WHERE is_auto_shrink_on = 1&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Skulle s&amp;aring; vara fallet s&amp;aring; &amp;auml;ndrar man detta med : &lt;em&gt;ALTER DATABASE [databasnamn] SET AUTO_SHRINK OFF WITH NO_WAIT&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Nu till vilka f&amp;ouml;ljder detta kan f&amp;aring;.&lt;/strong&gt; Ett enkelt s&amp;auml;tt att se historiks hur data/loggfilerna v&amp;auml;xt/krympt &amp;auml;r att att anv&amp;auml;nda standardrapporten &lt;strong&gt;Disk Usage&lt;/strong&gt; i Management Studio.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/02/Report-Autogrow-Autoshrink-Events.jpg"&gt;&lt;img class="alignnone size-full wp-image-2979" title="Report Autogrow Autoshrink Events" src="../ci.axd?sid=5f07c427-e105-4c35-99c4-973d2f0e6b86&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="283" height="38" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Dock &amp;auml;r det s&amp;aring; att denna rapport inte att g&amp;aring;r att k&amp;ouml;ra om man har en databas i komptabilitetsl&amp;auml;gen 80, dvs SQL Server 2000. &lt;a href="http://sqlservice.se/wp-content/uploads/2012/02/Disk-Usage-2000-Error.jpg"&gt;&lt;img class="alignnone size-medium wp-image-2980" title="Disk Usage 2000 - Error" src="../ci.axd?sid=9d5cbaf3-e4bc-4ca6-897c-f48fe1eb33d3&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="300" height="40" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;I st&amp;auml;llet kan man anv&amp;auml;nda nedanst&amp;aring;ende SQL. &lt;em&gt;exec sp_executesql @stmt=N'begin try&lt;/em&gt; &lt;em&gt; if (select convert(int,value_in_use) from sys.configurations where name = ''default trace enabled'' ) = 1&lt;/em&gt; &lt;em&gt; begin&lt;/em&gt; &lt;em&gt; declare @curr_tracefilename varchar(500) ;&lt;/em&gt; &lt;em&gt; declare @base_tracefilename varchar(500) ;&lt;/em&gt; &lt;em&gt; declare @indx int ;&lt;/em&gt; &lt;em&gt;select @curr_tracefilename = path from sys.traces where is_default = 1 ;&lt;/em&gt; &lt;em&gt; set @curr_tracefilename = reverse(@curr_tracefilename);&lt;/em&gt; &lt;em&gt; select @indx = patindex(''%\%'', @curr_tracefilename) ;&lt;/em&gt; &lt;em&gt; set @curr_tracefilename = reverse(@curr_tracefilename) ;&lt;/em&gt; &lt;em&gt; set @base_tracefilename = left( @curr_tracefilename,len(@curr_tracefilename) - @indx) + ''\log.trc'' ;&lt;/em&gt; &lt;em&gt;select case convert(int, EventClass)&lt;/em&gt; &lt;em&gt; when 92 then ''Data File Auto Grow''&lt;/em&gt; &lt;em&gt; when 93 then ''Log File Auto Grow''&lt;/em&gt; &lt;em&gt; when 94 then ''Data File Auto Shrink''&lt;/em&gt; &lt;em&gt; when 95 then ''Log File Auto Shrink''&lt;/em&gt; &lt;em&gt; end as EventClass&lt;/em&gt; &lt;em&gt; , (Duration/1000) as Duration&lt;/em&gt; &lt;em&gt; , StartTime&lt;/em&gt; &lt;em&gt; , EndTime&lt;/em&gt; &lt;em&gt; , (IntegerData*8.0/1024) as ChangeInSize&lt;/em&gt; &lt;em&gt; from ::fn_trace_gettable( @base_tracefilename, default )&lt;/em&gt; &lt;em&gt; where EventClass &amp;gt;= 92 and EventClass order by StartTime desc ;&lt;/em&gt; &lt;em&gt; end else&lt;/em&gt; &lt;em&gt; select -1 as l1, 0 as EventClass, 0 DatabaseName, 0 as Filename, 0 as Duration, 0 as StartTime, 0 as EndTime,0 as ChangeInSize&lt;/em&gt; &lt;em&gt; end try&lt;/em&gt; &lt;em&gt; begin catch&lt;/em&gt; &lt;em&gt; select -100 as l1&lt;/em&gt; &lt;em&gt; , ERROR_NUMBER() as EventClass&lt;/em&gt; &lt;em&gt; , ERROR_SEVERITY() DatabaseName&lt;/em&gt; &lt;em&gt; , ERROR_STATE() as Filename&lt;/em&gt; &lt;em&gt; , ERROR_MESSAGE() as Duration&lt;/em&gt; &lt;em&gt; , 1 as StartTime, 1 as EndTime,1 as ChangeInSize&lt;/em&gt; &lt;em&gt; end catch',@params=N''&lt;/em&gt; Till slut kommer h&amp;auml;r en av anledningarna till varf&amp;ouml;r man inte skall s&amp;auml;tta &lt;strong&gt;Auto Shrink = True. &lt;/strong&gt;Som ni kan se av bilden nedan &amp;auml;r det r&amp;auml;tt avsev&amp;auml;rd tid som g&amp;aring;r &amp;aring;t f&amp;ouml;r att loggfilen i det h&amp;auml;r fallet skall v&amp;auml;xa och d&amp;auml;refter krympa i ett snurrande ekorrhjul.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/02/Data_Log-Files-Autogrow_Autoshrink-Events.jpg"&gt;&lt;img class="size-medium wp-image-2981 alignnone" title="Data_Log Files Autogrow_Autoshrink Events" src="../ci.axd?sid=dcb5ff25-a503-4e62-a24f-cfcce184c35a&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="519" height="192" /&gt;&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-07-20T10:11:28Z</a10:updated></item><item><guid isPermaLink="false">d5e1261c-fc1e-46e5-b99e-19467dc5a9a8</guid><link>http://sqlservice.se/sv/start/blogg/extended-stored-procedures.aspx?lang=sv</link><title>Extended Stored Procedures</title><description>&lt;p&gt;I guess most of you don't use Extended Stored Procedures any more since we now can and should use CLR integration instead. CLR integration has been around since version 2005 so this is old news, but, as a matter of fact Extended Stored Procedures are deprecated and will be removed in the next release of SQL Server. Because of this it's now time to once and for all stop using Extended Stored Procedures and a good place to start is to unload the dll file called by running: EXECUTE DBCC dllname (FREE) This command will unload the dll file from memory and make it possible to remove the Extended Stored Procedure. I know that it's not always easy to just stop using specific features so this command is also useful if you want to replace the dll file with a newer one for some reason. To get a list of all Extended Stored Procedures and the name of the dll file that the procedure belongs to you can run: EXECUTE sp_helpextendedproc If you want to know more about this or some other SQL Server related topic just contact any of our SQL Server consultants.&lt;/p&gt;</description><a10:updated>2012-07-20T10:09:20Z</a10:updated></item><item><guid isPermaLink="false">b9f43282-b84d-4a9c-9a2b-8d21e63efe31</guid><link>http://sqlservice.se/sv/start/blogg/sql-server--auto-update-stats-part-1.aspx?lang=sv</link><title>SQL server - Auto update stats part 1</title><description>&lt;p&gt;In the last couple of weeks I've been helping one of our clients with some performance issues in a stored procedure. Some days it works well and some days it doesn't. After some investigations I found two different execution plans, and the unefficient plan indicated that only one record was returned for some of the tables, but in the reality they returns a couple of hundreds of thousands.&lt;/p&gt;&#xD;
&lt;p&gt;This is a common problem when the statistics are out of date and you can read more about the problem at &lt;a title="SQL server death by bad statistics" href="http://sqlservice.se/sql-server/allmant/sql-server-death-by-bad-statistics/"&gt;my earlier blog post&lt;/a&gt;, but what about auto update stats. Doesn't it work? Well it does, the statistics are updated when more than 20% of the data is changed, but in this case we loads a datawarehouse with new data every day and the procedure that doesn't perform well only operates on new data. Some of the tables contains &amp;gt;3oo ooo ooo records and 20% of the data is a 60 000 000 records, and that means that the statistics are not updated every day.&lt;/p&gt;&#xD;
&lt;p&gt;The problem is that the procedure recompiles everytime and is using out of date statistics to create an execution plan. If you want to learn more about auto update stats you can try the attached script. &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;CREATE FUNCTION [dbo].[fnNumsTable](@pStartValue BIGINT= 1,@pEndValue BIGINT= 1000000,@pIncrement BIGINT= 1) RETURNS TABLE AS -- + --------------------------------------------------------------------------------------------------------------- -- ! O b j e c t i v e : Return a list of all numbers between startvalue to end value -- ! The table may be used to avoid cursors, generate a list of dates etc. -- +----------------------------------------------------------------------------------------------------------------&lt;/p&gt;&#xD;
&lt;p&gt;--Select n from dbo.[fnNumsTable](1000,2000,1) RETURN( WITH BaseNum(N) AS ( SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 ), L1(N) AS ( SELECT bn1.N FROM BaseNum bn1 CROSS JOIN BaseNum bn2 ), L2(N) AS ( SELECT a1.N FROM L1 a1 CROSS JOIN L1 a2 ), L3(N) AS ( SELECT TOP ((ABS(CASE WHEN @pStartValue &amp;lt; @pEndValue THEN @pEndValue ELSE @pStartValue END - CASE WHEN @pStartValue &amp;lt; @pEndValue THEN @pStartValue ELSE @pEndValue END))/ABS(@pIncrement)+ 1) a1.N FROM L2 a1 CROSS JOIN L2 a2 ), Tally(N) AS ( SELECT row_number() OVER (ORDER BY a1.N) FROM L3 a1 ) SELECT ((N - 1) * @pIncrement) + @pStartValue AS N FROM Tally ); GO CREATE TABLE dbo.statsSample ( ID int IDENTITY(1,1) NOT NULL, repDate DATE NOT NULL ); GO CREATE CLUSTERED INDEX ix ON dbo.statsSample ( ID )WITH (FILLFACTOR=100, ALLOW_ROW_LOCKS=ON, ALLOW_ROW_LOCKS=ON); GO CREATE PROCEDURE dbo.spStatsTest @records INT, @count int out, @statsdate datetime out --WITH recompile AS SET NOCOUNT ON; INSERT INTO dbo.statsSample ( repDate ) SELECT DATEADD(D,N,GETDATE()) FROM SQLServiceTools.dbo.fnNumsTable(1,@records,-1); SELECT @count = COUNT(1) FROM dbo.statsSample WHERE ID &amp;gt;0; SELECT @statsdate=STATS_DATE(i.object_id, i.index_id) FROM sys.indexes i WHERE i.object_id=OBJECT_ID('dbo.statsSample'); GO DECLARE @x INT = 0; DECLARE @initialrecords INT = 10000; DECLARE @increment INT =2000; DECLARE @STATSDATE DATETIME; DECLARE @COUNT INT; DECLARE @PREVSTATSDATE DATETIME; SET NOCOUNT ON; EXEC dbo.spStatsTest @initialrecords,@COUNT OUT,@STATSDATE OUT; SELECT @PREVSTATSDATE = ISNULL(@STATSDATE, GETDATE()); WHILE @x &amp;lt;@initialrecords BEGIN EXEC dbo.spStatsTest @increment,@COUNT OUT,@STATSDATE OUT; --INSERT INTO dbo.statsSample --( -- repDate --) --SELECT DATEADD(D,N,GETDATE()) --FROM dbo.fnNumsTable(1,@increment,-1) -- SELECT @count = COUNT(1) -- FROM dbo.statsSample -- WHERE ID &amp;gt;0 --SELECT @statsdate=STATS_DATE(i.object_id, i.index_id) --FROM sys.indexes i --WHERE i.object_id=OBJECT_ID('dbo.statsSample'); IF @PREVSTATSDATE&amp;lt;&amp;gt; @STATSDATE BEGIN --return the recordcount and the time of the stats update SELECT @COUNT,@STATSDATE; SELECT @PREVSTATSDATE = @STATSDATE END SET @x+=@increment/10; END DROP TABLE dbo.statsSample; DROP PROCEDURE dbo.spStatsTest;&lt;/p&gt;&#xD;
&lt;p&gt;As you can see in this test is that&amp;nbsp;the statistics are not updated in the procedure as long as&amp;nbsp;the procedure&amp;nbsp;doesn't recompile. If you add the WITH&amp;nbsp;RECOMPILE in the procedure, the statistics are&amp;nbsp;auto updated when you select from the table&amp;nbsp;and 20% of the data have been updated/inserted.&amp;nbsp;The more records you add, the&amp;nbsp;less&amp;nbsp;frequent&amp;nbsp;statistics updates you get. The worst part in this test is the bad execution plan. Take a look at the execution plan when you don't recompile the procedure, you'll notice that SQL server reports estimated number of records =1, but in the worst case, you have 100 000 records. Should you depend on AUTO UPDATE STATS? Well, get back next week, and I'll post a new blog post about auto update stats.&lt;/p&gt;</description><a10:updated>2012-07-20T10:07:41Z</a10:updated></item><item><guid isPermaLink="false">90d1b9a9-4bbb-48e0-a1ca-8d3c44a62d63</guid><link>http://sqlservice.se/sv/start/blogg/improving-performance-by-not-querying-the-database.aspx?lang=sv</link><title>Improving Performance by not querying the database?</title><description>&lt;p&gt;Did you ever think that it would be great to cache &lt;a href="http://www.microsoft.com/sql"&gt;SQL Server &lt;/a&gt;database query results, and only go back to query the database when data has changed? Well, you can do that, using Query Notifications. Query notifications were introduced as early as in SQL Server 2005. They are built upon the Service Broker infrastructure introduced in SQL Server 2005. Query notifications allow applications to be notified when data has changed.&lt;/p&gt;&#xD;
&lt;p&gt;This feature is particularly useful for applications that provide a cache of information from a database, such as a Web application, and need to be notified when the source data is changed. You still have to connect to the Service Broker Queue using the RECIEVE command, but that query would usually be much lighter that the query that you want notification for. No point in using Query Notifications for small quick queries with rapidly changing results, but rather for a little heavier queries that does not change it's results that often. Query notifications allow you to request notification within a specified time-out period when the underlying data of a query changes. The request for notification specifies the notification options, which include the service name, message text, and time-out value to the server.&lt;/p&gt;&#xD;
&lt;p&gt;Notifications are delivered through a Service Broker queue that your applications can poll for available notifications. Notifications are sent only once. For continuous notification of data change, a new subscription must be created by re-executing the query after each notification is processed. More information about Query Notification can be found &lt;a href="http://msdn.microsoft.com/en-us/library/ms175110(v=sql.110).aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;&#xD;
&lt;p&gt;And dont hesitate to contact us if you have any SQL Server related questions! &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T07:59:11Z</a10:updated></item><item><guid isPermaLink="false">7bebd1d3-aecd-4a04-bc1a-bcea20718b58</guid><link>http://sqlservice.se/sv/start/blogg/a-sql-azure-tip-a-day-(21)--security-services.aspx?lang=sv</link><title>A SQL Azure tip a day (21) - Security services</title><description>&lt;p&gt;If you are worried about the security of SQL Azure, there is an early prototype of &lt;a href="http://www.microsoft.com/en-us/sqlazurelabs/labs/sqlazuresecurityservices.aspx"&gt;SQL Azure Security Services&lt;/a&gt;&amp;nbsp;that you can use to scan your database to find any vulnerabilities. It is an easy to use Web application that will give you a report in your web browser or in your Azure storage. If the SQL Azure Security Services finds any security issues, you'll get a description and the a recommendation of how to fix the problem.&amp;nbsp;It is&amp;nbsp;nice to find the security threats that exists in my database, but I would also like to see all the security threats that&amp;nbsp;doesn't exists in my database. For my database there was only reported&amp;nbsp;one issue, but I can't see what &amp;nbsp;vulnerabilities that have been tested and that makes me worried. Does the Security Services test all the possible threats? Well, it's an early prototype and the final version may be more informative.&lt;/p&gt;</description><a10:updated>2012-07-20T07:56:07Z</a10:updated></item><item><guid isPermaLink="false">b0272d27-e5d5-4e42-aac7-86377aa6a83c</guid><link>http://sqlservice.se/sv/start/blogg/querytraceon.aspx?lang=sv</link><title>QUERYTRACEON</title><description>&lt;p&gt;Att man kan sl&amp;aring; p&amp;aring; traceflaggor p&amp;aring; global niv&amp;aring; eller sessionsniv&amp;aring; vet v&amp;auml;l de flesta, men det kan vara bra att veta att man &amp;auml;ven kan sl&amp;aring; p&amp;aring; traceflaggor p&amp;aring; statement niv&amp;aring;. F&amp;ouml;r att g&amp;ouml;ra det anv&amp;auml;nder man sig av en hint som heter QUERYTRACEON. T. ex. med traceflagga 3604 samt XXXX och YYYY: SELECT&amp;nbsp; FROM Table WHERE ORDER BY OPTION ( &amp;nbsp;QUERYTRACEON 3604, &amp;nbsp;QUERYTRACEON XXXX, &amp;nbsp;QUERYTRACEON YYYY ) D&amp;auml;r traceflagga 3604 anv&amp;auml;nds f&amp;ouml;r att skicka trace output till klienten och XXXX samt YYYY kan vara andra traceflaggor.&lt;/p&gt;</description><a10:updated>2012-07-20T07:55:31Z</a10:updated></item><item><guid isPermaLink="false">5a2b2574-4bc4-4071-a7df-d1c80ab62467</guid><link>http://sqlservice.se/sv/start/blogg/sql-server-2012-release-event-.aspx?lang=sv</link><title>SQL Server 2012 release event.</title><description>&lt;p&gt;Den 7 Mars 2012 s&amp;aring; anordnar Microsoft en virtuell release event, l&amp;auml;s mer om denna h&amp;auml;r : &lt;a href="http://www.sqlserverlaunch.com/ww/Home"&gt;http://www.sqlserverlaunch.com/ww/Home&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Nyheterna i SQL server 2012 &amp;auml;r s&amp;aring; efterl&amp;auml;ngtade att flera av v&amp;aring;ra kunder redan har b&amp;ouml;rjat f&amp;ouml;rbereda sig f&amp;ouml;r releasen s&amp;aring; att de snabbt kan uppgradera sina milj&amp;ouml;er n&amp;auml;r den finns tillg&amp;auml;nglig. Vill du veta mer om nyheterna och vad SQL Server 2012 kan inneb&amp;auml;ra f&amp;ouml;r dig s&amp;aring; &amp;auml;r du v&amp;auml;lkommen att kontakta v&amp;aring;ra SQL server konsulter som g&amp;auml;rna&amp;nbsp; g&amp;aring;r igenom den med dig. Vi har &amp;auml;ven tillsammans med Labcenter tagit fram 2st 3dagars labbar inom SQL server programmering och SQL server administration. L&amp;auml;s mer om dessa p&amp;aring; &lt;a href="http://www.labcenter.se/lab/2113"&gt;Labcenter&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-07-20T07:54:55Z</a10:updated></item><item><guid isPermaLink="false">85e7d91d-8a90-4c53-845c-f37ce1b92ddb</guid><link>http://sqlservice.se/sv/start/blogg/request_session_id-=--2-.aspx?lang=sv</link><title>Request_session_id = - 2 ?</title><description>&lt;p&gt;En av de m&amp;aring;nga f&amp;ouml;rdelar n&amp;auml;r man jobbar som konsult hos oss &amp;auml;r att man f&amp;aring;r se olika milj&amp;ouml;er och olika verksamheter. Ofta kan v&amp;aring;ra kunder ha likartade problem men s&amp;aring; &amp;auml;r inte alltid fallet. Ibland st&amp;ouml;ter man p&amp;aring; problem som &amp;auml;r r&amp;auml;tt ovanliga, m&amp;auml;rkliga och inte alltid helt l&amp;auml;tt att hitta l&amp;ouml;sningen till heller.&lt;/p&gt;&#xD;
&lt;p&gt;H&amp;auml;r kommer ett exempel p&amp;aring; detta. Om man uppt&amp;auml;cker att loggfilen &amp;auml;r st&amp;ouml;rre &amp;auml;n datafilen b&amp;ouml;r man kontrollera vad detta beror p&amp;aring;. En troliga orsak &amp;auml;r att det finns aktiva transaktioner som inte avslutats som man kan se nedan. &lt;strong&gt;select name, log_reuse_wait_desc&lt;/strong&gt; &lt;strong&gt; from sys.databases&lt;/strong&gt; Ger detta resultat &lt;strong&gt;name log_reuse_wait_desc&lt;/strong&gt; &lt;strong&gt; DBxxx ACTIVE_TRANSACTION&lt;/strong&gt; N&amp;auml;sta steg blir d&amp;aring; att kontrollera den &amp;auml;ldsta transaktionen och f&amp;ouml;rhoppningsvis avsluta den s&amp;aring; att inte loggfilen forts&amp;auml;tter v&amp;auml;xa. F&amp;ouml;r att hitta transaktionen anv&amp;auml;nder man &lt;strong&gt;DBCC OPENTRAN&lt;/strong&gt;, och detta kan ge f&amp;ouml;ljande resultat: &lt;em&gt;Oldest active transaction:&lt;/em&gt; &lt;em&gt; SPID (server process ID): 60&lt;/em&gt; &lt;em&gt; UID (user ID) : -1&lt;/em&gt; &lt;em&gt; Name : offline index build&lt;/em&gt; &lt;em&gt; LSN : (109581:2986:82)&lt;/em&gt; &lt;em&gt; Start time : Jan 12 2012 10:31:04:337PM&lt;/em&gt; &lt;em&gt; SID : 0x0&lt;/em&gt; &lt;em&gt; DBCC execution completed. If DBCC printed error messages, contact your system administrator.&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Som regel vill man avsluta en s&amp;aring; gammal transaktionen som i det h&amp;auml;r fallet , dvs SPID = 60 och detta g&amp;ouml;r man med &lt;strong&gt;KILL&lt;/strong&gt;. Innan man g&amp;ouml;r det vill man f&amp;ouml;rst&amp;aring;s kontrollera vilken kod som kan vara orsak till den aktiva transaktionen och f&amp;ouml;r detta anv&amp;auml;nder man &lt;strong&gt;DBCC INPUTBUFFER&lt;/strong&gt;. Nu b&amp;ouml;rjar det intressanta. Detta kan n&amp;auml;mligen inte vara samma transaktion som vi &amp;auml;r ute efter. Kan det d&amp;aring; vara en sk. &lt;strong&gt;Orphaned MSDTC transactions&lt;/strong&gt; som &amp;auml;r mycket bra beskriven &lt;a href="http://www.eraofdata.com/blog/tag/distributed-transactions/" target="_blank"&gt;h&amp;auml;r&lt;/a&gt;&amp;nbsp;och som m&amp;aring;nga refererar till t.ex. Paul Randall. Nu finns en chans att vi kan anv&amp;auml;nda request_owner_guid och d&amp;auml;refter KILL. &lt;strong&gt;SELECT sys.databases.database_id, sys.databases.name, sys.dm_tran_locks.request_owner_guid&lt;/strong&gt; &lt;strong&gt; FROM sys.dm_tran_locks INNER JOIN&lt;/strong&gt; &lt;strong&gt; sys.databases ON sys.dm_tran_locks.resource_database_id = sys.databases.database_id&lt;/strong&gt; &lt;strong&gt; WHERE sys.dm_tran_locks.request_session_id = - 2&lt;/strong&gt; Nej, detta hj&amp;auml;lper inte med '00000000-0000-0000-0000-000000000000' som request_owner_guid.&lt;/p&gt;&#xD;
&lt;p&gt;Vi testar d&amp;aring; till slut att starta om SQL Serverns tj&amp;auml;nster och ocks&amp;aring; omstart av msdtc, men inte heller detta hj&amp;auml;lper i det h&amp;auml;r fallet. N&amp;auml;stan direkt efter omstart kommer v&amp;aring;r "felaktiga transaktion" som nu leder oss mot fulltext index mha &lt;strong&gt;fn_dblog&lt;/strong&gt; som inneb&amp;auml;r att vi kan l&amp;auml;sa fr&amp;aring;n transaktionsloggen. N&amp;auml;sta steg blir nu att kontrollera alla fulltext index f&amp;ouml;r databasen. Detta visar n&amp;aring;got mycket m&amp;auml;rkligt, n&amp;auml;mligen att dessa &amp;auml;r uppdaterade s&amp;aring; l&amp;auml;nge sedan som under 2009. Normalt skall detta ske vid t.ex. insert. N&amp;auml;r index &amp;auml;r uppdaterade kan man se enkelt med nedast&amp;aring;ende SQL-sats. &lt;strong&gt;SELECT sch.name AS SchemaName, t.name AS TableName, c.name AS FTCatalogName, i.has_crawl_completed, i.crawl_start_date, i.crawl_end_date&lt;/strong&gt; &lt;strong&gt; FROM sys.tables t JOIN sys.fulltext_indexes i&lt;/strong&gt; &lt;strong&gt; ON t.object_id = i.object_id&lt;/strong&gt; &lt;strong&gt; JOIN sys.fulltext_catalogs c&lt;/strong&gt; &lt;strong&gt; ON i.fulltext_catalog_id = c.fulltext_catalog_id&lt;/strong&gt; &lt;strong&gt; JOIN sys.schemas sch&lt;/strong&gt; &lt;strong&gt; ON sch.schema_id = t.schema_id&lt;/strong&gt; &lt;strong&gt; ORDER BY SchemaName, TableName&lt;/strong&gt; Vad h&amp;auml;nder d&amp;aring; om vi bygger om index'ena med &lt;strong&gt;ALTER FULLTEXT CATALOG xxx REBUILD&lt;/strong&gt; ?.&lt;/p&gt;&#xD;
&lt;p&gt;Jo, crawl_start_date och crawl_end_date uppdateras nu med dagens datum. &amp;nbsp;Dock har vi kvar v&amp;aring;ran Active Transaction, men inte l&amp;auml;nge till. F&amp;ouml;r efter en omstart av SQL Server s&amp;aring; &amp;auml;r allt nu ok :-). Som sagt, ibland kan en fels&amp;ouml;kning best&amp;aring; av m&amp;aring;nga tester och antaganden innan man till slut hittar den slutgilitga orsaken. &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T07:53:21Z</a10:updated></item><item><guid isPermaLink="false">5054f08a-7596-4a24-ad1a-b30e9505eb6c</guid><link>http://sqlservice.se/sv/start/blogg/mirroring-related-error-3624,-severity-20,-state-1.aspx?lang=sv</link><title>Mirroring related Error: 3624, Severity: 20, State: 1</title><description>&lt;p&gt;Recently, I had the pleasure of troubleshooting several Error 3624 on a &lt;a href="http://www.microsoft.com/sql"&gt;SQL Server 2008 R2&lt;/a&gt; instance. It seems to be related to bulk copying in data to a principal database in a mirroring setup. The principal never runs into trouble, but the mirror database generates an error when trying to replay the transactions. It tries to initiate a lock escalation, but fails for some unknown reason. The mirroring session is then suspended, and will have to be reinitialized from start. From this Microsoft Knowledgebase article &lt;a href="http://support.microsoft.com/kb/974319"&gt;http://support.microsoft.com/kb/974319&lt;/a&gt; it seems that this problem should be fixed in CU1 for SQL Server 2008 R2. But we got the exact same problem even though we were running on SP1 (10.50.2500). So it seems that this error might have resurfaced, or that there exists a similar bug still. If you run into this problem, with SP1 installed, you should contact Microsoft Support. In the meantime, two workarounds should be possible. Either do a regular insert instead of an Bulk Insert, or you can break mirror beforehand and reinit it after the bulk insert operation.&lt;/p&gt;&#xD;
&lt;p&gt;If you need help with SQL Server, we are always &lt;a title="Kontakta oss" href="http://sqlservice.se/kontakta-oss/"&gt;happy to help&lt;/a&gt;!&lt;/p&gt;</description><a10:updated>2012-07-20T07:52:18Z</a10:updated></item><item><guid isPermaLink="false">7380bca6-aeb5-4625-97f3-56237662add1</guid><link>http://sqlservice.se/sv/start/blogg/begin-distributed-transaction.aspx?lang=sv</link><title>Begin Distributed Transaction</title><description>&lt;p&gt;A transaction is a essential part of every database/application. If a transaction involves more than one server it becomes distributed and this is where MS DTC comes into play. The first step to make a distributed transaction work is to make sure SQL Server can enlist in the local MS DTC and a good place to start is to run the following in Management Studio: BEGIN DISTRIBUTED TRANSACTION If MS DTC is not installed or not working properly the above statement will produce an error message and you need to solve this before you can go ahead and test transactions against other servers. Once the local transaction coordinator is working there are some tools to check if MS DTC is working properly with other servers. DTC PING is a tool that is used to check that certain ports are open and that name resolution works, if you for example need to run distributed transactions through a firewall.&lt;/p&gt;&#xD;
&lt;p&gt;It can be downloaded here: &lt;a href="http://www.microsoft.com/download/en/details.aspx?id=2868"&gt;http://www.microsoft.com/download/en/details.aspx?id=2868&lt;/a&gt; DTC TESTER is another tool that actually creates and runs a dummy distributed transaction.&lt;/p&gt;&#xD;
&lt;p&gt;Over the years i've found this tool very reliable and in my experience if this works then you won't have any problems running distributed transactions. It can be downloaded here: &lt;a href="http://support.microsoft.com/kb/293799"&gt;http://support.microsoft.com/kb/293799&lt;/a&gt;&lt;/p&gt;</description><a10:updated>2012-07-20T07:51:58Z</a10:updated></item><item><guid isPermaLink="false">f9904633-2627-4de2-ab65-4026658c297b</guid><link>http://sqlservice.se/sv/start/blogg/sql-azure-tip-a-day-(20)--reporting-service.aspx?lang=sv</link><title>SQL Azure tip a day (20) - Reporting Service</title><description>&lt;p&gt;In SQL Azure there is a CTP of Reporting Services for Azure. It is easy to configure and you use the same development tool as you do with SQL Reporting Services 2008.&amp;nbsp; Personally I had some trouble when I uploaded the reports in to the SQL Azure Reporting server through the managment portal, but I may have done something wrong. The good news is that when I deployed the report and the&amp;nbsp;Shared Data Source through&amp;nbsp;Visual Studio 2008 it&amp;nbsp;worked just fine and&amp;nbsp;it was even easier. You install and configure the SQL Azure Reporting Server in&amp;nbsp;3 simple steps.&lt;/p&gt;&#xD;
&lt;h3&gt;1 Create a new SQL Azure Server&lt;/h3&gt;&#xD;
&lt;p&gt;Sign in to the managment portal and click the reporting button, and then click the "Create new SQL Azure Reporting Server" &lt;a href="http://sqlservice.se/wp-content/uploads/2011/12/step1.png"&gt;&lt;img class="alignnone size-large wp-image-2884" title="step1" src="../ci.axd?sid=c260c996-e5ec-4751-984f-8672936fb5a0&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="1024" height="431" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;h3&gt;2. Select subscription&lt;/h3&gt;&#xD;
&lt;p&gt;To create a new SQL Azure Reporting Server, you need to select your subscription and the region you want. Then click next.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2011/12/step2.png"&gt;&lt;img class="alignnone size-full wp-image-2885" title="step2" src="../ci.axd?sid=07bb0aa1-66be-444c-af6c-3174e72f7a55&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="462" height="350" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;h3&gt;3. Create an administrator account.&lt;/h3&gt;&#xD;
&lt;p&gt;As SQL Azure doesn't handle Windows Authentication, you need to create an administrator account and set a password. Once that is done, click next.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;a href="http://sqlservice.se/wp-content/uploads/2011/12/step3.png"&gt;&lt;img class="alignnone size-full wp-image-2886" title="step3" src="../ci.axd?sid=50aa8325-0c1e-457e-882f-50efc2d6d333&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="463" height="348" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;If everything works as it should, you now have a Reporting service in the cloud. Simple as that. How long did it take? Well, a couple of minutes. &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T07:51:31Z</a10:updated></item><item><guid isPermaLink="false">c606e1d9-5551-43ef-a3e4-7688a5819963</guid><link>http://sqlservice.se/sv/start/blogg/logman.aspx?lang=sv</link><title>Logman</title><description>&lt;p&gt;Jag har tidigare skrivit om PAL, &lt;strong&gt;Performance Analysis For Logs&lt;/strong&gt; och d&amp;aring; n&amp;auml;mnt om att man kan anv&amp;auml;nda &lt;strong&gt;Logman&lt;/strong&gt; f&amp;ouml;r att skapa en perfmon-fil.Detta &amp;auml;r v&amp;auml;ldigt anv&amp;auml;ndbart och g&amp;aring;r ocks&amp;aring; snabbt att s&amp;auml;tta upp i olika milj&amp;ouml;er om man skulle vilja det. F&amp;ouml;r att analysera en blg-fil mha &lt;strong&gt;PAL&lt;/strong&gt; beh&amp;ouml;ver man m&amp;auml;tv&amp;auml;rden. Dessa sparar man i en textfil som jag i exemplet har d&amp;ouml;pt till &lt;strong&gt;sql_counters.txt&lt;/strong&gt; och d&amp;auml;r ni ser n&amp;aring;gra av raderna nedan. &lt;em&gt;\LogicalDisk(*)\Disk Reads/sec&lt;/em&gt; &lt;em&gt; \LogicalDisk(*)\Disk Transfers/sec&lt;/em&gt; &lt;em&gt; \LogicalDisk(*)\Disk Writes/sec&lt;/em&gt; &lt;em&gt; \Memory\% Committed Bytes In Use&lt;/em&gt; &lt;em&gt; \Memory\Available MBytes&lt;/em&gt; &lt;em&gt; \Memory\Cache Bytes&lt;/em&gt; &lt;em&gt; ....&lt;/em&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Jag har ocks&amp;aring; en bat-fil, &lt;strong&gt;load_sql_counters.bat&lt;/strong&gt; som inneh&amp;aring;lla dessa rader: &lt;em&gt;logman stop SQLServer&lt;/em&gt; &lt;em&gt; logman delete SQLServer&lt;/em&gt; &lt;em&gt; logman create counter SQLServer -cf "c:\Logman\sql_counters.txt" -si 30 -o "C:\Perflog\SQLService_" -b 2012-01-24 09:00 -e 2012-01-24 11:00 -v mmddhhmm -r&lt;/em&gt; Inte alltf&amp;ouml;r sv&amp;aring;r logik som ni ser d&amp;auml;r jag skapar en data collector, &amp;nbsp;SQLServer som om den redan skulle finnas f&amp;ouml;rst stoppar och i s&amp;aring; fall tar bort den. Man kan ocks&amp;aring; se att jag anv&amp;auml;nder textfilen med alla m&amp;auml;tv&amp;auml;rden. Just i det h&amp;auml;r exemplet ser man inamlingen skall mellan kl 09 och 11 med start 24/1 och d&amp;auml;refter upprepas varje dag. Som sagt ett smidigt s&amp;auml;tt att aktivera insamling av m&amp;auml;tv&amp;auml;rden och ett bland m&amp;aring;nga verktyg som man har nytta av n&amp;auml;r man skall fels&amp;ouml;ka eller optimera sin SQL Server milj&amp;ouml;.&lt;/p&gt;</description><a10:updated>2012-07-20T07:49:47Z</a10:updated></item><item><guid isPermaLink="false">115fb735-9ae7-43ab-a231-bbeec4f7eead</guid><link>http://sqlservice.se/sv/start/blogg/a-sql-azure-tip-a-day-(19)--high-availibility.aspx?lang=sv</link><title>A SQL Azure tip a day (19) - High Availibility</title><description>&lt;p&gt;Well,&amp;nbsp;the last&amp;nbsp;blog post from my collegue&amp;nbsp;was causing some attention! Lets make something very clear.&amp;nbsp;We like the SQL Azure concept even if it doesn't sounds like that in some of our blog posts. The purpose of this series of blogs is to share some knowledge that may help you when you are about to move to the Cloud, not to criticize the SQL Azure platform. The performance test from the last blog post&amp;nbsp;was not a real case scenario, but rather a benchmarkt test that you can try for yourself on different SQL server configurations and&amp;nbsp;disk setup to find the best setup for your demands. You can use it&amp;nbsp;to&amp;nbsp;compare between&amp;nbsp;a SAN solution and local&amp;nbsp;HDD:s,&amp;nbsp; between&amp;nbsp;different RAID&amp;nbsp;levels, peek&amp;nbsp;vs off-peek hours,&amp;nbsp;or between SSD vs HDD solutions as long as you do the same test on all of your configurations. The test performed in the previous blog post was during peek hours and&amp;nbsp;you'll get some improvement running the same test in off-peek hours.&lt;/p&gt;&#xD;
&lt;p&gt;The performance measured is about the same as another&amp;nbsp;SQL server connected to a SAN with synchronous replication to a secondary site. but the laptop in the test used as a reference is still about 5 times faster and it is about the same as a local SQL server with internal drives. Waits that we could maesur all had to do with High Availibilty, and of course you can't get High Availibility on your laptop, but&amp;nbsp;in SQL Azure you have 99,9% avalibility. In SQL Azure you have 2 exact kopies of the database. The conclusion is that you'll get High Availibilty at the cost of the ultimate performance. It's no big deal but you have to be aware of it.&lt;/p&gt;&#xD;
&lt;p&gt;If you need more performance in SQL Azure, you can use multiple databases with Federation&amp;nbsp;and multiple connections. &amp;nbsp; &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-20T07:49:06Z</a10:updated></item><item><guid isPermaLink="false">fad50c41-487b-4cc7-ae17-c26babf79558</guid><link>http://sqlservice.se/sv/start/blogg/set-options.aspx?lang=sv</link><title>SET OPTIONS</title><description>&lt;p&gt;Efter att ha sv&amp;auml;vat omkring i molnet hela veckan t&amp;auml;nkte jag att det nu &amp;auml;r dags att komma ner p&amp;aring; jorden igen :-) H&amp;auml;rom dagen beh&amp;ouml;vde jag snygga till lite data. Eftersom datat laddas om varje vecka s&amp;aring; var det ju ett m&amp;aring;ste att automatisera det hela. Jag best&amp;auml;mde mig f&amp;ouml;r att skapa ett jobb som k&amp;ouml;rs av SQL Server Agent. Sj&amp;auml;lva tillsnyggandet av datat var mycket enkel: UPDATE TraceEvent SET StartTime = DATEADD(DD, DATEDIFF(DD, StartTime, EndTime), StartTime) Allts&amp;aring; inga konstigheter. N&amp;auml;r jag sedan provk&amp;ouml;r detta s&amp;aring; f&amp;aring;r jag ett fel: Executed as user: NT AUTHORITY\SYSTEM. UPDATE failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations. [SQLSTATE 42000] (Error 1934).&amp;nbsp; The step failed.&lt;/p&gt;&#xD;
&lt;p&gt;Ok, vad &amp;auml;r nu detta? Det fungerade bra n&amp;auml;r jag testk&amp;ouml;rde i SSMS, jag har ingen indexerad vy, jag har inga xml datatyper och absolut inga spatiala index....&lt;/p&gt;&#xD;
&lt;p&gt;MEN min tabell inneh&amp;aring;ller faktiskt en "computed column"! Vad SQL Server s&amp;auml;ger &amp;auml;r att jag har fel SET Options men n&amp;auml;r jag k&amp;ouml;r Update skriptet direkt i Management Studio s&amp;aring; g&amp;aring;r det bra, det m&amp;aring;ste betyda att jag f&amp;aring;r andra SET Options n&amp;auml;r jag k&amp;ouml;r det hela i ett jobb.&lt;/p&gt;&#xD;
&lt;p&gt;Ett enkelt s&amp;auml;tt att ta reda p&amp;aring; vilka SET Options man har n&amp;auml;r man k&amp;ouml;r ett jobb &amp;auml;r att l&amp;auml;gga in f&amp;ouml;ljande i ett jobbsteg: DECLARE @options INT SELECT @options = @@OPTIONS IF ( (1 &amp;amp; @options) = 1 ) PRINT 'DISABLE_DEF_CNST_CHK' IF ( (2 &amp;amp; @options) = 2 ) PRINT 'IMPLICIT_TRANSACTIONS' IF ( (4 &amp;amp; @options) = 4 ) PRINT 'CURSOR_CLOSE_ON_COMMIT' IF ( (8 &amp;amp; @options) = 8 ) PRINT 'ANSI_WARNINGS' IF ( (16 &amp;amp; @options) = 16 ) PRINT 'ANSI_PADDING' IF ( (32 &amp;amp; @options) = 32 ) PRINT 'ANSI_NULLS' IF ( (64 &amp;amp; @options) = 64 ) PRINT 'ARITHABORT' IF ( (128 &amp;amp; @options) = 128 ) PRINT 'ARITHIGNORE' IF ( (256 &amp;amp; @options) = 256 ) PRINT 'QUOTED_IDENTIFIER' IF ( (512 &amp;amp; @options) = 512 ) PRINT 'NOCOUNT' IF ( (1024 &amp;amp; @options) = 1024 ) PRINT 'ANSI_NULL_DFLT_ON' IF ( (2048 &amp;amp; @options) = 2048 ) PRINT 'ANSI_NULL_DFLT_OFF' IF ( (4096 &amp;amp; @options) = 4096 ) PRINT 'CONCAT_NULL_YIELDS_NULL' IF ( (8192 &amp;amp; @options) = 8192 ) PRINT 'NUMERIC_ROUNDABORT' IF ( (16384 &amp;amp; @options) = 16384 ) PRINT 'XACT_ABORT' Printsatserna kommer d&amp;aring; att skriva ut de SET Options som g&amp;auml;ller och dessa kan man se i "View History" p&amp;aring; jobbet. I mitt fall blev resultatet: Executed as user: NT AUTHORITY\SYSTEM. ANSI_WARNINGS [SQLSTATE 01000] (Message 0)&amp;nbsp; ANSI_PADDING [SQLSTATE 01000] (Message 0)&amp;nbsp; ANSI_NULLS [SQLSTATE 01000] (Message 0)&amp;nbsp; ANSI_NULL_DFLT_ON [SQLSTATE 01000] (Message 0)&amp;nbsp; CONCAT_NULL_YIELDS_NULL [SQLSTATE 01000] (Message 0).&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;The step succeeded. H&amp;auml;r kan man d&amp;aring; se att QUOTED_IDENTIFIER inte &amp;auml;r satt vilket &amp;auml;r mitt problem. Allt som beh&amp;ouml;ver g&amp;ouml;ras nu &amp;auml;r att &amp;auml;ndra jobbet till: SET QUOTED_IDENTIFIER ON GO UPDATE TraceEvent SET StartTime = DATEADD(DD, DATEDIFF(DD, StartTime, EndTime), StartTime)&lt;/p&gt;&#xD;
&lt;p&gt;Nu funkar jobbet som t&amp;auml;nkt och allt &amp;auml;r &amp;aring;terigen frid och fr&amp;ouml;jd :-)&lt;/p&gt;</description><a10:updated>2012-07-20T07:48:19Z</a10:updated></item><item><guid isPermaLink="false">e91621ee-2990-4608-a826-c32e55d6c2cd</guid><link>http://sqlservice.se/sv/start/blogg/sql-azure-followup.aspx?lang=sv</link><title>SQL Azure followup</title><description>&lt;p&gt;I have received quite some &lt;a href="http://cloud.idg.se/2.16150/1.427282/prestandadebatt-om-microsofts-molndatabas"&gt;attention&lt;/a&gt; after my &lt;a title="A SQL Azure tip a day (18) &amp;ndash; My Laptop is faster than SQL AZURE ?!?" href="http://sqlservice.se/sql-server/sql-server-performance/a-sql-azure-tip-a-day-17-my-laptop-is-faster-than-sql-azure/"&gt;previous blog post &lt;/a&gt;regarding &lt;a href="http://www.windowsazure.com"&gt;SQL Azure&lt;/a&gt; and INSERT performance. Therefore I would like to comment on some of the questions and issues raised, as well as giving my opinion on SQL Azure amongst other things. I will divide it into two sections, an overall perspective on performance testing and general platform evaluation, and one section about the technical aspects of that particular test. If you are short on time, here is a short summary: Even if the test I performed and reported on in itself is valid and correct, it was a simple test. It tests only one of the many aspects that should be taken into consideration while evaluating performance on SQL Azure, or even indeed on any other &lt;a href="http://www.microsoft.com/sql"&gt;SQL Server&lt;/a&gt; platform or server. And no, I do not recommend that you run your production SQL Server databases on a laptop :-)&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Overall perspective&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;I do a lot of consulting on SQL Server, and have done for about 16 years, helping customers in all types of projects regarding SQL Server. And in my experience, the more I can base my recommendations on fact, the better the results. Therefore I like to test and verify as many aspects of my recommendations as I can. However, a single test will not give you the answer to what road to take when choosing the database platform that is best for you. Besides from functionality, there are three main areas that should be considered while testing, evaluation and choosing a database platform for your application: Performance, Availability and Cost. Each customer have their own order of priority of course, but generally most of them want as much Performance and Availability as possible, with as little Cost as possible. Of course. The trick is to find the right mix of these three for each customer. And as with most things, it quickly comes down to tradeoffs between the different goals. And the three main areas are themselves of course divided into many sub-areas, which in turn needs to be balanced right for each customer.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Availability&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;This is the most critical factor, when it really comes down to it. Particularly the Disaster Recovery aspect of it. It can be really, really costly if your database server fails and you can&amp;rsquo;t recover your data. Every year,&amp;nbsp; companies goes bankrupt for that reason. The good thing is that a real disaster rarely happens, the bad news is that this tends to cause people to view it as less important. But I think that this should be your highest priority, in the sense that you define the maximal data loss and the maximal service loss (in minutes or hours) that you can accept, and design your database platform to meet that criteria. The money you have left in your budget can then go to increasing performance. However, sometimes availability comes at the cost of performance. This can be the case in for example SQL Azure, which always keeps 2 additional copies of your database&lt;del&gt; and at least one of those outside your primary datacenter&lt;/del&gt;.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;EDIT: The&amp;nbsp;copies of the databases are all within the same datacentre&lt;/strong&gt;.&amp;nbsp;This is synchronous copies, and that adds some overhead. Other forms of High Availability or Disaster Recovery techniques that will add overhead, and therefore decrease performance is SAN discs, Mirroring, and Replication. Logshipping is actually the option that adds the least overhead. But it is also very important to test and verify the choices you make here, such as regularly restoring your backups and checking their consistency, and performing controlled Disaster Recovery scenario exercises.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Performance&lt;/strong&gt; This area is almost too big to even get started on. But apart from our blog, another good sources of information is &lt;a href="http://www.sql-server-performance.com/"&gt;http://www.sql-server-performance.com/&lt;/a&gt; . The most critical factor here is the application itself, that is from the database perspective the database model,&amp;nbsp; queries, indexes and design choices such as what data to put inside our outside the database, stored procedures vs ad hoc queries, OR mappers or not, and so on. Then there are the setup and configuration of SQL Server itself, and the server/infrastructure hardware. Once again, testing and verifying the choices you make are important. Make sure that you do it in your test environment before you go into production, it is so much easier and cheaper to remedy any problems in that stage. Many times, IO is the main bottleneck in the hardware. Therefore I usually verify that the discs performs as expected using for example SQLIO, and various scripts, to make sure I know that there are no problems with the setup of the discs. In general you will have to spend a lot more money on a SAN to get even close to the performance you can get from a locally attached array of discs. SSD is great in many respects, but still a bit too pricy for most customers. Adding RAM to your server can greatly offset many IO related bottlenecks, with one exception: Adding, Deleting or Changing data always puts pressure on your transaction log drive, as the operations have to be written to stable media (usually disc) before actually being performed on your data.&amp;nbsp; Evaluating performance of your particular SQL Server and Hardware combo setup, gives insight to what that platform can give you in terms of raw transactions per second, but in reality you will most likely have much to gain from looking long and hard at your application first. But it is good to know what your environment can deliver, after it has been set up and configured as good as it can be.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Cost&lt;/strong&gt; This is an interesting aspect, that can be dissected in many ways. TCO and ROI are examples of different popular ways of looking at cost. The costs incurred in database platform related projects are usually first upfront costs from hardware, software and man hours and secondly it is the running costs of the platform. This is where SQL Azure can really shine compared to an on-site SQL Server solution. The startup cost for hardware and software are zero. And the running costs are low as well. My tests where run on a 1 GB Web Edition of SQL Azure that costs from $9.99 (&lt;a href="https://www.windowsazure.com/sv-se/pricing/calculator/"&gt;https://www.windowsazure.com/sv-se/pricing/calculator/&lt;/a&gt;) Startup and running costs for on-premise SQL Server is far higher, even if there is a free version of SQL Server available ( &lt;a href="http://www.microsoft.com/sqlserver/en/us/editions/express.aspx"&gt;http://www.microsoft.com/sqlserver/en/us/editions/express.aspx&lt;/a&gt; ) If you already have an IT infrastructure, or if you require many and large databases, your calculations might be different of course. As always, if you want the best possible solution in terms of performance and availability, be prepared to pay. On the other hand, it might be even more costly if you do not plan and test properly in advance, and implement a solution that actually fills your particular needs.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;The technical details&lt;/strong&gt; First I want to state that you will have to make some changes to the scripts in the previous blogpost to make them run on SQL Azure, as there where index options in there that is not supported on SQL Azure. But that was just due to the fact that I scripted out the indexes using SSMS from SQL Server 2008 R2. That makes no difference to the actual test however. So, to address some of the questions regarding the actual test, I have compiled a little list of Q&amp;amp;A: -&amp;nbsp;Q: Use newsequentialid() instead of newid(). A: That is not possible, as newsequentialid() is not supported yet on SQL Azure -&amp;nbsp;Q: Change the Clustered Index to to on the INT_COL column instead. A: I haven&amp;rsquo;t tested this, but I suspect it might impact the amount of transaction log that we create quite a lot (see &lt;a href="http://sqlskills.com/BLOGS/PAUL/post/How-expensive-are-page-splits-in-terms-of-transaction-log.aspx"&gt;http://sqlskills.com/BLOGS/PAUL/post/How-expensive-are-page-splits-in-terms-of-transaction-log.aspx&lt;/a&gt;) But in fairness, that improvement would also benefit the other system. The test was deliberately designed to be though, so that differences in results would be easier to spot. -&amp;nbsp;Q: Wasn&amp;rsquo;t the test unfair, as your local where inserting over the internet to SQL Azure? A: No, I was using a Stored Procedure, so the Insert was local to both SQL Azure and my local machine. -&amp;nbsp;Q:&lt;/p&gt;&#xD;
&lt;p&gt;But how can your laptop be faster? A: In this case, I think it depends on a few factors: My local disc has write cache enabled, which is of course not recommended on production systems (reference: &lt;a href="http://msdn.microsoft.com/en-us/library/ms186259.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms186259.aspx&lt;/a&gt;) SQL Azure also have quite a lot more redundancy built in, than my laptop  Aside from the primary database, it also has 2 synchronous copies. This is excellent for Availability, but introduces overhead that impairs performance.&amp;nbsp; Since you are guaranteed to have at least one of the copies outside the primary datacenter, I believe that that will be the main issue here. In addition, SQL Azure is a shared environment, and I have no control over what was running on the other databases running on the same hardware. Additionally , SQL Azure has built in throttling but that was most likely not invoked in this case. (Lots of good info is here: &lt;a href="http://social.technet.microsoft.com/wiki/contents/articles/sql-azure-performance-and-elasticity-guide.aspx"&gt;http://social.technet.microsoft.com/wiki/contents/articles/sql-azure-performance-and-elasticity-guide.aspx&lt;/a&gt;) &amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;If you have any questions about anything in this article, feel free to contact me at Steinar&amp;lt;dot&amp;gt;Andersen&amp;lt;at&amp;gt;sqlservice&amp;lt;dot&amp;gt;se or via &lt;a title="Kontakta oss" href="http://sqlservice.se/kontakta-oss/"&gt;this page&lt;/a&gt;!&lt;/p&gt;</description><a10:updated>2012-07-20T07:46:33Z</a10:updated></item><item><guid isPermaLink="false">6165a22c-17b4-4afc-b2b7-49bdb2852a73</guid><link>http://sqlservice.se/sv/start/blogg/a-sql-azure-tip-a-day-(17)--tuning-your-queries-1.aspx?lang=sv</link><title>A SQL Azure tip a day (17) - Tuning your queries 1</title><description>&lt;p&gt;I really miss a lot of DMV:s that I normally use for performance tuning, and I hope Microsoft will add some more support for DMV:s. When you build a database, you often need to compare the performance of two similar T-SQL statements or procedures to find the fastest statements and to get an honest result you need to flush the cache to compare them with "cold" cache.&amp;nbsp;In SQL server 2008 you can use&amp;nbsp;&amp;nbsp;DBCC&amp;nbsp;FREEPROCCACHE and DBCC DROPCLEANBUFFERS, but in SQL Azure these statements doesn't exist, and you can't flush the cache. On the other hand, you shouldn't use them in production anyway! But how should I compare them then? I don't have a SQL Azure development server and even if I had, I can't flush the cache to get a cold cache. You could of course develop on SQL server 2008 and hope that you only use supported T-SQL statements. Well, I guess thats not gonna happen. If you want to compare the two statements between each other in SQL Azure you can't rely on the execution time due to the hot cache. you need to look at the execution plan and the execution stats to find out which of them are using less IO operations and CPU worker time.&lt;/p&gt;&#xD;
&lt;p&gt;With the following script that I created for SQL server 2005,&amp;nbsp;you can get the execution stats and the execution plans for individual SQL statements, but you can't get the procedure stats like in SQL 2008, becuase sys.dm_exec_procedure_stats is not supported in SQL Azure.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; QS.sql_handle, &lt;span style="color: #0000ff;"&gt;ROW_NUMBER&lt;/span&gt;() OVER(&lt;span style="color: #0000ff;"&gt;PARTITION BY&lt;/span&gt; qs.sql_handle &lt;span style="color: #0000ff;"&gt;ORDER BY&lt;/span&gt; statement_start_offset) &lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt; statement_no, qs.execution_count, qs.total_physical_reads, qs.total_logical_reads, qs.total_logical_writes, qs.last_execution_time, sql_total_worker_time_s=&lt;span style="color: #ff00ff;"&gt;convert&lt;/span&gt;(&lt;span style="color: #0000ff;"&gt;money&lt;/span&gt;,qs.total_worker_time)/1000000, sql_max_worker_time_s=&lt;span style="color: #ff00ff;"&gt;convert&lt;/span&gt;(&lt;span style="color: #0000ff;"&gt;money&lt;/span&gt;,qs.max_worker_time)/1000000, sql_last_worker_time_s=&lt;span style="color: #ff00ff;"&gt;convert&lt;/span&gt;(&lt;span style="color: #0000ff;"&gt;money&lt;/span&gt;,qs.last_worker_time)/1000000, sql_min_worker_time_s=&lt;span style="color: #ff00ff;"&gt;convert&lt;/span&gt;(&lt;span style="color: #0000ff;"&gt;money&lt;/span&gt;,qs.min_worker_time)/1000000, sql_avg_worker_time_s=(&lt;span style="color: #ff00ff;"&gt;convert&lt;/span&gt;(&lt;span style="color: #0000ff;"&gt;money&lt;/span&gt;,qs.total_worker_time)/qs.execution_count)/1000000, sql_total_elapsed_time_s=&lt;span style="color: #ff00ff;"&gt;convert&lt;/span&gt;(&lt;span style="color: #0000ff;"&gt;money&lt;/span&gt;,qs.total_elapsed_time)/1000000, sql_max_elapsed_time_s=&lt;span style="color: #ff00ff;"&gt;convert&lt;/span&gt;(&lt;span style="color: #0000ff;"&gt;money&lt;/span&gt;,qs.max_elapsed_time)/1000000, sql_last_elapsed_time_s=&lt;span style="color: #ff00ff;"&gt;convert&lt;/span&gt;(&lt;span style="color: #0000ff;"&gt;money&lt;/span&gt;,qs.last_elapsed_time)/1000000, sql_min_elapsed_time_s=&lt;span style="color: #ff00ff;"&gt;convert&lt;/span&gt;(&lt;span style="color: #0000ff;"&gt;money&lt;/span&gt;,qs.min_elapsed_time)/1000000, sql_avg_time_s=(&lt;span style="color: #ff00ff;"&gt;convert&lt;/span&gt;(&lt;span style="color: #0000ff;"&gt;money&lt;/span&gt;,qs.total_elapsed_time)/qs.execution_count)/1000000, &lt;span style="color: #ff00ff;"&gt;SUBSTRING&lt;/span&gt;(ST.text, (QS.statement_start_offset/2) + 1, ((&lt;span style="color: #0000ff;"&gt;CASE&lt;/span&gt; statement_end_offset &lt;span style="color: #0000ff;"&gt;WHEN&lt;/span&gt; -1 &lt;span style="color: #0000ff;"&gt;THEN&lt;/span&gt; DATALENGTH(st.text) &lt;span style="color: #0000ff;"&gt;ELSE&lt;/span&gt; QS.statement_end_offset END - QS.statement_start_offset)/2) + 1) &lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt; statement_text, qp.query_plan &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; sys.dm_exec_query_stats &lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt; QS CROSS APPLY sys.dm_exec_sql_text(QS.sql_handle) &lt;span style="color: #0000ff;"&gt;as&lt;/span&gt; ST CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) &lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt; qp&lt;/p&gt;&#xD;
&lt;p&gt;In the result you can find the queries that is using most CPU time (worker time), elapsed time, IO operations and the execution plan. If you are not used with reading the execution plans.&lt;/p&gt;&#xD;
&lt;p&gt;I'll recommend you to read : &lt;a href="http://www.amazon.com/Server-Performance-Tuning-Distilled-Experts/dp/1430219025/ref=sr_1_1?s=books&amp;amp;ie=UTF8&amp;amp;qid=1326842777&amp;amp;sr=1-1" target="_blank"&gt;SQL Server 2008 Query Performance Tuning Distilled&lt;/a&gt;&amp;nbsp;from &lt;a href="http://www.scarydba.com/about-2-2/" target="_blank"&gt;Grant Fritchey&lt;/a&gt;.&amp;nbsp; Read the next blog post from my collegue for some breaking news about insert performance in SQL Azure. &amp;nbsp; &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-19T15:18:05Z</a10:updated></item><item><guid isPermaLink="false">1d5414fd-47c0-41cb-bc3b-d48731518960</guid><link>http://sqlservice.se/sv/start/blogg/a-sql-azure-tip-a-day-(16)--what-are-you-waiting-for.aspx?lang=sv</link><title>A SQL Azure tip a day (16) - what are you waiting for?</title><description>&lt;p&gt;In SQL server 2008 you have a lot of DMV:s to use to tune your database, but SQL Azure is missing a lot of them, and it makes it a lot harder to tune your queries. One of the DMV:s I like a lot is sys.dm_os_wait_stats, but this DMV doesn't exist in SQL Azure (yet). Today I'll give you a small T-SQL script to show what you are waiting&amp;nbsp;for&amp;nbsp;right now. It is not a real substitute for the sys.dm_os_wait_stats, but you can at least see what you are waiting for right now. &lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; r.wait_type ,r.wait_time ,&lt;span style="color: #ff00ff;"&gt;SUBSTRING&lt;/span&gt;(qt.text,r.statement_start_offset/2,( &lt;span style="color: #0000ff;"&gt;CASE WHEN&lt;/span&gt; r.statement_end_offset = -1 &lt;span style="color: #0000ff;"&gt;THEN &lt;/span&gt;&lt;span style="color: #ff00ff;"&gt;LEN&lt;/span&gt;(&lt;span style="color: #ff00ff;"&gt;CONVERT&lt;/span&gt;(NVARCHAR(MAX), qt.text)) * 2 &lt;span style="color: #0000ff;"&gt;ELSE&lt;/span&gt; r.statement_end_offset &lt;span style="color: #0000ff;"&gt;END&lt;/span&gt; -r.statement_start_offset)/2) &lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt; query_text ,qt.dbid, dbname=DB_&lt;span style="color: #ff00ff;"&gt;NAME&lt;/span&gt;(qt.dbid) ,qt.objectid ,r.sql_handle ,r.plan_handle &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; sys.dm_exec_requests r &lt;span style="color: #0000ff;"&gt;CROSS APPLY&lt;/span&gt; sys.dm_exec_sql_text(r.sql_handle) &lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt; qt &lt;span style="color: #0000ff;"&gt;WHERE&lt;/span&gt; r.session_id &amp;gt; 50 &lt;span style="color: #0000ff;"&gt;AND&lt;/span&gt; WAIT_TYPE&lt;span style="color: #0000ff;"&gt; IS NOT NULL&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;If any query is wating for anything it will be returned and you can see what it's waiting for. The query returned may be a good candidate for tuning, but the root cause can be a completely different query.&lt;/p&gt;</description><a10:updated>2012-07-19T15:16:45Z</a10:updated></item><item><guid isPermaLink="false">6e892e66-dc74-4ed5-a7a0-2156a13fd796</guid><link>http://sqlservice.se/sv/start/blogg/power-options-.aspx?lang=sv</link><title>Power Options ?</title><description>&lt;p&gt;Som ni s&amp;auml;kert k&amp;auml;nner till s&amp;aring; har vi en tj&amp;auml;nst&amp;nbsp;&lt;a href="http://sqlservice.se/tjanster/" target="_blank"&gt; Prestanda analys&lt;/a&gt; som vi s&amp;auml;ljer till fastpris. Bland mycket annat vi kontrollerar n&amp;auml;r vi utf&amp;ouml;r den &amp;auml;r P&lt;strong&gt;ower Options&lt;/strong&gt; p&amp;aring; SQL Servern. Eftersom detta i de flesta fall &amp;auml;r felinst&amp;auml;llt s&amp;aring; skall jag h&amp;auml;r beskriva hur man m&amp;auml;rker det, vilken effekt det kan g&amp;ouml;ra med r&amp;auml;tt inst&amp;auml;llningar och vilken &amp;aring;tg&amp;auml;rd man g&amp;ouml;r f&amp;ouml;r att &amp;auml;ndra detta. Ett enkelt s&amp;auml;tt &amp;auml;r se vilken inst&amp;auml;llning "Power Options" har att anv&amp;auml;nda &lt;a href="http://www.cpuid.com/softwares/cpu-z.html" target="_blank"&gt;CPU-Z&lt;/a&gt;, som &amp;auml;r helt gratis.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/Core_speed.jpg"&gt;&lt;img class="alignnone size-medium wp-image-2825" title="Core_speed" src="../ci.axd?sid=6dc98a40-be2b-49d6-b2f2-1901f4bf646e&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="300" height="284" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Som man kan se av de r&amp;ouml;da markeringarna i exemplet ovan s&amp;aring; ser man att "Core speed" har "rated speed" p&amp;aring; 2,66 GHz medan "actual speed" har ett v&amp;auml;rde p&amp;aring; 1,99 GHz. Av detta kan man anta att &lt;strong&gt;Power Options&lt;/strong&gt; har inst&amp;auml;llningen &lt;strong&gt;Balanced&lt;/strong&gt; som &amp;auml;r &amp;auml;r en standardinst&amp;auml;llning p&amp;aring; Windows Server 2008 och &amp;auml;r den rekommenderade inst&amp;auml;llningen fr&amp;aring;n Microsoft. Unders&amp;ouml;kningar och j&amp;auml;mf&amp;ouml;relser av bl.a. Glen Berry visar dock att det blir en m&amp;auml;rkbar f&amp;ouml;rb&amp;auml;ttring med &lt;strong&gt;High Performance&lt;/strong&gt; ist&amp;auml;llet och i synnerhet f&amp;ouml;r OLTP-system som &amp;auml;r v&amp;auml;ldigt CPU-beroende. Man kan f&amp;aring; en f&amp;ouml;rb&amp;auml;ttring p&amp;aring; 15-22% av CPU prestandan till en kostnad av 6-11 % h&amp;ouml;gre energi&amp;aring;tg&amp;aring;ng med "High Performance" j&amp;auml;mf&amp;ouml;rt med "Balanced". F&amp;ouml;r "Power save" &amp;auml;r skillnaden f&amp;ouml;rst&amp;aring;s &amp;auml;nnu st&amp;ouml;rre. Om man vill ha s&amp;aring; bra prestanda som m&amp;ouml;jligt p&amp;aring; sin SQL Server milj&amp;ouml; skall man alls&amp;aring; alltid &amp;auml;ndra till "High Performance". Detta kan man enkelt &amp;auml;ndra genom att k&amp;ouml;ra "&lt;strong&gt;Powercfg.cpl&lt;/strong&gt;" eller mha kontrollpanelen. &lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/Power-Options.jpg"&gt;&lt;img class="alignnone size-medium wp-image-2826" title="Power Options" src="../ci.axd?sid=6d59eb5b-7c4d-419a-9d20-565cdfad236d&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="300" height="135" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Om man inte m&amp;auml;rker att detta sl&amp;aring;r igenom i &lt;strong&gt;CPU-Z&lt;/strong&gt; som bilden nedan s&amp;aring; m&amp;aring;ste man g&amp;ouml;ra &amp;auml;ndringar i &lt;strong&gt;BIOS&lt;/strong&gt; och&amp;nbsp;&lt;strong&gt;Power Management &lt;/strong&gt;eller likande som inneb&amp;auml;r att detta sker.&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/Core_speed-High-Performance.jpg"&gt;&lt;img class="alignnone size-medium wp-image-2827" title="Core_speed High Performance" src="../ci.axd?sid=54e3224a-03eb-477e-a2ec-46a0c39e0539&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="300" height="101" /&gt;&lt;/a&gt; &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-19T15:16:10Z</a10:updated></item><item><guid isPermaLink="false">62c043b1-7329-4f52-bf1d-26b642a84284</guid><link>http://sqlservice.se/sv/start/blogg/a-sql-azure-tip-a-day-(15)--initial-cost.aspx?lang=sv</link><title>A SQL Azure tip a day (15) - initial cost</title><description>&lt;p&gt;A major benefit of SQL azure is the pricing model, you do not have an initial cost like when you buy your own SQL Server. Imagine you need a SQL server database with 99.9% availability and the cost for that server. You need at least two servers in a cluster, redundant power supply, redundant network/internet access,&amp;nbsp;two storage arrays in the SAN with synchronous&amp;nbsp;replication and they have to be located at different locations. That sounds cheap doesn't it? No? You are right! Also imagine that you need to handle heavy load once or twice a month, or why not once a year. You need to buy a server with enough resources to handle the peak load and if the peak is only once a year. What a waste of resources!&lt;/p&gt;&#xD;
&lt;p&gt;Well, you can always consolidate your database with other databases, but do you get enough resources when you really need them? It is not unusual that your database servers will cost $200 000 with SQL server licenses and&amp;nbsp;SAN excluded. Well the SAN can be shared for all servers in your network, or can you? Yes you can, but do you get the performance you need? Your SAN technichians will ask you how many GB you need and not the number of IOPS you need, and that is two completely different things. On top of that you need a backup solution to handle your backups, or do you trust the SAN? Well, don't do it! I have seen two major outsourcing companies in Sweden relying on the SAN and it was an expensive experience for them, loosing a lot of money and reputation. To small companies or startups this can be heavy cost and big risk and to avoid this investment you can move in to SQL Azure, with no initial cost at all!&lt;/p&gt;&#xD;
&lt;p&gt;You only pay a monthly fee for what you really use. You can start with a small database and pay a small fee and grow as you need.&lt;/p&gt;&#xD;
&lt;p&gt;That is what I like with SQL Azure.&lt;/p&gt;</description><a10:updated>2012-07-19T15:14:20Z</a10:updated></item><item><guid isPermaLink="false">c4bfc149-1161-402f-b9c4-0ed82b5eebb2</guid><link>http://sqlservice.se/sv/start/blogg/a-sql-azure-tip-a-day-(14)--migration.aspx?lang=sv</link><title>A SQL Azure tip a day (14) - Migration</title><description>&lt;p&gt;If you plan to migrate a database to SQL Azure, you can find a tool at Codeplex to help you with the migration, &lt;a href="http://sqlazuremw.codeplex.com/"&gt;SQL Azure Migration Wizard&lt;/a&gt;. There are some questions that has to be answered before you migrate a database to SQL Azure:&lt;/p&gt;&#xD;
&lt;p&gt;- Is your database compatible with SQL Azure?&lt;br /&gt;- Does your database fit in the SQL Azure platform?&lt;br /&gt;- Is your application suitable for Azure?&lt;br /&gt;- Is your database designed to perform well?&lt;br /&gt;- How should you handle the maintenance in SQL Azure?&lt;br /&gt;- How are you going to test your application in the cloud to make sure it works?&lt;br /&gt;- Should you migrate or design a new database?&lt;/p&gt;&#xD;
&lt;p&gt;If you can answer these questions, you can continue with the migration plans. And yes the questions may simple to answer, but if you have read my other blog posts about SQL Azure, you know that there are some things that you need to make sure you can handle, like:&lt;/p&gt;&#xD;
&lt;p&gt;- Max Database size&lt;br /&gt;- Index fragmentation&lt;br /&gt;- Connection termination due to heavy resource usage&lt;br /&gt;- Etc.&lt;/p&gt;&#xD;
&lt;p&gt;Well, I would prefer to design a new database before trying to migrate a database to make sure the database is performing well. If you decide to continue with your migration, I'll guide you through the migration wizard.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;1. Select Process&lt;/strong&gt; In the first step you need to select what you want to do, in my case I want to Analyze and migrate a SQL database to make sure my database is compatible with SQL Azure. Select the option and click next.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/SQLMigration1.png"&gt;&lt;img class="alignnone size-full wp-image-2806" title="SQLMigration1" src="../ci.axd?sid=38ab2390-6d23-4923-8228-83badff239c5&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="601" height="668" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;2. Connect&lt;/strong&gt; If you chose the "Analzye and Migrate" SQL Database, you need to connect to your server. Enter the name of your server, your login credentials and select master db or specify databasename.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/SQLMigration2.png"&gt;&lt;img class="alignnone size-full wp-image-2807" title="SQLMigration2" src="../ci.axd?sid=184c685c-d364-402d-a8a0-b6a7e293f109&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="350" height="428" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;3. Select Source&lt;/strong&gt; If you selected the master db, you get a list of databases to choose from as source. Klick the desired database and click next.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/SQLMigration3.png"&gt;&lt;img class="alignnone size-full wp-image-2808" title="SQLMigration3" src="../ci.axd?sid=955ccba0-9767-4d3b-a99b-66895ef27fcf&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="601" height="668" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;4. Choose objects&lt;/strong&gt; Next you need to choose the objects you want to migrate and in my case I choose to migrate "all objects" amd click next.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/SQLMigration4.png"&gt;&lt;img class="alignnone size-full wp-image-2809" title="SQLMigration4" src="../ci.axd?sid=65888970-dba2-4b7c-8fa0-812b67d9b375&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="601" height="668" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;5. Script Wizard Summary&lt;/strong&gt; In the next step you get a script summary and you get some early warnings if there are some objects that can't be migrated. In my case I have some encrypted procedures that can't be migrated, but that was expected. Click next to continue or exit to abort the process and fix any problems.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/SQLMigration5.png"&gt;&lt;img class="alignnone size-full wp-image-2810" title="SQLMigration5" src="../ci.axd?sid=cd7e1a35-ffcf-4e3b-9418-f774036ac73e&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="601" height="668" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;6. Result Summary&lt;/strong&gt; If you clicked next, you can follow the process and see if there are some compatibility issues.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/SQLMigration6.png"&gt;&lt;img class="alignnone size-full wp-image-2811" title="SQLMigration6" src="../ci.axd?sid=b297e24e-716e-4800-9bbf-0ad99852c08c&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="601" height="668" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;7. Result Summary&lt;/strong&gt; You can also see the script that is created for your migration by clicking the "SQL scripts" tab.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/SQLMigration7.png"&gt;&lt;img class="alignnone size-full wp-image-2812" title="SQLMigration7" src="../ci.axd?sid=1f844cdb-9230-4934-b89a-63f10cbc76b9&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="601" height="668" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;8. Connect to Azure&lt;/strong&gt; Once the script is created you need to connect to your SQL Azure database, enter your server name, login credentials and specify the datebase and click next.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/SQLMigration8.png"&gt;&lt;img class="alignnone size-full wp-image-2813" title="SQLMigration8" src="../ci.axd?sid=dcc480d3-70bd-4f4c-97fd-da0610ec108c&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="350" height="428" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;9. Select Target&lt;/strong&gt; In my case I selected the "Master DB" to get a list of all databases in my server and then I selected the database and clicked next to finish my migration. The wizard show you a confirmation dialog and if you want to continue you click the Yes button.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/SQLMigration9.png"&gt;&lt;img class="alignnone size-full wp-image-2814" title="SQLMigration9" src="../ci.axd?sid=0aa964fe-f286-4172-8b2a-defdc6b84ac5&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="601" height="668" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;If everything worked fine it's now time to populate the database with data, point your application to the SQL Azure database and test your solution.&lt;/p&gt;</description><a10:updated>2012-07-19T15:13:14Z</a10:updated></item><item><guid isPermaLink="false">fbda6f35-94fb-4bf7-83e4-a8e37041a579</guid><link>http://sqlservice.se/sv/start/blogg/a-sql-azure-tip-a-day-(13)--releases.aspx?lang=sv</link><title>A SQL Azure tip a day (13) - Releases</title><description>&lt;p&gt;The release cycle of SQL Azure is 4 times a year, and new functionality is added in every release. Some features from SQL server 2008 are still not implemented in SQL Azure, but some features are already released in SQL Azure and they will get released in SQL server 2012. Some of the new functions that&amp;nbsp;are added in SQL Azure in the September 2011 release are not even documented anymore, like&amp;nbsp;EOMONTH(), IIF(), TRY_PARSE(), etc. was added in the "What's new" section, but since the December release they are not documented. These features are added to SQL Server 2012 and you can read about them in books online or at: &lt;a href="http://msdn.microsoft.com/en-us/library/cc645577(v=SQL.110).aspx"&gt;http://msdn.microsoft.com/en-us/library/cc645577(v=SQL.110).aspx&lt;/a&gt; I have added example of some of the new functions for you to try, and the rest of them I leave for you to try on your own. &lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #ff00ff;"&gt;IIF&lt;/span&gt;(&lt;span style="color: #ff00ff;"&gt;DATEPART&lt;/span&gt;(hh,&lt;span style="color: #ff00ff;"&gt;GETDATE&lt;/span&gt;())&amp;gt;12,'AM','PM'); &lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #ff00ff;"&gt;EOMONTH&lt;/span&gt;(&lt;span style="color: #ff00ff;"&gt;GETDATE&lt;/span&gt;()) &lt;span style="color: #0000ff;"&gt;DECLARE&lt;/span&gt; @i &lt;span style="color: #0000ff;"&gt;CHAR&lt;/span&gt;(3)='A' &lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #ff00ff;"&gt;TRY_PARSE&lt;/span&gt;( @i as int) &lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #ff00ff;"&gt;CHOOSE&lt;/span&gt;(3, 'a','b','c','d') &lt;span style="color: #0000ff;"&gt;BEGIN TRY&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;THROW&lt;/span&gt; 51000, 'The record does not exist.', 1; &lt;span style="color: #0000ff;"&gt;END TRY&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;BEGIN CATCH&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;PRINT&lt;/span&gt; &lt;span style="color: #ff00ff;"&gt;ERROR_MESSAGE&lt;/span&gt;(); &lt;span style="color: #0000ff;"&gt;END CATCH&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Stay tuned for more blog posts about SQL Azure, or contact any of our SQL server consultants if you want more information.&lt;/p&gt;</description><a10:updated>2012-07-19T15:05:11Z</a10:updated></item><item><guid isPermaLink="false">f37aa573-414c-48ff-8405-980cf494686a</guid><link>http://sqlservice.se/sv/start/blogg/a-sql-azure-tip-a-day-(12)--kill.aspx?lang=sv</link><title>A SQL Azure tip a day (12) - KILL</title><description>&lt;p&gt;If you have been working with any other SQL server edition before you most likely used the KILL statement to kill a slow running process or a process that are blocking other transactions. In SQL Azure there is no KILL statement and you can't kill the blocking connection, but on the other hand, SQL Azure will kill the processes that have been running for more than 5 minutes or is using to much resources.&lt;/p&gt;&#xD;
&lt;p&gt;I guess it's okey that it's handled by the platform, but in a high perfomance OLTP system 5 minutes is a long time to wait for a connection that is blocking lots of other processes. To avoid that problem you should make sure you optimize your code, split large data modifications in to smaller blocks and commit your transactions as soon as possible to avoid blockings in the first place. I guess you already heard that recommendation for&amp;nbsp;T-SQL&amp;nbsp;before, and as you can see, it's even more important in SQL Azure. Follow the guidelines described in &lt;a href="http://windowsazurecat.com/2010/10/best-practices-for-handling-transient-conditions-in-sql-azure-client-applications/"&gt;http://windowsazurecat.com/2010/10/best-practices-for-handling-transient-conditions-in-sql-azure-client-applications/&lt;/a&gt; to handle connections that may be terminated.&lt;/p&gt;&#xD;
&lt;p&gt;If you want to know whats currently executing in your SQL Azure database you can use a script like this one:&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: #0000ff;"&gt;SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; s.session_id, s.login_name, s.last_request_start_time, s.last_request_end_time, s.open_transaction_count, s.prev_error, r.start_time, r.status, &lt;span style="color: #ff00ff;"&gt;COALESCE(object_name&lt;/span&gt;(st.objectid),'AdHoc'), st.text, r.cpu_time, r.reads, r.writes, r.logical_reads, r.granted_query_memory, r.row_count, r.wait_type, r.wait_time, r.last_wait_type, r.blocking_session_id, r.open_transaction_count, qt.query_plan &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; sys.dm_exec_sessions s &lt;span style="color: #0000ff;"&gt;INNER JOIN&lt;/span&gt; sys.dm_exec_requests r &lt;span style="color: #0000ff;"&gt;ON&lt;/span&gt; s.session_id = r.session_id &lt;span style="color: #0000ff;"&gt;LEFT JOIN&lt;/span&gt; sys.dm_tran_session_transactions t &lt;span style="color: #0000ff;"&gt;ON&lt;/span&gt; s.session_id=t.session_id &lt;span style="color: #0000ff;"&gt;CROSS APPLY&lt;/span&gt; sys.dm_exec_sql_text(r.sql_handle) st &lt;span style="color: #0000ff;"&gt;CROSS APPLY&lt;/span&gt; sys.dm_exec_query_plan(r.plan_handle) qt &lt;span style="color: #0000ff;"&gt;WHERE&lt;/span&gt; s.is_user_process=1&lt;/p&gt;&#xD;
&lt;p&gt;This will give you some execution statistics, the code that is executing,&amp;nbsp;the query plan and some wait stats. &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-19T15:04:14Z</a10:updated></item><item><guid isPermaLink="false">e5d7b411-9a68-4cd1-a164-862be880237f</guid><link>http://sqlservice.se/sv/start/blogg/a-sql-azure-tip-a-day-(11)--the-credit-card-constraint.aspx?lang=sv</link><title>A SQL Azure tip a day (11) - The credit card constraint</title><description>&lt;p&gt;This is the 11:th day I blog about SQL Azure, and it's the 11:th day I open more addresses on the Firewall, because of my mobile internet.&lt;/p&gt;&#xD;
&lt;p&gt;Iguess the database soon will open to anyone in the whole world!&amp;nbsp;I can't wait until I get my fibre network! Once you sign up for the SQL Azure subscription, your credit card&amp;nbsp;get charged for what you use. The charge will depend of number of databases, edition, size and outbound data transfer. If you want to keep track of the SQL Azure cost, there are two DMV:s you can use, sys.bandwidth_usage and sys.database_usage.&lt;/p&gt;&#xD;
&lt;p&gt;Since the service release in December there is a cost limit of $499.50 for every database larger than 40Gb, and you can use a script like this to keep track of your usage cost: &lt;span style="color: #0000ff;"&gt;DECLARE&lt;/span&gt; @priceWeb &lt;span style="color: #0000ff;"&gt;DECIMAL&lt;/span&gt;(4,2)=9.99; &lt;span style="color: #0000ff;"&gt;DECLARE&lt;/span&gt; @priceBusiness &lt;span style="color: #0000ff;"&gt;DECIMAL&lt;/span&gt;(4,2)=99.99; &lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; SKU, SUM(&lt;span style="color: #0000ff;"&gt;CASE&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;WHEN&lt;/span&gt; U.SKU = 'Web' &lt;span style="color: #0000ff;"&gt;THEN&lt;/span&gt; (Quantity * @priceWeb/&lt;span style="color: #ff00ff;"&gt;DAY&lt;/span&gt;(&lt;span style="color: #ff00ff;"&gt;EOMONTH&lt;/span&gt;(U.TIME))) &lt;span style="color: #0000ff;"&gt;WHEN&lt;/span&gt; U.SKU = 'Business' &lt;span style="color: #0000ff;"&gt;THEN&lt;/span&gt; (&lt;span style="color: #0000ff;"&gt;CASE WHEN&lt;/span&gt; Quantity&amp;gt;40 &lt;span style="color: #0000ff;"&gt;THEN&lt;/span&gt; 40 &lt;span style="color: #0000ff;"&gt;ELSE &amp;nbsp;&lt;/span&gt;Quantity &lt;span style="color: #0000ff;"&gt;END&lt;/span&gt; * @priceBusiness/&lt;span style="color: #ff00ff;"&gt;DAY&lt;/span&gt;(&lt;span style="color: #ff00ff;"&gt;EOMONTH&lt;/span&gt;(U.TIME))) &lt;span style="color: #0000ff;"&gt;END&lt;/span&gt; ) &lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt; [TotalCost] &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; sys.Database_Usage &lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt; u &lt;span style="color: #0000ff;"&gt;WHERE&lt;/span&gt; u.TIME &amp;gt;=&lt;span style="color: #ff00ff;"&gt;DATEADD&lt;/span&gt;(D,0-&lt;span style="color: #ff00ff;"&gt;DAY&lt;/span&gt;(&lt;span style="color: #ff00ff;"&gt;GetUTCDate&lt;/span&gt;()),&lt;span style="color: #ff00ff;"&gt;GetUTCDate&lt;/span&gt;()) &lt;span style="color: #0000ff;"&gt;AND&lt;/span&gt; u.TIME &amp;lt;=&lt;span style="color: #ff00ff;"&gt;EOMONTH&lt;/span&gt;(&lt;span style="color: #ff00ff;"&gt;GetUTCDate&lt;/span&gt;()) &lt;span style="color: #0000ff;"&gt;GROUP BY&lt;/span&gt; SKU; To get the cost for the data transfer you can use the following script: &lt;span style="color: #0000ff;"&gt;DECLARE&lt;/span&gt; @cost_per_mb &lt;span style="color: #0000ff;"&gt;DECIMAL&lt;/span&gt; (3,2)=0.15 &lt;span style="color: #0000ff;"&gt;DECLARE&lt;/span&gt; @mb &lt;span style="color: #0000ff;"&gt;INT&lt;/span&gt; = 1024*1024; &lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; u.Time_Period, u.Direction, @cost_per_mb * u.BandwidthInKB/@mb &lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt; [TotalTransferCost] &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; ( SELECT Time_Period, Direction, &lt;span style="color: #ff00ff;"&gt;SUM&lt;/span&gt;(Quantity) &lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt; [BandwidthInKB] &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; sys.Bandwidth_Usage u &lt;span style="color: #0000ff;"&gt;WHERE&lt;/span&gt; u.TIME &amp;gt;=&lt;span style="color: #ff00ff;"&gt;DATEADD&lt;/span&gt;(D,0-&lt;span style="color: #ff00ff;"&gt;DAY&lt;/span&gt;(&lt;span style="color: #ff00ff;"&gt;GetUTCDate&lt;/span&gt;()),&lt;span style="color: #ff00ff;"&gt;GetUTCDate&lt;/span&gt;()) &lt;span style="color: #0000ff;"&gt;AND&lt;/span&gt; u.TIME &amp;lt;=&lt;span style="color: #ff00ff;"&gt;EOMONTH&lt;/span&gt;(&lt;span style="color: #ff00ff;"&gt;GetUTCDate&lt;/span&gt;()) &lt;span style="color: #0000ff;"&gt;AND&lt;/span&gt; class = 'External' &lt;span style="color: #0000ff;"&gt;AND&lt;/span&gt; u.Direction = 'Egress' &lt;span style="color: #0000ff;"&gt;GROUP&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;BY&lt;/span&gt; Time_Period, Direction) &lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt; u;&lt;/p&gt;&#xD;
&lt;p&gt;Well, as you already know, you pay for the size of your database, and you pay for the data transfer. To be cost efficient, you really need to design your database correct to avoid redundant data and you need to stop using SELECT *, or including more columns than you need. Otherwise you'll pay for an overhead that you actually can avoid. This is not a new recommendation, it has been there since the early year of relational databases, but the majority of all developers have ignored it since hardware got cheap. If your business is using a price model that is usage based&amp;nbsp;you&amp;nbsp;would gain a lot from&amp;nbsp;using SQL&amp;nbsp;Azure that is matching your pricing model. &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-19T14:59:01Z</a10:updated></item><item><guid isPermaLink="false">e07c3e7d-f327-4cbb-bf13-6577a9063ad8</guid><link>http://sqlservice.se/sv/start/blogg/buggfixar-.aspx?lang=sv</link><title>Buggfixar ? </title><description>&lt;p&gt;Som vi skrivit tidigare, s&amp;aring; b&amp;aring;de hittar man och fixar buggar och andra f&amp;ouml;rb&amp;auml;ttringar stadigt av SQL Server. Ibland &amp;auml;r det st&amp;ouml;rande saker som &amp;aring;tg&amp;auml;rdas t.ex. att den grafiska exekveringsplanen inte alltid visas n&amp;auml;r man k&amp;ouml;rt en fr&amp;aring;ga som returnerar en l&amp;auml;nk f&amp;ouml;r exekveringsplanen. Detta har man kunnat komma runt genom att spara informationen i en fil, med &amp;auml;ndelsen sqlplan och d&amp;auml;refter &amp;ouml;ppnat den. En st&amp;ouml;rande och on&amp;ouml;digt moment som nu &amp;auml;r fixat bland de senaste f&amp;ouml;rb&amp;auml;ttringarna :-).&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/2633146" target="_blank"&gt;SQL Server 2008 R2 Service Pack 1 Cumulative Update 4&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Som vanligt g&amp;auml;ller det att alltid testa innan man g&amp;ouml;r f&amp;ouml;r&amp;auml;ndringar i produktionsmilj&amp;ouml;n.&lt;/p&gt;</description><a10:updated>2012-07-19T14:53:27Z</a10:updated></item><item><guid isPermaLink="false">8de15c17-9923-4377-8522-0611e3189d1e</guid><link>http://sqlservice.se/sv/start/blogg/a-sql-azure-tip-a-day-(10)--synchronize-database.aspx?lang=sv</link><title>A SQL Azure tip a day (10) - Synchronize database</title><description>&lt;p&gt;SQL Azure Data Sync (currently a CTP) is like replication in the cloud. It is easy to install and configure and you can use it to synchronize databases between a SQL server 2012 and SQL Azure, or between two SQL Azure databases. By using SQL Azure Data Sync, you can have an internal database application and publish some of your data to a cloud based application for external use or vice verse. Before you configure SQL Azure Data Sync, you need to create a user with permission to "logon as a service". It will be used by the local Data Sync agent. In this blog post, I will try to guide you through the setup and configuration.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;1. Provision the Data Sync&lt;/strong&gt; First of all you need to provision the Data Sync, by clicking the Provision Data Sync button, select your subscription and click next.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2011/11/selectSubscription.png"&gt;&lt;img class="alignnone size-full wp-image-2742" title="selectSubscription" src="../ci.axd?sid=3a4e4dd6-4df8-4cc5-8b03-b33b197f9676&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="466" height="272" /&gt;&lt;/a&gt;S&lt;/p&gt;&#xD;
&lt;p&gt;Select a region and click finish.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/region.png"&gt;&lt;img class="alignnone size-full wp-image-2767" title="region" src="../ci.axd?sid=09269c4e-4bb4-4ca5-b109-91af161bb88c&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="463" height="272" /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;2. Create a&amp;nbsp;Sync group&lt;/strong&gt; Enter a name for your Sync group and press Enter to get to the next step. &lt;a href="http://sqlservice.se/wp-content/uploads/2011/11/CreateSyncGroup.png"&gt;&lt;img class="alignnone size-full wp-image-2741" title="CreateSyncGroup" src="../ci.axd?sid=94ab3981-9a29-4857-8077-9dbbedcb5876&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="718" height="119" /&gt;&lt;/a&gt; &lt;strong&gt;3.&amp;nbsp;Add a SQL server database to the sync group&lt;/strong&gt; The second step is to add the SQL server database by click on the + sign in this dialog.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;a href="http://sqlservice.se/wp-content/uploads/2011/11/AddSQLDBtoSyncGroup2.png"&gt;&lt;img class="alignnone size-full wp-image-2746" title="AddSQLDBtoSyncGroup2" src="../ci.axd?sid=7b0ebf33-8c96-40b9-a4df-526b9539393a&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="413" height="151" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Next you need to add the database by selecting an existing sync member database or add a new database, and decide if it should be Bi directional, sync from the hub or sync to the hub. The SQL azure database is used as a hub.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2011/11/AddSQLDBtoSyncGroup.png"&gt;&lt;img class="alignnone size-full wp-image-2745" title="AddSQLDBtoSyncGroup" src="../ci.axd?sid=ccc5b5dd-7151-4316-b6bf-847f2391ee23&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="494" height="372" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;4. Add New SQL Server database&lt;/strong&gt; If you choose to add a new database you need to select an existing Client Sync Agent or install a new one. In this blog post, I'll assume you don't have a Client Sync Agent installed and&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/InstallAgent.png"&gt;&lt;img class="alignnone size-full wp-image-2757" title="InstallAgent" src="../ci.axd?sid=545b7e91-639f-4d50-9159-1a710b9310d4&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="552" height="464" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;5. Install the agent.&lt;/strong&gt;If you need to install a new agent, you need to:&lt;br /&gt;- Download and install&amp;nbsp;the agent&lt;br /&gt;- Specify a name for your agent&lt;br /&gt;- Generate and copy an agent key that you will use to register your local agent.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqlservice.se/wp-content/uploads/2011/11/downloadsyncagent.png"&gt;&lt;img class="alignnone size-full wp-image-2743" title="downloadsyncagent" src="../ci.axd?sid=126aed30-d682-4a64-85b7-07472dcfd662&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="551" height="524" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Before you click next, you should open your local Client Sync agent and register it with the key you copied. In the Client Sync Agent you click the Submit Agent Key, paste your copied key in the text box and click OK. Click the Register button and enter your servername, databasename and your login credentials. &lt;a href="http://sqlservice.se/wp-content/uploads/2011/11/registerSQLdb.png"&gt;&lt;img class="alignnone size-full wp-image-2744" title="registerSQLdb" src="../ci.axd?sid=bebf95e9-55d8-468f-82d1-54bd263a0906&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="641" height="502" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Close the Client Sync Agent and switch back to the management portal, click next in the "Add Database to Sync Group" dialog.&amp;nbsp;As you already done with Step 1, you can move on to&amp;nbsp;Step 2 and&amp;nbsp;click the&amp;nbsp;Get Database List, select your database in Step&amp;nbsp;3 and click finish.&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/downloadsyncagent2.png"&gt;&lt;img class="alignnone size-full wp-image-2759" title="downloadsyncagent2" src="../ci.axd?sid=693d80e2-13ff-45ba-aeb9-f3ebd688fe4e&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="544" height="543" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;6. Add the SQL Azure database&lt;/strong&gt; Now your SQL Server database is registered in the sync group and it's time to add the SQL Azure database. Enter or select the server and databasename, enter a valid SQL Azure login and password and click Add. &lt;a href="http://sqlservice.se/wp-content/uploads/2011/11/addAzureDBtoSyncgroup.png"&gt;&lt;img class="alignnone size-full wp-image-2747" title="addAzureDBtoSyncgroup" src="../ci.axd?sid=09a4dac4-1b61-438b-9550-9d9d4b1c8f4c&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="493" height="442" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;7. Configure the sync group&lt;/strong&gt; Next step is to set the Sync Schedule and the conflict resolution. Enter a Sync Schedule between 5 minutes and 1 Month and decide who the winner in a&amp;nbsp;conflict should be. &lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/configuration.png"&gt;&lt;img class="alignnone size-full wp-image-2761" title="configuration" src="../ci.axd?sid=d8b5f1b2-fbb1-453e-bbbe-f2b18ffe454d&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="374" height="228" /&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;8. Select the data to be synchronized&lt;/strong&gt; In the last dialog you can choose the tables and the columns to use in your data sync, and for every table, you can add a row filter to get only the data that meets your criteria.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;9. Deploy the Data Sync&lt;/strong&gt; Now you are almost done, just click the Deploy button at the top of the SQL Azure Management Portal, and once the Data Sync is deployed it should look like something like this. &lt;a href="http://sqlservice.se/wp-content/uploads/2012/01/done.png"&gt;&lt;img class="alignnone size-full wp-image-2765" title="done" src="../ci.axd?sid=487c90b1-f099-45f4-bdc3-0e059b4170ac&amp;amp;w=0&amp;amp;h=0&amp;amp;ext=jpg" alt="" width="1092" height="498" /&gt;&lt;/a&gt; Once you have configured this, you can add more databases to the sync group. &amp;nbsp; &amp;nbsp;&lt;/p&gt;</description><a10:updated>2012-07-19T14:52:11Z</a10:updated></item><item><guid isPermaLink="false">7e610a88-7bfa-4db2-a42e-c3ef2fc5b1d7</guid><link>http://sqlservice.se/sv/start/blogg/tracking-sql-server-lock-overflow-in-dynamics-ax-batches.aspx?lang=sv</link><title>Tracking SQL Server lock overflow in Dynamics AX Batches</title><description>&lt;p&gt;When looking at a &lt;a href="http://www.microsoft.com/sql"&gt;SQL Server 2008 R2&lt;/a&gt; locking/blocking problem in an Dynamics AX 2009 installation, I wanted to see what was going on with regards to locks taken by the specific SPID allocated to the AX Batch. I created a very simple script, that could also be useful in other situations. In this case it could be concluded that the cursor based batch seemed to lock row by row in a particular table, until all rows where locked and the batch completed. Needless to say, this caused problems for other processes during that time. The script tells you the number of locks for a specified SPID, repeated x number of times, with a 5 seconds interval.&lt;/p&gt;&#xD;
&lt;p&gt;Enjoy! &amp;nbsp; declare&amp;nbsp;&lt;span style="font-size: x-small;"&gt;@locks &lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;varchar&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;100&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;)&lt;/span&gt;&lt;/span&gt; declare&amp;nbsp;&lt;span style="font-size: x-small;"&gt;@msg &lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;varchar&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;100&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;)&lt;/span&gt;&lt;/span&gt; declare&amp;nbsp;&lt;span style="font-size: x-small;"&gt;@revs &lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;int&lt;/span&gt;&lt;/span&gt; declare&amp;nbsp;&lt;span style="font-size: x-small;"&gt;@i &lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;int&lt;/span&gt;&lt;/span&gt; declare&amp;nbsp;&lt;span style="font-size: x-small;"&gt;@spid &lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;int&lt;/span&gt;&lt;/span&gt; select&amp;nbsp;&lt;span style="font-size: x-small;"&gt;@revs &lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; 10&lt;/span&gt; select&amp;nbsp;&lt;span style="font-size: x-small;"&gt;@i &lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; 1&lt;/span&gt; select&amp;nbsp;&lt;span style="font-size: x-small;"&gt;@spid &lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; 107&lt;/span&gt; &amp;nbsp; while&amp;nbsp;&lt;span style="font-size: x-small;"&gt;@i &lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&amp;lt;=&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; @revs&lt;/span&gt; begin select&amp;nbsp;&lt;span style="font-size: x-small;"&gt;@locks &lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff00ff; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-size: x-small;"&gt;count&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;(*)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;from &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008000; font-size: x-small;"&gt;&lt;span style="color: #008000; font-size: x-small;"&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008000; font-size: x-small;"&gt;&lt;span style="color: #008000; font-size: x-small;"&gt;dm_tran_locks &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;where&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; request_session_id &lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; @spid&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;;&lt;/span&gt;&lt;/span&gt; select &lt;span style="font-size: x-small;"&gt;@msg &lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff00ff; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-size: x-small;"&gt;cast&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-size: x-small;"&gt;'Number of locks for SPID '&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;as &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;varchar&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;100&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;)) &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;+ &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff00ff; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-size: x-small;"&gt;convert&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;varchar&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;10&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;),&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;@spid&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;) &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;+ &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-size: x-small;"&gt;' = '&lt;/span&gt;&lt;/span&gt; select&amp;nbsp;&lt;span style="font-size: x-small;"&gt;@msg &lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff00ff; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-size: x-small;"&gt;cast&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;@msg &lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;as &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;varchar&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;100&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;) &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;+ &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff00ff; font-size: x-small;"&gt;&lt;span style="color: #ff00ff; font-size: x-small;"&gt;convert&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;varchar&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;10&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;),&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;@locks &lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;)&lt;/span&gt;&lt;/span&gt; select&amp;nbsp;&lt;span style="font-size: x-small;"&gt;@msg&lt;/span&gt; RAISERROR&amp;nbsp;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;(&lt;/span&gt;&lt;/span&gt; &lt;span style="font-size: x-small;"&gt;@msg&lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt; 1&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;,&lt;/span&gt;&lt;/span&gt; 1&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;with &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;NOWAIT&lt;/span&gt;&lt;/span&gt; waitfor&amp;nbsp;&lt;span style="color: #0000ff; font-size: x-small;"&gt;&lt;span style="color: #0000ff; font-size: x-small;"&gt;delay &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #ff0000; font-size: x-small;"&gt;&lt;span style="color: #ff0000; font-size: x-small;"&gt;'00:00:5'&lt;/span&gt;&lt;/span&gt; select&amp;nbsp;&lt;span style="font-size: x-small;"&gt;@i &lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; @i &lt;/span&gt;&lt;span style="color: #808080; font-size: x-small;"&gt;&lt;span style="color: #808080; font-size: x-