<?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>Search results matching tag 'Transact-SQL Programming'</title><link>http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&amp;tag=Transact-SQL+Programming&amp;orTags=0</link><description>Search results matching tag 'Transact-SQL Programming'</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Learn More About SQL Server IO and Query Tuning in These Webcasts</title><link>http://sqlblog.com/blogs/kevin_kline/archive/2012/12/14/learn-more-about-sql-server-io-and-query-tuning-in-these-webcasts.aspx</link><pubDate>Fri, 14 Dec 2012 18:50:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:46662</guid><dc:creator>KKline</dc:creator><description>
&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;I'm doing two new webcasts next week on Wednesday, December 19th, one in the morning and the other after lunch.&lt;/p&gt;
&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2 style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;SSDs are a Game Changer for SQL Server Storage&lt;/h2&gt;
&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;No, session is not exclusively about SSDs. &amp;nbsp;But this is my first session on IO and storage tuning that emphasizes SSDs over hard disks. &amp;nbsp;As Bob Dylan said "Times, they are a'changin'". &amp;nbsp;This session on Wednesday, December 19th at 11:30 AM EST, sponsored by Astute Networks, takes you through all of the basics of storage and IO tuning, regardless of the underlying storage technology. &amp;nbsp;I'll show you how SQL Server handles storage structures, how to identify IO activity on Windows and SQL Server, and best practices for minimizing IO bottlenecks. &amp;nbsp;Register now for:&lt;a title="Kevin Kline's Storage IO Best Practices for SQL Server" href="http://bit.ly/UcXYI3"&gt;&amp;nbsp;Storage IO Best Practices for SQL Server and a New Approach to Solving Application Performance Issues&lt;/a&gt;.&lt;/p&gt;
&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2 style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Write Better SQL Queries&lt;/h2&gt;
&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;The next webcast on Wednesday, December 19th at 2 PM EST, is with me, Aaron Bertrand &amp;nbsp;(&lt;a href="https://twitter.com/#!/AaronBertrand"&gt;Twitter&amp;nbsp;&lt;/a&gt;|&amp;nbsp;&lt;a href="http://sqlblog.com/blogs/aaron_bertrand/rss.aspx"&gt;Blog&lt;/a&gt;)&amp;nbsp;and SQLCruise Impresario &amp;amp; Microsoft MVP Tim Ford &amp;nbsp;(&lt;a href="https://twitter.com/#!/sqlagentman"&gt;Twitter&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href="http://www.ford-it.com/sqlagentman/"&gt;Blog&lt;/a&gt;)&amp;nbsp;as we take you through the query tuning process, discussing important DMVs to use during query tuning, as well as demonstrating several essential query tuning techniques that every SQL developer should know. &amp;nbsp;Not only are we presenting an hour of top quality technical content, we’ll also be giving away some cool prizes, including the grand prize of a paid registration for the upcoming&amp;nbsp;&lt;a target="_blank" href="http://elink.sqlsentry.net/c/1/?aId=67857085&amp;amp;requestId=b34612-273953cd-e600-4a18-979a-a9f2ded860bd&amp;amp;rId=lead-a407ed107f65de119513001e0b614992-c233a49718324979b0d8efc0614ff5d0&amp;amp;ea=aunefuonetre=pbz=vagrepreir&amp;amp;dUrl=http%3A%2F%2Fsqlcruise.com%2F2013-cruises%3F_cldee%3DbmhhcnNoYmFyZ2VyQGludGVyY2VydmUuY29t&amp;amp;uId=0"&gt;SQLCruise Miami&lt;/a&gt;, a $1,395 value! &amp;nbsp;Register now for:&amp;nbsp;&lt;a title="SQL Server Query Tuning Best Practices, Hosted by Kevin Kline, Aaron Bertrand, and Tim Ford" href="http://bit.ly/UskPPm"&gt;SQL Server Query Tuning Best Practices, Hosted by Kevin Kline and Aaron Bertrand with special guest Tim Ford&lt;/a&gt;&lt;/p&gt;
&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;I hope to see you at both of these sessions next week! &amp;nbsp;Best regards,&lt;/p&gt;
&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;-Kev&lt;/p&gt;
&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;&lt;a title="Kevin E. Kline on Twitter" href="http://twitter.com/kekline"&gt;-Follow me on Twitter!&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Help Me Update the History of SQL Server</title><link>http://sqlblog.com/blogs/kevin_kline/archive/2012/09/12/help-me-update-the-history-of-sql-server.aspx</link><pubDate>Wed, 12 Sep 2012 15:01:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:45167</guid><dc:creator>KKline</dc:creator><description>&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;I was chatting with my buddy, Buck Woody (&lt;a href="https://twitter.com/#!/buckwoody"&gt;Twitter&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href="http://blogs.msdn.com/buckwoody/rss.xml"&gt;Blog&lt;/a&gt;), about a week ago and we were discussing that it's pretty hard to put together the entire history of SQL Server. &amp;nbsp;Then the thought hit me that I'd already done this, to a degree, in my book&amp;nbsp;&lt;em&gt;﻿Transact-SQL Programming.&amp;nbsp;&lt;/em&gt;﻿ This was the first Transact-SQL programming book on the market way back in the SQL Server 7.0 days and even included full coverage of both Microsoft and Sybase variants of T-SQL.&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;The thing is, I was never able to put out a second edition due to some legal and contractual issues. &amp;nbsp;So, help me catch up on the history of SQL Server:&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;&lt;br&gt;&lt;/p&gt;&lt;h1 style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;The Ancient History of Microsoft SQL Server&lt;/h1&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;SQL Server, like many things related to SQL, is a story of diversity.&amp;nbsp; At one time, both Sybase and Microsoft had virtually the same product with Sybase's product targeted at Unix and enterprise environments while Microsoft targeted only the Windows enterprise.&amp;nbsp; Today, the two products are entirely divergent. &amp;nbsp;The code base for each product is unique to each platform and shares no code at all. &amp;nbsp;For a while, both Sybase and Microsoft called their flagship database product "SQL Server", but now, Sybase &amp;nbsp;calls their implementation of the product Sybase Adaptive Server Enterprise. So while the two products are now completely distinct, they continue to share a strongly similar Transact-SQL implementation. &amp;nbsp;Other less noticeable similarities persist, such as the use of Tabular Data Stream (TDS), tempdb architecture, and a few other odds and ends.&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Perhaps you want to know more about how things got to be the way they are?&amp;nbsp; By reading this section, you will be making an admission that many programmers and developers are loath to - history is interesting ... perhaps even enjoyable.&amp;nbsp; This is not actually a sign of weakness as some might attest. With tongue planted firmly in cheek, please read on.&amp;nbsp; Table 1-1 shows the evolution of both Microsoft and Sybase’s version of SQL Server’s. &amp;nbsp;&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;&lt;br&gt;&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;&lt;em&gt;&lt;strong&gt;Notice that I stop at more than a decade ago. &amp;nbsp;Help me add the subsequent details by leaving a comment! &amp;nbsp;Extra points if you know the code name for each release.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;&lt;br&gt;&lt;/p&gt;&lt;h3 style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;1987 - Microsoft Buddies Up with Sybase&lt;/h3&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Microsoft and Sybase announce a technology and marketing partnership.&amp;nbsp; Microsoft gets exclusive rights to market Sybase’s DataServer product on OS/2 and all Microsoft-developed operating systems.&amp;nbsp; Sybase gets royalties and added credibility in the Unix and VMS markets. (Remember VMS?) &amp;nbsp;Sybase ships their first commercial DBMS product, called DataServer, for Sun workstations running Unix.&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;It was only 20 years prior that the first Super Bowl was played as the Green Bay Packers of the National Football League defeated the Kansas City Chiefs of the American Football League, 35-10. (Hey, now this is important!)&lt;/p&gt;&lt;h3 style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;1988 - Microsoft Buddies Up with Ashton-Tate&lt;/h3&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Microsoft and Ashton-Tate announce a marketing partnership.&amp;nbsp; Microsoft can’t put a dent in dBase’s tremendous market presence.&amp;nbsp; Ashton-Tate wants access to Sybase’s powerful multi-user database management technology, which ships this year.&amp;nbsp; Microsoft forms a three-way alliance.&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Another interesting three-way alliance was also making headlines at that time, as independent counsel Lawrence E. Walsh probed the Iran-Contra affair.&lt;/p&gt;&lt;h3 style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;1989 - SQL Server v1.0 Ships&lt;/h3&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Ashton-Tate/Microsoft SQL Server version 1.0 ships.&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Perhaps not coincidentally, NYC transit fare rises from $1.00 to $1.15.&lt;/p&gt;&lt;h3 align="left" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;1990 - Microsoft Ships SQL Server v.1. for, OMG,&amp;nbsp;&lt;em&gt;Windows&lt;/em&gt;!&lt;/h3&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Ashton-Tate dBase IV was floundering.&amp;nbsp; Microsoft wanted to beef up its offerings for the new OS/2 LAN Manager product.&amp;nbsp;&amp;nbsp; Microsoft and Ashton-Tate quit the partnership.&amp;nbsp; “Microsoft SQL Server” version 1.1 ships by summer with support for Windows 3.0&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Another partnership came to an end that year: ousted Panamanian leader Manuel Noriega surrendered to U.S. forces, after taking refuge in the Vatican's diplomatic mission.&amp;nbsp;&lt;/p&gt;&lt;h3 style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;1991 - Microsoft Goes All-In on Windows 3.0&lt;/h3&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;A proliferation of Windows 3.0 front-end tools spurs the growth of Microsoft SQL Server. Later that year Microsoft and Sybase amend their contract to allow Microsoft to make actual bug fixes - all under Sybase supervision.&amp;nbsp; IBM and Microsoft call off their OS/2 partnership with Microsoft to focus on Windows.&amp;nbsp; Sybase surpasses the $100 million revenue mark and goes public on NASDAQ.&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Almost one thousand years ago to the day, significant improvements in front-end tools (i.e. the plow and horse yolk) spur a huge population boom in Europe.&amp;nbsp; The Vikings and Europeans call off their partnership, with the Vikings dragging off most of the loot.&amp;nbsp; Meanwhile, Islam is continuing its military expansion throughout the world. Fortunately, medieval Europe does not have to endure lengthy beta programs, although computer geeks have to endure a plague of viruses. No fair!&lt;/p&gt;&lt;h3 align="left" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;1992 - Microsoft Goes Nuts on Windows NT&lt;/h3&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Microsoft and Sybase SQL Server 4.2 ships. Microsoft diverts its attention away from OS/2 and into developing Windows NT.&amp;nbsp;&amp;nbsp; Microsoft SQL Server for Windows NT later ships in beta release while Sybase ships its much-vaunted System 10.&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;A famous diversion of attention in the political arena, you ask?&amp;nbsp; Then President George H. W. Bush lost his lunch during a state dinner in Tokyo; White House officials tried to deflect attention saying Bush was suffering from stomach flu.&lt;em&gt;&lt;/em&gt;&lt;/p&gt;&lt;h3 align="left" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;1993 - Microsoft and Sybase Become Unfriends&lt;/h3&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Microsoft Windows NT 3.1 ships, closely followed by Microsoft SQL Server.&amp;nbsp; By 1994, Sybase SQL Server System 10 and Microsoft SQL Server were competing unabashedly as the two formally ended their partnership. &amp;nbsp;(This is about the time that I started to use Microsoft SQL Server 4.21 on OS/2).&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Likewise, the American voting public formally ended their relationship with “Read my lips” President George H. W. Bush.&amp;nbsp;&lt;/p&gt;&lt;h3 align="left" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;1995 - Microsoft Enters the Enterprise Computing World&lt;/h3&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Microsoft SQL Server 6.0, a very significant release, ships in June. &amp;nbsp;Up until this time, &amp;nbsp;most Microsoft products were considered departmental-level only. &amp;nbsp;SQL Server also begins to push out many PC-level database products, with the noticeable exception of Microsoft Access. &amp;nbsp;Access will be a thorn in the side of SQL Server DBAs until ... uh ... probably 10+ years from now.&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Other significant release for 1995 included O.J. Simpson - not guilty.&lt;/p&gt;&lt;h3 align="left" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;1996 - SQL Server 6.5 Goes Into Production&lt;/h3&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Though released in April, it’s no April Fool’s joke.&amp;nbsp; SQL Server 6.5 is the most powerful and capable version Microsoft had ever produced. It also received considerable press because of its innovative user interface and free tools.&lt;/p&gt;&lt;h3 align="left" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;1997 - Microsoft SQL Server 7.0 Beta Released. Remember the Code Name?&lt;/h3&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Is there a causal relationship between the Monkees' appearance at the Hollywood Bowl (June 10, 1967)&amp;nbsp;&lt;em&gt;and&lt;/em&gt;&amp;nbsp;the first shipment of the Apple II Computer (June 10, 1977)&amp;nbsp;&lt;em&gt;and&lt;/em&gt;&amp;nbsp;the release of MS SQL Server 7.0 beta (June 10, 1997)?&amp;nbsp; It does make you wonder, doesn’t it?&lt;/p&gt;&lt;h3 align="left" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;1998 - Microsoft SQL Server 7.0 RTM&lt;/h3&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Microsoft offers another set of new innovations in the SQL Server 7.0 release, including an "all-in-the-box" strategy. &amp;nbsp;Other major DBMS vendors had, and still have, separate products for ETL (extract-transform-load), administration tools, scheduling, and business intelligence. &amp;nbsp;Not Microsoft. &amp;nbsp;With SQL Server 7.0, Microsoft included the Data Transformation Service (DTS) for ETL work, Query Analyzer and other administration tools, OLAP services (my brain gets a little cloudy on this one), along with the already existing scheduler, SQL Agent. &amp;nbsp;&lt;/p&gt;&lt;h3 style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;2000 - Microsoft SQL Server 2000&lt;/h3&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Branding experts said that version numbers should get too big, or else customers would perceive the software as stodgy and old fashioned. &amp;nbsp;So Microsoft switched from the version number nomenclature to the one highlighting the year of the release for SQL Server 2000. &amp;nbsp;This release included the game-changing Enterprise Manager (EM). Forced many other DBMS companies to at least attempt to build useful tools (anyone use SQL*Plus from Oracle). &amp;nbsp;Again, my brain is getting dusty with old age and too many releases, but IIRC this was the release in which Microsoft finally got ride of page-level locking in favor of row-level locking. &amp;nbsp;That shuts up a lot of Oracle-bigots, but doesn't truly ease their smarmy attitude. &amp;nbsp;Grudge matches continue unabated.&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;I'm going to follow-up with another blog post carrying forward with SQL Server 2000, including highlights for important half-steps like SQL Server 2000 SP3, the "Slammer" security release. &amp;nbsp;&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Feel free to throw down some of your SQL Server trivia knowledge about release and features for releases. &amp;nbsp;Share a picture of one of your old boxes, if you have one!&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Enjoy,&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;-Kev&amp;nbsp;&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;&lt;a href="http://twitter.com/kekline"&gt;Twitter&lt;/a&gt;&amp;nbsp;|&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;a href="http://www.facebook.com/kekline"&gt;Facebook&lt;/a&gt;&amp;nbsp;|&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;a href="http://www.youtube.com/user/KevinEKline"&gt;YouTube&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href="http://www.linkedin.com/in/kekline"&gt;LinkedIn&lt;/a&gt;&amp;nbsp;|&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;a href="http://kevinekline.com/"&gt;Blog&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Flexibility When Waiting on Locks</title><link>http://sqlblog.com/blogs/kevin_kline/archive/2012/05/17/flexibility-when-waiting-on-locks.aspx</link><pubDate>Thu, 17 May 2012 13:29:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:43427</guid><dc:creator>KKline</dc:creator><description>&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Speaking at a recent&amp;nbsp;&lt;a title="SQL Saturday Events around the world" href="http://www.sqlsaturday.com/"&gt;SQL Saturday&lt;/a&gt;, an attendee in one of my sessions wanted to know how they could more flexibly react to locks on their application than to wait for blocks to occur and then kill the SPID at the head of the blocking chain. &amp;nbsp;They were also interested in some alternatives to using the &amp;nbsp;SQL Server syntax like&lt;a title="Transact-SQL Syntax for the WITH (NOLOCK) table hint" href="http://msdn.microsoft.com/en-us/library/ms187373.aspx"&gt;&amp;nbsp;the WITH (NOLOCK) hint&lt;/a&gt;, since that might have unintended consequences due to allowing reads on uncommitted data.&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;One alternative I suggested is the SET LOCK_TIMEOUT&amp;nbsp;&lt;em&gt;n&amp;nbsp;&lt;/em&gt;statement. &amp;nbsp;Since most of the attendees hadn't heard of this statement, I figured it'd make a good blog post. &amp;nbsp;&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;When using the statement, you can set this context for the connection, for a batch of code (such as a function or stored procedure), or for a single SQL statement (excluding a few DDL statements such as CREATE/ALTER DATABASE). &amp;nbsp;By passing a numeric value with the set statement, you specify the number of milliseconds that the statement will wait for a lock to be released before returning a locking error. &amp;nbsp;0 means don't wait at all and -1, the default, means wait forever. &amp;nbsp;Once changed,&amp;nbsp;the new setting stays in effect for the remainder of the connection. &amp;nbsp;So you might want to set it back to the default if you want it to apply to only one statement, say a SELECT, in a big batch of statements.&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;You can also get the same behavior by using the&amp;nbsp;READPAST locking hint.&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;Hope this helps with those troublesome locking situations! &amp;nbsp;Enjoy,&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;-Kev&lt;/p&gt;&lt;p style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;"&gt;-Follow me on&amp;nbsp;&lt;a title="Kevin Kline's Twitter Feed" href="http://twitter.com/kekline"&gt;Twitter&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Dev Advice: Make a Tiny Dev Database Act Like a HUGE Prod Database</title><link>http://sqlblog.com/blogs/kevin_kline/archive/2012/03/16/dev-advice-make-a-tiny-dev-database-act-like-a-huge-prod-database.aspx</link><pubDate>Fri, 16 Mar 2012 14:30:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:42346</guid><dc:creator>KKline</dc:creator><description>&lt;p&gt;Here's an evergreen question.  It's a question that never completely goes away.  But lately, I've been getting it a few times per week.  So I thought it's time to readdress the question, which usually takes some form of the following:&lt;/p&gt;&lt;p style="padding-left:30px;"&gt;&lt;em&gt;I can't really do effective development on my little dev laptop because our production SQL Server database is 15 gazillionbytes, way too big for my workstation.  What's a uber-nerd to do? &lt;/em&gt;&lt;/p&gt;&lt;p&gt;Well, maybe they didn't use the word "uber-nerd".  But you get my drift, right?  The production database is really, really big - unmanageably big for keeping a local copy.  So that means the dev either has to create a metadata-only version of the database, which won't produce realistic query plans, or somehow crush their laptop under 15 gazillionbytes of MDF and LDF files.&lt;/p&gt;&lt;p&gt;Actually, you have a better alternative - &lt;em&gt;a clone database&lt;/em&gt;, sometimes called a &lt;em&gt;shell&lt;/em&gt; database.  Here's how I described a cloned database a few years ago here in my &lt;a title="Kevin Kline's Tool Time Column on SQL Server Pro Magazine" href="http://www.sqlmag.com/article/sql-server-2005/efficiently-clone-databases"&gt;Tool Time column for SQL Server Pro Magazine&lt;/a&gt;:&lt;/p&gt;&lt;p style="padding-left:30px;"&gt;&lt;span&gt;&lt;em&gt;In effect, a cloned database includes all of the schema objects of the database (e.g., tables, views, stored procedures), as well as the statistics and histograms (the so-called "statistics blob"). This metadata is quite small by volume but can tell you what estimated query plans look like outside of a large production environment and how those estimated query plans might change when SQL Server is upgraded. Cloned databases are especially useful when the data is confidential, classified, or subject to privacy laws.&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The article gives you all the detail you need to effectively and quickly &lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;create a small version of a big, ol' production database&lt;/strong&gt;&lt;/span&gt; that produces the same query execution plans as you'd get on the prod server.&lt;/p&gt;&lt;p&gt;If you're struggling with doing development on a big SQL Server database, learn the ropes on cloned databases &lt;em&gt;asap!&lt;/em&gt;  You'll be glad you did.&lt;/p&gt;&lt;p&gt;Enjoy!&lt;/p&gt;&lt;p&gt;-Kev&lt;/p&gt;&lt;p&gt;-&lt;a title="Kevin Kline's Twitter Feed" href="http://twitter.com/kekline"&gt;Follow me on Twitter&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Everybody Needs a Test Harness</title><link>http://sqlblog.com/blogs/kevin_kline/archive/2011/10/31/everybody-needs-a-test-harness.aspx</link><pubDate>Mon, 31 Oct 2011 14:17:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:39489</guid><dc:creator>KKline</dc:creator><description>&lt;p&gt;When you're developing new Transact-SQL code or modifying some existing code, do you just launch directly into programming?&lt;/p&gt;&lt;p&gt;I know that I did just that, for years.  It wasn't until I was trying to performance tune some existing code that I realized I hadn't actually taken caching of data and execution plans into account.  So all those modified stored procedures that I was so proud of might not actually be faster than the first generation of procedures because I hadn't checked to ensure that I was testing cached programs against uncached programs (and, by extension, the data used by those programs).  That's easy enough to fix with a &lt;em&gt;test harness.&lt;/em&gt;  Test harness were originally an actual, physical harness used by engineers to clamp down parts of an electrical or mechanical device they were prototyping.  Ours is no different.  It locks down all of the assumptions about our code (like my early, false assumption that I didn't need to clear the caches) and adds a metric or two for good measure - literally - so we can better measure what's happening in that code.&lt;/p&gt;&lt;p&gt;Here's what my test harness looks like: &lt;/p&gt;&lt;pre style="padding-left:30px;"&gt;/* Transact-SQL test harness by Kevin Kline, http://KevinEKline.com, Twitter at kekline */ &lt;/pre&gt;&lt;pre style="padding-left:30px;"&gt;/* Flush dirty pages from the buffer to the database files. */&lt;/pre&gt; &lt;pre style="padding-left:30px;"&gt;CHECKPOINT;&lt;/pre&gt; &lt;pre style="padding-left:30px;"&gt;/* Flush the data cache and procedure cache, respectively. For DEV environments only! */&lt;/pre&gt; &lt;pre style="padding-left:30px;"&gt;DBCC DROPCLEANBUFFERS; &lt;/pre&gt;&lt;pre style="padding-left:30px;"&gt;DBCC FREEPROCCACHE;&lt;/pre&gt; &lt;pre style="padding-left:30px;"&gt;/* Enable statistics tracking for IO and timings. Remember, SET commands remain enabled during a session until disabled. */&lt;/pre&gt; &lt;pre style="padding-left:30px;"&gt;SET STATISTICS IO ON; &lt;/pre&gt;&lt;pre style="padding-left:30px;"&gt;SET STATISTICS TIME ON;&lt;/pre&gt; &lt;pre style="padding-left:30px;"&gt;-- Whatever SQL code you'd like to process goes below.&lt;/pre&gt;&lt;pre style="padding-left:30px;"&gt;SELECT SalesOrderID&lt;/pre&gt;&lt;pre style="padding-left:30px;"&gt;FROM Sales.SalesOrderHeader H&lt;/pre&gt;&lt;pre style="padding-left:30px;"&gt;WHERE CustomerID = 344&lt;/pre&gt;&lt;pre style="padding-left:30px;"&gt;GO&lt;/pre&gt; &lt;pre style="padding-left:30px;"&gt;SET STATISTICS IO OFF; &lt;/pre&gt;&lt;pre style="padding-left:30px;"&gt;SET STATISTICS TIME OFF;&lt;/pre&gt; &lt;pre style="padding-left:30px;"&gt;/* Textual Execution Plans, if desired. &lt;/pre&gt;&lt;pre style="padding-left:30px;"&gt;SET SHOWPLAN_TEXT ON; &lt;/pre&gt;&lt;pre style="padding-left:30px;"&gt;SET SHOWPLAN_TEXT OFF; &lt;/pre&gt;&lt;pre style="padding-left:30px;"&gt;*/&lt;/pre&gt;&lt;p&gt; I also like to include the execution plans a lot of the time.  You might wonder why I don't save the execution plans for the GUI in SSMS?  Well, I'm a big advocate of scripting in general because I like to automate activities.  By pulling the execution plans using scripts, I can use SQLCMD to schedule a large number of query executions during the evening and have the results ready for analysis when I come back into the office in the morning.  &lt;em&gt;Workin' smarter, not harder, Baby!&lt;/em&gt;&lt;/p&gt;&lt;p&gt;So how does this test harness work for you?  Do you use other elements in yours?  If so, share your experiences here!&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p&gt;-Kevin&lt;/p&gt;&lt;p&gt;-&lt;a title="C'mon. You know you want to." href="http://twitter.com/kekline" target="_blank"&gt;Follow me on Twitter&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>