<?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>Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx</link><description>I enjoy forums, and lately I've been really enjoying Stack Overflow. The few, but important enhancements the Stack Overflow team has made to the forum notion, such as easily ranking solutions, separating solutions and commentary into separate channels,</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16100</link><pubDate>Wed, 19 Aug 2009 09:17:42 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16100</guid><dc:creator>Dr Herbie</dc:creator><description>&lt;p&gt;Could you elaborate more on smell #3? &amp;nbsp;I don't understand your reference to 'closure' and 'shape' and the benefits they bring that make views better than stored procedures in this case.&lt;/p&gt;
&lt;p&gt;Note, that I'm a C# developer who writes SQL and not a trained DBA, so there are a lot of concepts that I'm missing ...&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Herbie&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16103</link><pubDate>Wed, 19 Aug 2009 12:16:31 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16103</guid><dc:creator>Andrew Wickham</dc:creator><description>&lt;p&gt;Rule #7.&lt;/p&gt;
&lt;p&gt;I think Rule #7 can be justified from an application standpoint. Sometimes &amp;quot;locked&amp;quot; isn't so much as the row is being updated, but maybe someone actually went into that record in the application and is editing it there. Example...&lt;/p&gt;
&lt;p&gt;Person 1 opens record 200&lt;/p&gt;
&lt;p&gt;Person 2 opens record 200&lt;/p&gt;
&lt;p&gt;Person 1 changed Name&lt;/p&gt;
&lt;p&gt;Person 2 now has stale data in their form and changes Address&lt;/p&gt;
&lt;p&gt;Person 1 saves changes&lt;/p&gt;
&lt;p&gt;Person 2 saves changes&lt;/p&gt;
&lt;p&gt;Person 1's changes were lost, because Person 2's changes were submitted with the stale data. There are probably better ways of taking care of this, but locking someone out of the record when someone else is in it is a relatively easy way to handle this. When Person 1 opens the record it updates the row and sets it to locked. Person 2 then tries to go into the same record and it says &amp;quot;Sorry, this row is already being edited.&amp;quot;&lt;/p&gt;
&lt;p&gt;Let me know what you guys think. Like I said, maybe there is a better way of doing that.&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16104</link><pubDate>Wed, 19 Aug 2009 13:27:13 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16104</guid><dc:creator>Alexander Kuznetsov</dc:creator><description>&lt;p&gt;Merrill,&lt;/p&gt;
&lt;p&gt;I loved reading most of the post, it's a great one. Yet I cannot agree with #9 &amp;quot;Code having no error handling flow control or transactions.&amp;quot; Because error handling in T-SQL is a bad joke, it is full of loopholes, in many cases it makes a lot of sense to handle errors in another layer developed in a better language.&lt;/p&gt;
&lt;p&gt;Regarding views as the alternative to stored procedures, for me inline UDFs are an even better alternative as the take parameters yet still are macros just like views.&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16108</link><pubDate>Wed, 19 Aug 2009 14:47:58 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16108</guid><dc:creator>Adam Machanic</dc:creator><description>&lt;p&gt;Agreed with Andrew Wickham. SQL Server has no built in support for meta-transactional locks (i.e., at the business process level). This is something that you MUST roll yourself. There are better and worse ways to do it, of course. Blatant plug: You might want to refer to my chapter on the topic in &amp;quot;Expert SQL Server 2005 Development&amp;quot;, which shows the methods I've come up with for solving the various problems that can crop up when you don't think through the solution carefully enough.&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16110</link><pubDate>Wed, 19 Aug 2009 15:29:03 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16110</guid><dc:creator>merrillaldrich</dc:creator><description>&lt;p&gt;Thanks, guys, for the feedback. Andrew and Adam - with true &amp;quot;business side&amp;quot; locks I can see your point, and that'd definitely be justified. However, I just got through locating a bug in a vendor-supplied app where they were doing a standard &amp;quot;sequence table,&amp;quot; and instead of using a transaction to lock the underlying row, they used a flag in a column. It was slow, and painful to watch, and later, unsurprisingly, became a concurrency bug. So, I still would call the &amp;quot;roll-your-own locks&amp;quot; notion something to watch out for (smell) but not something that should never be done. Maybe I loaded on the sarcasm too thick in the post :-).&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16114</link><pubDate>Wed, 19 Aug 2009 15:54:27 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16114</guid><dc:creator>merrillaldrich</dc:creator><description>&lt;p&gt;Dr Herbie: what I mean about closure is &lt;/p&gt;
&lt;p&gt;This doesn't work:&lt;/p&gt;
&lt;p&gt;select i.item, m.bar&lt;/p&gt;
&lt;p&gt;from dbo.items i&lt;/p&gt;
&lt;p&gt;inner join exec dbo.myProc m on i.something = m.something&lt;/p&gt;
&lt;p&gt;where m.somethingelse = 'FOO'&lt;/p&gt;
&lt;p&gt;But this does:&lt;/p&gt;
&lt;p&gt;select i.item, m.bar&lt;/p&gt;
&lt;p&gt;from dbo.items i&lt;/p&gt;
&lt;p&gt;inner join dbo.myView m on i.something = m.something&lt;/p&gt;
&lt;p&gt;where m.somethingelse = 'FOO'&lt;/p&gt;
&lt;p&gt;The reason is that a view's &amp;quot;output&amp;quot; is the same as a table's &amp;quot;output&amp;quot; -- one result set with known columns -- where a proc can spit out just about anything, or even different things depending on conditions, etc. That means views can be used in a select statement just like tables, but procs, even if they contain only a select statement, cannot.&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16115</link><pubDate>Wed, 19 Aug 2009 16:03:04 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16115</guid><dc:creator>merrillaldrich</dc:creator><description>&lt;p&gt;Alexander - check my understanding: do you mean that transactions and error handling should be used, but that it's more convenient / safer to use a client-side library (C#, java, whatever) to actually write the code? I can definitely see that. In that case, a profiler trace (I think) still shows transaction boundaries and so on, as that client library directs the action at the server, and the error handling is present, just in the app code and not in raw T-SQL. What I was going after in terms of smell is those systems that lack error handling or transactions altogether...&lt;/p&gt;
&lt;p&gt;I probably should have said, &amp;quot;if you don't see transactions or error handling in the DB, make certain your app is doing that work instead.&amp;quot;&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16120</link><pubDate>Wed, 19 Aug 2009 18:24:23 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16120</guid><dc:creator>Alexander Kuznetsov</dc:creator><description>&lt;p&gt;Merrill, yes I meant &amp;quot;it's more convenient / safer to use a client-side library (C#, java, C++) to actually write the error handling code&amp;quot;. &lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16121</link><pubDate>Wed, 19 Aug 2009 19:16:38 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16121</guid><dc:creator>Bob</dc:creator><description>&lt;p&gt;Question about #10. &amp;nbsp;What's your opinion about creating temp tables in a sproc so that you can index it and reuse it in downstream code. &amp;nbsp;I frequently find that this can produce faster results than subqueries.&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16122</link><pubDate>Wed, 19 Aug 2009 19:53:29 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16122</guid><dc:creator>Al Tenhundfeld</dc:creator><description>&lt;p&gt;11. READ UNCOMMITTED. &lt;/p&gt;
&lt;p&gt;While can be useful in debugging, if your production code needs to read uncommitted transactions, something is probably wrong. &lt;/p&gt;
&lt;p&gt;And re: 7.Roll-your-own locking, I'm not sure what you're advocating. A business transaction is different from a SQL transaction. For example, I might want to &amp;quot;lock&amp;quot; a support ticket while a user edits it, which may take minutes to hours. I don't want anyone else to edit that ticket, but I certainly don't want to leave a SQL transaction open that long. &lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16123</link><pubDate>Wed, 19 Aug 2009 21:22:08 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16123</guid><dc:creator>merrillaldrich</dc:creator><description>&lt;p&gt;Bob - agreed that temp tables _can_ be a performance optimization for some scenarios; to me the issue is more around use of INSERT #temp ... EXEC constantly as a default design pattern, or people who always use temp tables out of habit, where it hurts performance. #Tables usually add overhead, and only sometimes make up for that overhead, plus provide net gain in performance. &lt;/p&gt;
&lt;p&gt;I think it's better to apply optimizations selectively, when you have a problem or when you can really predict you will have a problem. So I would look at a specific case, see if a basic query would work and scale OK, then use a temp table only if needed and really helpful. In any case, most of these Top 10 are not hard-and-fast rules, they are just symptoms to watch out for.&lt;/p&gt;
&lt;p&gt;Al - exactly right. I worry when a SQL transaction was needed and appropriate, but was missing, which is different than the type of business-related &amp;quot;locking&amp;quot; that you and Adam and Andrew describe. It'd be handy if there were a word other than &amp;quot;lock&amp;quot; for that. &amp;quot;Meta-transactional locks? (Adam)&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16127</link><pubDate>Thu, 20 Aug 2009 01:23:30 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16127</guid><dc:creator>Bob</dc:creator><description>&lt;p&gt;Well stated. &amp;nbsp;I probably use them more often than needed. &amp;nbsp;Often it's to simplify the logic: &amp;nbsp;&amp;quot;Rule of Clarity&amp;quot;, etc&lt;/p&gt;
&lt;p&gt;The majority of my work is with data warehouse loads where 2 minute execution vs 4 minute execution is trivial.&lt;/p&gt;
&lt;p&gt;Side note: I came to database programming (15 years ago?) from OO programing and attacked many problems with loops, I simply wasn't thinking in set operations. &amp;nbsp;Some of the awful code I produced still wakes me up at night. &amp;nbsp;It took about 6 months for set operations to click. &amp;nbsp;Sadly, a power company in the midwest is probably still saddled with my stench! &amp;nbsp;&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16183</link><pubDate>Sat, 22 Aug 2009 00:06:13 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16183</guid><dc:creator>Larry Leonard</dc:creator><description>&lt;p&gt;Excellent! &amp;nbsp;However, &amp;quot;I also dislike hungarian notation (dbo.tbl_MyTable, dbo.vw_trans), but if I am honest I have to admit that is really a personal stylistic preference.&amp;quot;? &amp;nbsp;Dude?&lt;/p&gt;
&lt;p&gt;Have you ever worked in a database where all the names are common words like &amp;quot;Transaction&amp;quot;, &amp;quot;Invoice', and my personal favorite, &amp;quot;[Group]&amp;quot;. &amp;nbsp;In my current world, the tables all begin with &amp;quot;tbl&amp;quot;, and thank God they do - makes grepping a whole lot easier!&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16212</link><pubDate>Sat, 22 Aug 2009 21:41:10 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16212</guid><dc:creator>merrillaldrich</dc:creator><description>&lt;p&gt;tblTransaction, tblInvoice and tblGroup? ;-)&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16214</link><pubDate>Sun, 23 Aug 2009 15:23:36 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16214</guid><dc:creator>Phil Factor</dc:creator><description>&lt;p&gt;This is an excellent start to establishing list of SQL Code-smells. The reason I like the concept is that it is less prescriptive than the term 'best practice'. A bad smell in the fridge always needs investigation even if it turns out to be ripe Camembert cheese. I must admit that a some of my code has a bit of a whiff about it, but I always bristle a bit when I'm told it does not 'conform with Best-practice'. &lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16239</link><pubDate>Mon, 24 Aug 2009 09:37:52 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16239</guid><dc:creator>pjones</dc:creator><description>&lt;p&gt;There's a simple reason for number 3 - to keep developers within limits and remove sql select statements and injection vulnerability from their code. &lt;/p&gt;
&lt;p&gt;Best practice for development is to use stored procs and a data access layer. Don't discourage them, a few extra stored procs are far less hassle than fixing the results of a sql injection attack!&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16240</link><pubDate>Mon, 24 Aug 2009 13:24:03 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16240</guid><dc:creator>AaronBertrand</dc:creator><description>&lt;p&gt;Larry, I can understand why you would have a hard time grepping for references to a table named &amp;quot;transaction&amp;quot; or &amp;quot;group&amp;quot; since those words will appear in many procedures that have nothing to do with either table. &amp;nbsp;But what if you used a different but common naming technique, using a collective name for the tables (Transactions, Groups)? &amp;nbsp;A table is a collection of things and very rarely contains only one row. &amp;nbsp;I am not saying that it is better for everyone but it certainly solves your grepping problem. &amp;nbsp;Another is to ensure that you ALWAYS specify the schema prefix when referencing a table. &amp;nbsp;In that case also, grepping for &amp;quot;dbo.Transaction&amp;quot; shouldn't yield any false positives - unless you also have &amp;quot;dbo.TransactionDetails&amp;quot; etc. &amp;nbsp;In which case combining these practices would further ease your grepping woes: &amp;quot;dbo.Transactions&amp;quot; and &amp;quot;dbo.TransactionDetails&amp;quot;...&lt;/p&gt;
&lt;p&gt;Seems like a poor excuse to add an otherwise utterly useless prefix to every single table. &amp;nbsp;If it looks and smells like a table, you do not need to name it tblTable.&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16246</link><pubDate>Mon, 24 Aug 2009 16:23:59 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16246</guid><dc:creator>merrillaldrich</dc:creator><description>&lt;p&gt;pjones - respectfully, I hate SQL injection as much as the next guy, but please keep in mind that it's handling parameters correctly that really prevents SQL injection. Using stored procs happens to favor the use of parameters, a fact which seems to have morphed into the idea that stored procs themselves prevent SQL injection. It's parameters that do the work and keep things safe. There are many safe ways to parameterize queries. (I don't want to get into the whole sprocs argument, as it's a discussion that's already completely played out elsewhere, and there's not much new to add.)&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16249</link><pubDate>Mon, 24 Aug 2009 16:29:40 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16249</guid><dc:creator>AaronBertrand</dc:creator><description>&lt;p&gt;Merrill, very true. &amp;nbsp;You can't just move unsafe code into a stored procedure, and it magically becomes &amp;quot;safe&amp;quot;. &amp;nbsp;I have often seen the following approach when people are told to get the SQL queries out of their application code and use stored procedures.&lt;/p&gt;
&lt;p&gt;SQLstr = &amp;quot;SELECT * FROM bar &amp;quot; + WhereClause;&lt;/p&gt;
&lt;p&gt;...will often become...&lt;/p&gt;
&lt;p&gt;CRETAE PROCEDURE dbo.foo&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;@WhereClause NVARCHAR(MAX)&lt;/p&gt;
&lt;p&gt;AS&lt;/p&gt;
&lt;p&gt;BEGIN&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;SET NOCOUNT ON;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;EXEC('SELECT * FROM bar ' + @WhereClause);&lt;/p&gt;
&lt;p&gt;END&lt;/p&gt;
&lt;p&gt;GO&lt;/p&gt;
</description></item><item><title>Parameters, Perms and Procs: Are You Really Protected from Injection?</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16266</link><pubDate>Mon, 24 Aug 2009 22:01:31 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16266</guid><dc:creator>Merrill Aldrich</dc:creator><description>&lt;p&gt;In my last post, Top 10 T-SQL Code Smells , I caught some flack got some feedback for including one (#3)&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#16299</link><pubDate>Tue, 25 Aug 2009 16:51:20 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16299</guid><dc:creator>David Russ</dc:creator><description>&lt;p&gt;My approach to the business workflow type of locking, I typically have a timestamp column that I read and store the byte value when the application opens the &amp;quot;record&amp;quot;. &amp;nbsp;Then when the employ saves, I check the record's timestamp column and then compare it to my stored byte array. &amp;nbsp;If they are different, then I warn the employee that the record has been modified outside of their &amp;quot;screen&amp;quot;. &amp;nbsp;This gives them a heads up.&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#23458</link><pubDate>Tue, 16 Mar 2010 18:08:01 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:23458</guid><dc:creator>Bob</dc:creator><description>&lt;p&gt;Optimizer hints are also bad. &amp;nbsp;That's all code that needs to be rechecked every time SQL is updated. &amp;nbsp;Especially pervasive is select * from x (WITH NOLOCK)&lt;/p&gt;
</description></item><item><title>All Those Extra DR Bits, Part 1.5</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#31062</link><pubDate>Fri, 26 Nov 2010 22:17:23 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:31062</guid><dc:creator>Merrill Aldrich</dc:creator><description>&lt;p&gt;I got some positive feedback on the last post, All Those Extra Bits We Need for DR , so I wanted to put&lt;/p&gt;
</description></item><item><title>re: Top 10 T-SQL Code Smells</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#31160</link><pubDate>Tue, 30 Nov 2010 14:38:07 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:31160</guid><dc:creator>GSquared</dc:creator><description>&lt;p&gt;On the &amp;quot;business locks&amp;quot; vs &amp;quot;transaction locks&amp;quot;, I prefer to use the term &amp;quot;MUTEX&amp;quot; for the business locks, to avoid the confusion on &amp;quot;locks&amp;quot;. &amp;nbsp;A flag or timestamp of some sort on a row in a table, indicating to other resources trying to access that data that it's in-use, definitely falls under the heading of a mutex.&lt;/p&gt;
&lt;p&gt;Understanding how they work, and what to watch out for (things like rows that never get let go because of an incomplete or failed action), are all covered under the general programming concepts for mutexes.&lt;/p&gt;
&lt;p&gt;(Yes, this is a bit late to the game. &amp;nbsp;Ended up here off of an article today on Simple-Talk.com.)&lt;/p&gt;
</description></item><item><title>2010: It’s a Wrap</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#32213</link><pubDate>Sat, 01 Jan 2011 01:27:11 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:32213</guid><dc:creator>Merrill Aldrich</dc:creator><description>&lt;p&gt;So, last day of the year, and I can see many people are in a reflective mood. I don’t usually deep dive&lt;/p&gt;
</description></item><item><title>T-SQL Tuesday 24: Ode to Composable Code</title><link>http://sqlblog.com/blogs/merrill_aldrich/archive/2009/08/18/top-10-t-sql-code-smells.aspx#39692</link><pubDate>Tue, 08 Nov 2011 06:54:09 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:39692</guid><dc:creator>Merrill Aldrich</dc:creator><description>&lt;p&gt;I love the T-SQL Tuesday tradition, started by Adam Machanic and hosted this month by Brad Shulz . I&lt;/p&gt;
</description></item></channel></rss>