<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Tibor Karaszi : Tools</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Tools/default.aspx</link><description>Tags: Tools</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Express Edition revisited, focus on SSMS</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2013/01/30/express-edition-revisited-focus-on-ssms.aspx</link><pubDate>Wed, 30 Jan 2013 17:01:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:47398</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>3</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/47398.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=47398</wfw:commentRss><description>(Note: I have re-written parts of this post in the light of the comments that SP1 of 2012 include Complete tools.) I have decided to revisit the topic of whats included in Express Edition, with focus on the tools. I have a couple of reasons for this:...(&lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2013/01/30/express-edition-revisited-focus-on-ssms.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=47398" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Tools/default.aspx">Tools</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Trace/default.aspx">Trace</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/SQL+Server+Agent/default.aspx">SQL Server Agent</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Express+Edition/default.aspx">Express Edition</category></item><item><title>Backup and the evil RETAINDAYS option</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2012/07/08/backup-and-the-evil-retaindays-option.aspx</link><pubDate>Sun, 08 Jul 2012 12:25:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:44226</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>4</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/44226.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=44226</wfw:commentRss><description>"So what bad has this option done?", you probably as yourself. Well, not much, but I find it evil because it confuses people, especially those new to SQL Server. I have many times seen people specifying something like 3, and expect SQL Server to keep...(&lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2012/07/08/backup-and-the-evil-retaindays-option.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=44226" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Tools/default.aspx">Tools</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Backup/default.aspx">Backup</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Maintenance/default.aspx">Maintenance</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/datetime/default.aspx">datetime</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/SQL+Server+Agent/default.aspx">SQL Server Agent</category></item><item><title>Analyzing the errorlog</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2012/07/05/analyzing-the-errorlog.aspx</link><pubDate>Thu, 05 Jul 2012 11:53:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:44203</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>0</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/44203.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=44203</wfw:commentRss><description>How often do you do this? Look over each message (type) in the errorlog file and determine whether this is something you want to act on. Sure, some (but not all) of you have some monitoring solution in place, but are you 100% confident that it really...(&lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2012/07/05/analyzing-the-errorlog.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=44203" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Tools/default.aspx">Tools</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Maintenance/default.aspx">Maintenance</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Installation/default.aspx">Installation</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Troubleshooting/default.aspx">Troubleshooting</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/SQL+Server+Agent/default.aspx">SQL Server Agent</category></item><item><title>SQL Live Monitor</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2011/11/19/sql-live-monitor.aspx</link><pubDate>Sat, 19 Nov 2011 08:46:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:39884</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>1</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/39884.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=39884</wfw:commentRss><description>I just found this one out there and wanted to share it. It connects to an instance and show you a bunch of figures. Nothing you can't extract yourself with SQL queries, but sometimes it is just nice to have one tool which is very easy to use. Here's what...(&lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2011/11/19/sql-live-monitor.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=39884" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Tools/default.aspx">Tools</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Performance/default.aspx">Performance</category></item><item><title>Ola Hallengren's maint procedures now supports logging to table</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2011/07/16/ola-hallengren-s-maint-procedures-now-supports-logging-to-table.aspx</link><pubDate>Sat, 16 Jul 2011 01:19:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:36985</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>1</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/36985.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=36985</wfw:commentRss><description>This can for instance be very useful if you want to keep track how long time things take, over time. Check them out here .Version history here ....(&lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2011/07/16/ola-hallengren-s-maint-procedures-now-supports-logging-to-table.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=36985" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Tools/default.aspx">Tools</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Maintenance/default.aspx">Maintenance</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/SQL+Server+Agent/default.aspx">SQL Server Agent</category></item><item><title>Another bugfix for sp_indexinfo</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2010/11/09/another-bugfix-for-sp-indexinfo.aspx</link><pubDate>Tue, 09 Nov 2010 08:26:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:30289</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>0</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/30289.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=30289</wfw:commentRss><description>JackMcC reported correctly at http://sqlblog.com/blogs/tibor_karaszi/archive/2009/02/18/sp-indexinfo-updated.aspx that sp_indexinfo will count rows double (or even tripple) if there are lob or row overflow allocations. Now fixed. Thanks Jack....(&lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2010/11/09/another-bugfix-for-sp-indexinfo.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=30289" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Tools/default.aspx">Tools</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/indexes/default.aspx">indexes</category></item><item><title>New util proc: sp_tableinfo</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2010/10/10/new-util-proc-sp-tableinfo.aspx</link><pubDate>Sun, 10 Oct 2010 11:59:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:29279</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>2</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/29279.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=29279</wfw:commentRss><description>Some of you might use my sp_indexinfo to easily get lots of details about the indexes in a database. I added an sp_tableinfo with info rolled up to table level. This allow to quickly see the largest tables in a database and things like that. Check it...(&lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2010/10/10/new-util-proc-sp-tableinfo.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=29279" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Tools/default.aspx">Tools</category></item><item><title>Util procedure to show database size</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2009/12/29/util-procedure-to-show-database-size.aspx</link><pubDate>Tue, 29 Dec 2009 12:17:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:20305</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>6</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/20305.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=20305</wfw:commentRss><description>One of the first things I want to do when I look at a new SQL Server is to get an idea of space usage details for each database, including total space usage. For this I have been using my own sp_db_space_usage for a while now, so I decided to add it to...(&lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2009/12/29/util-procedure-to-show-database-size.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=20305" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Tools/default.aspx">Tools</category></item><item><title>Spooky: What do you connect to?</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2009/06/26/spooky-what-do-you-connect-to.aspx</link><pubDate>Fri, 26 Jun 2009 14:12:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14940</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>2</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/14940.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=14940</wfw:commentRss><description>I only recently discovered that SSMS will connect to different things. For instance, press the "New query" button. What were you connected to? The answer is the same server as your "current" server. But what is the current server? It is the server where...(&lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2009/06/26/spooky-what-do-you-connect-to.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=14940" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Tools/default.aspx">Tools</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category></item><item><title>Management Pack for SQL Agent Alerts</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2009/06/01/management-pack-for-sql-agent-alerts.aspx</link><pubDate>Mon, 01 Jun 2009 19:05:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14384</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>4</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/14384.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=14384</wfw:commentRss><description>&lt;P&gt;I have finished my article about suggested SQL Server Agent Alerts. Perhaps calling this a&amp;nbsp;"Management Pack" is OTT, but hopefully it will be useful to some of you folks. &lt;/P&gt;
&lt;P&gt;We are talking about having Agent sending email to us when SQL Server writes messages to EventLog. The functionality has been in the product since version 6.0, but I have always lacked some good "default setting". I'm talking about some easy way to tell Agent to notify me for messages which I typically want to be notified for. (Many of you are already using various Management software that has this functionality, so this won't be for you&amp;nbsp;:-) ). &lt;/P&gt;
&lt;P&gt;I very much welcome feedback, you find all information in the article:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.karaszi.com/SQLServer/util_agent_alerts.asp"&gt;http://www.karaszi.com/SQLServer/util_agent_alerts.asp&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;PS: I've blogged about related topics here: &lt;A href="http://sqlblog.com/blogs/tibor_karaszi/archive/2009/02/23/where-s-that-sys-messages-management-pack.aspx"&gt;http://sqlblog.com/blogs/tibor_karaszi/archive/2009/02/23/where-s-that-sys-messages-management-pack.aspx&lt;/A&gt;, and here: &lt;A href="http://sqlblog.com/blogs/tibor_karaszi/archive/2009/05/14/sp-altermessage-is-back-in-business.aspx"&gt;http://sqlblog.com/blogs/tibor_karaszi/archive/2009/05/14/sp-altermessage-is-back-in-business.aspx&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=14384" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Tools/default.aspx">Tools</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Troubleshooting/default.aspx">Troubleshooting</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/SQL+Server+Agent/default.aspx">SQL Server Agent</category></item><item><title>sp_altermessage is back in business!</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2009/05/14/sp-altermessage-is-back-in-business.aspx</link><pubDate>Thu, 14 May 2009 20:36:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14063</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>2</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/14063.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=14063</wfw:commentRss><description>&lt;P&gt;Just a quick note that we again can modify whether system messages are to go to eventlog/errorlog again. I.e., we can change the is_event_logged column in sys.messages. This is very valuable in general and specifically is you want to define Agent alerts (for which Agent polls the Eventlog). For instance:&lt;/P&gt;
&lt;P&gt;SELECT * FROM sys.messages &lt;BR&gt;WHERE message_id = 1205&lt;BR&gt;AND language_id = 1033&lt;/P&gt;
&lt;P&gt;Notice the value for the is_event_logged column. Now, run below:&lt;/P&gt;
&lt;P&gt;EXEC sp_altermessage&lt;BR&gt;&amp;nbsp;@message_id = 1205&lt;BR&gt;,@parameter = 'WITH_LOG'&lt;BR&gt;,@parameter_value = 'true' &lt;/P&gt;
&lt;P&gt;Now, re-run the select statement and see that you modified the behavior for the system message. Now, re-run the sp_altermessage with 'false' to reset to default.&lt;/P&gt;
&lt;P&gt;The ability to modify this behavior for system messages was available prior to SQL Server 2005, but some re-architecturing in 2005 removed the functionality. kozloski informed me in this &lt;A title="this blog post" href="http://sqlblog.com/blogs/tibor_karaszi/archive/2009/02/23/where-s-that-sys-messages-management-pack.aspx"&gt;blog post&lt;/A&gt;&amp;nbsp;that 2005 sp3 re-introduced the functionality and obviously as of sp1 the functionlity is back in 2008 as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=14063" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Tools/default.aspx">Tools</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Maintenance/default.aspx">Maintenance</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/SQL+Server+Agent/default.aspx">SQL Server Agent</category></item><item><title>Match those types!</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2009/04/28/match-those-types.aspx</link><pubDate>Tue, 28 Apr 2009 10:30:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:13606</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>17</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/13606.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=13606</wfw:commentRss><description>&lt;P&gt;This is a recommendation I believe is worth repeating from time to time: Make sure you match data types when you write TSQL code. Else you in most cases end up with an implicit data type conversion. And in worst case, this conversion is performed at the column side - not the literal side of your query. What does that mean? Consider below:&lt;/P&gt;
&lt;P&gt;WHERE Col = Val&lt;/P&gt;
&lt;P&gt;Now, say that the types for above don't match. Val might be some parameter (to a stored procedure, for instance), a variable or a written value (literal). In any case, when SQL Server need to do some operation )like comparison like here) involving several values which aren't of the same type, then one of the values need to be converted so it is of the same type as the other. Which one is determined by the rules for "&lt;A title='Data Type Precendence"' href="http://msdn.microsoft.com/en-us/library/ms190309.aspx"&gt;Data Type Precedence&lt;/A&gt;". &lt;/P&gt;
&lt;P&gt;What we don't want is a conversion at the column side. Why? I would argue that an implicit conversion in the first place in many cases mean I misunderstood something about the types in my system and am on my way of producing a bug in my code. But having a more strict language is not the topic for this particular post (check out &lt;A title=this href="http://sommarskog.se/wishlist.html#strictchecks"&gt;this&lt;/A&gt;). My point here is that it is bad for performance reasons. Just yesterday and today I was &lt;A title="involved in a thread" href="http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/76f22f8a-53b1-4a30-a741-14da5cf539f1/"&gt;involved in a thread&lt;/A&gt; on the MSDN forum. Here's the repro script from that thread (slightly adjusted by me):&lt;/P&gt;
&lt;P&gt;&lt;CODE style="FONT-SIZE:12px;"&gt;&lt;SPAN style="COLOR:blue;"&gt;USE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;tempdb &lt;BR&gt;GO &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;IF&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:magenta;"&gt;OBJECT_ID&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'t'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;IS&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;NOT&amp;nbsp;NULL&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;DROP&amp;nbsp;TABLE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t &lt;BR&gt;GO &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;CREATE&amp;nbsp;TABLE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t&amp;nbsp; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;( &lt;BR&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c1&amp;nbsp;int&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#434343;"&gt;IDENTITY&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;10000001&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&amp;nbsp;NOT&amp;nbsp;NULL&amp;nbsp; &lt;BR&gt;,&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;char&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;8&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&amp;nbsp;NULL &lt;BR&gt;,&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c3&amp;nbsp;datetime&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;NULL &lt;BR&gt;) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;GO &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;INSERT&amp;nbsp;INTO&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c3&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&amp;nbsp; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&amp;nbsp;TOP &lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;3000000&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'20080203'&amp;nbsp; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;master..spt_values&amp;nbsp;t1 &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;CROSS&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;JOIN&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;master..spt_values&amp;nbsp;t2 &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;CROSS&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;JOIN&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;master..spt_values&amp;nbsp;t3 &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;UPDATE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SET&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:magenta;"&gt;CAST&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c1&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;AS&amp;nbsp;char&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;8&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;CREATE&amp;nbsp;UNIQUE&amp;nbsp;CLUSTERED INDEX&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;x&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;ON&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c2&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;GO &lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;WHERE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;N'10000009' &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;WHERE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;N'10000008'&lt;/SPAN&gt;&lt;/CODE&gt; &lt;/P&gt;
&lt;P&gt;Don't bother too much about the first section. The relevant part here is that we have char(8) column with values which are unique (enforced by a unique index), on a table with three million rows.&lt;/P&gt;
&lt;P&gt;Now, before we dig deeper: What is the problem with above queries? The type do not match! The type in the table is char(8), but&amp;nbsp;literal is Unicode (the N before the string). Since nchar has higher precedence than char, then the column side needs to be converted to the value side. Not good. Try the code on SQL Server 2000 and you will see disaster. For me, STATISTICS IO gave 10755 logical reads for both queries, with Clustered Index Scan (which is the same as table scan). Hoover on the Clustered Index Scan icon and you will find "WHERE:(Convert([t].[c2])=[@1])". See how the conversion is done at the column side? This, my friend, mean that SQL Server cannot seek an index to find the rows. Ouch! That's just because we were a bit sloppy... Compare to below:&lt;/P&gt;&lt;CODE style="FONT-SIZE:12px;"&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;WHERE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'10000009' &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;WHERE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'10000008'&lt;/SPAN&gt;&lt;/CODE&gt; 
&lt;P&gt;You will find for both two above we have Clustered Index Seek with only three logical reads. That is a good improvement.&lt;/P&gt;
&lt;P&gt;OK, enough about SQL Server 2000, lets discuss 2008/2005. At first I couldn't see any difference between the two original queries (N'10000009' and N'10000008'). Both seemed to be instant, and the same execution plan for both. I even saved the execution plan as XML and used WinDiff to compare the xml files. No difference. But the poster said the "9" query was slower than the "8" query. I executed to text and had ctrl-E pressed for a while. And now I could see a difference. The flicker was quicker for the "8" version vs. the "9" version. I used Profiler and confirmed. The "9" version had consistently about 90000 microsecond duration where the "8" version had about 0 duration. This was also reflected in CPU usage, as shown by Profiler. I hoped to use Extended Events to find something deeper about this, but that didn't give me anything. Perhaps I didn't capture the relevant events, quite simply. X/Event experts are welcome to suggest event session configurations. :-)&lt;/P&gt;
&lt;P&gt;My guess for the difference is in the execution plan. You will see an index seek for both. That is good, since SQL Server nowadays potentially can use an index even if you end up with an implicit conversion at the column side. But you will see a few more operators in addition to the index seek. See that Constant Scalar followed by a Compute Scalar? My guess is that the built-in internal function used inside the Compute Scalar operator is more expensive for N'10000009' compared to N'10000008'. You can see this function if you use SET STATISTICS PROFILE ON. See the GetRangeThroughConvert() function. My guess is that the answer is the cost for this function. (Search the Internet for things like "Constant Scan" and "GetRangeThroughConvert" for other blog post on this topic.)&lt;/P&gt;
&lt;P&gt;The moral of the story? Here we have a cost which can be relevant in some cases, but we will only see this if we happen to execute our query with the right values and are very very observant. But we can eliminate all this mess this by using the right type for the column in the first place!&lt;/P&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=13606" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Tools/default.aspx">Tools</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Performance/default.aspx">Performance</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/indexes/default.aspx">indexes</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Trace/default.aspx">Trace</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Troubleshooting/default.aspx">Troubleshooting</category></item><item><title>Update of SQL Server 2008 Feature Pack</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2008/10/22/update-of-sql-server-2008-feature-pack.aspx</link><pubDate>Wed, 22 Oct 2008 15:56:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:9598</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>1</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/9598.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=9598</wfw:commentRss><description>&lt;P&gt;I just learned (thanks Josefin)&amp;nbsp;that we now have an update of the SQL Server 2008 feature pack - the October "edition". Stuff like download of command-line tools, driver for PHP, native client, sync framework, upgrade advisor, bunch of BI related utilities and such.&lt;/P&gt;
&lt;P&gt;Check it out at: &lt;A href="http://www.microsoft.com/downloads/details.aspx?familyid=228de03f-3b5a-428a-923f-58a033d316e1&amp;amp;displaylang=en&amp;amp;tm#QuickInfoContainer"&gt;http://www.microsoft.com/downloads/details.aspx?familyid=228de03f-3b5a-428a-923f-58a033d316e1&amp;amp;displaylang=en&amp;amp;tm#QuickInfoContainer&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=9598" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Tools/default.aspx">Tools</category></item><item><title>Rebuild master in SQL Server 2008</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2008/08/29/rebuild-master-in-sql-server-2008.aspx</link><pubDate>Fri, 29 Aug 2008 18:18:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:8655</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>2</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/8655.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=8655</wfw:commentRss><description>&lt;P&gt;You might have read an earlier blog entry about my problems to remove a Data Collector (DC) information in SQL Server 2008. I still haven't found any info on how to do this, but my questions in the MVP group triggered some activity.&lt;/P&gt;
&lt;P&gt;Bob Ward looked into how to rebuild the system databases. This was on my list to try (after removing DC config and if that didn't work rebuilding msdb). But Books Online had very little information on how to actually do the rebuild. Since there were quite many changes in setup between 2005 and 2008, I didn't feel like trial and error based on how we did this in 2005. &lt;/P&gt;
&lt;P&gt;Bob helped me out with some information on how to do the rebuild and it is very easy! I now have a bat file which does rebuild of three instances - and it only takes 5 minutes. And even better: no installation media is required - and it also remembers the collation for my system databases!&lt;/P&gt;
&lt;P&gt;Enough said. Check out Bob's blog post at: &lt;A href="http://blogs.msdn.com/psssql/archive/2008/08/29/how-to-rebuild-system-databases-in-sql-server-2008.aspx"&gt;http://blogs.msdn.com/psssql/archive/2008/08/29/how-to-rebuild-system-databases-in-sql-server-2008.aspx&lt;/A&gt;&lt;/P&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=8655" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Tools/default.aspx">Tools</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Backup/default.aspx">Backup</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Installation/default.aspx">Installation</category></item><item><title>Missing F8 or ctrl-N in SSMS 2008?</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2008/08/26/missing-f8-or-ctrl-n-in-ssms-2008.aspx</link><pubDate>Tue, 26 Aug 2008 07:22:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:8567</guid><dc:creator>TiborKaraszi</dc:creator><slash:comments>8</slash:comments><comments>http://sqlblog.com/blogs/tibor_karaszi/comments/8567.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/tibor_karaszi/commentrss.aspx?PostID=8567</wfw:commentRss><description>&lt;P&gt;Short story: Turn on 2000 keyboard layout and then&amp;nbsp;back to Standard layout.&lt;/P&gt;
&lt;P&gt;Long story:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This topic has been discussed in both the MCT (MS Certified Trainer) as well as MVP groups. Also, see &lt;A href="http://sqlblog.com/blogs/andy_leonard/archive/2008/08/08/sql-server-2008-management-studio-function-keys.aspx"&gt;http://sqlblog.com/blogs/andy_leonard/archive/2008/08/08/sql-server-2008-management-studio-function-keys.aspx&lt;/A&gt;, including the comments.&lt;/P&gt;
&lt;P&gt;The mystery seems to be that in some cases you do have F8 and Ctrl-N in Standard layout, where in other cases you don't. For instance I did a check on&amp;nbsp;4 installations where one had the desired layout (with F8) and the others didn't:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;VPC. XP. Clean install. No prior SQL Server stuff. No F8 or ctrl-N.&lt;/LI&gt;
&lt;LI&gt;My laptop, XP. I have 2000, 2005 and 2008 tools as well as 2000, 2005 and 2008 instances installed. No F8 or ctrl-N.&lt;/LI&gt;
&lt;LI&gt;My desktop machine, Vista. I have 2005 and also 2008 instances. I have had 2005 SSMS which was uninstalled before I installed 2008 SSMS. Here both ctrl-N and F8 work.&lt;/LI&gt;
&lt;LI&gt;VPC. XP. Had 2005 both tools and instance which were upgraded to 2008. No F8 or ctrl-N.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;I was doing training on 2008 last week and I really needed to find my shortcut keys (I couldn't keep stumbling after menus all the time - too slow). So I switched to what I'm familiar with: the 2000 keyboard layout. I recall thinking for myself that perhaps if I now switch back I will have the desired Standard layout (F8 and Ctrl-N). I forgot all about it until today reading a post in the MVP group from Craig Beere suggesting exactly this. To confirm, I tried this in both a virtual machine (1 above) as well as my laptop (2 above) and it worked indeed. &lt;/P&gt;
&lt;P&gt;One thing to watch out for: There doesn't seem to be a way to go back to Standard layout *without* F8 and Ctrl-N. For instance when you get F8 etc, you also get a different shortcut for comment code (or was it uncomment?). So you might want to think a little bit before setting to 2000 layout and back. I'm sure in the end that somebody finds a setting somewhere to control the behavior - and then we know how to switch between the two Standard alternatives...&lt;/P&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=8567" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/Tools/default.aspx">Tools</category><category domain="http://sqlblog.com/blogs/tibor_karaszi/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category></item></channel></rss>