<?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 tags 'Transact-SQL Programming' and 'Tips'</title><link>http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&amp;tag=Transact-SQL+Programming,Tips&amp;orTags=0</link><description>Search results matching tags 'Transact-SQL Programming' and 'Tips'</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>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></channel></rss>