<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblogcasts.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Piotr Rodak</title><subtitle type="html">if datepart(dw, getdate()) in (6, 7)&lt;br /&gt;
	&lt;b&gt;use pubs&lt;/b&gt;;

</subtitle><id>http://sqlblogcasts.com/blogs/piotr_rodak/atom.aspx</id><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/piotr_rodak/default.aspx" /><link rel="self" type="application/atom+xml" href="http://sqlblogcasts.com/blogs/piotr_rodak/atom.aspx" /><generator uri="http://communityserver.org" version="3.1.20917.1142">Community Server</generator><updated>2010-01-04T22:10:00Z</updated><entry><title>Good practices - database programming, unit testing</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/05/24/good-practices-database-programming-unit-testing.aspx" /><id>http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/05/24/good-practices-database-programming-unit-testing.aspx</id><published>2010-05-24T00:27:00Z</published><updated>2010-05-24T00:27:00Z</updated><content type="html">Jason Brimhall wrote today on his blog that new book, Defensive Database Programming , written by Alex Kuznetsov ( blog ) is coming to bookstores. Alex writes about various techniques that make your code safer to run. SQL injection is not the only one vulnerability the code may be exposed to. Some other include inconsistent search patterns, unsupported character sets, locale settings, issues that may occur during high concurrency conditions, logic that breaks when certain conditions are not met....(&lt;a href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/05/24/good-practices-database-programming-unit-testing.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=14301" width="1" height="1"&gt;</content><author><name>Piotr Rodak</name><uri>http://sqlblogcasts.com/members/Piotr-Rodak.aspx</uri></author><category term="tips and tricks" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/tips+and+tricks/default.aspx" /><category term="t-sql" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/t-sql/default.aspx" /><category term="errors" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/errors/default.aspx" /><category term="script" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/script/default.aspx" /><category term="programming" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/programming/default.aspx" /><category term="error" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/error/default.aspx" /><category term="API" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/API/default.aspx" /><category term="unit testing" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/unit+testing/default.aspx" /><category term="error handling" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/error+handling/default.aspx" /></entry><entry><title>The penultimate audit trigger framework</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/05/11/the-penultimate-audit-trigger.aspx" /><id>http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/05/11/the-penultimate-audit-trigger.aspx</id><published>2010-05-10T23:18:00Z</published><updated>2010-05-10T23:18:00Z</updated><content type="html">So, it’s time to see what I came up with after some time of playing with COLUMNS_UPDATED() and bitmasks. The first part of this miniseries describes the mechanics of the encoding which columns are updated within DML operation. The task I was faced with was to prepare an audit framework that will be fairly easy to use. The audited tables were to be the ones directly modified by user applications, not the ones heavily used by batch or ETL processes. The framework consists of several tables and procedures...(&lt;a href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/05/11/the-penultimate-audit-trigger.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=13546" width="1" height="1"&gt;</content><author><name>Piotr Rodak</name><uri>http://sqlblogcasts.com/members/Piotr-Rodak.aspx</uri></author><category term="trigger" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/trigger/default.aspx" /><category term="tips and tricks" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/tips+and+tricks/default.aspx" /><category term="t-sql" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/t-sql/default.aspx" /><category term="Numbers table" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/Numbers+table/default.aspx" /><category term="Tally table" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/Tally+table/default.aspx" /><category term="source code" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/source+code/default.aspx" /><category term="util" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/util/default.aspx" /><category term="script" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/script/default.aspx" /><category term="API" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/API/default.aspx" /><category term="audit framework" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/audit+framework/default.aspx" /></entry><entry><title>COLUMNS_UPDATED() for audit triggers</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/04/28/columns-updated.aspx" /><id>http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/04/28/columns-updated.aspx</id><published>2010-04-28T22:27:00Z</published><updated>2010-04-28T22:27:00Z</updated><content type="html">In SQL Server 2005, triggers are pretty much the only option if you want to audit changes to a table. There are many ways you can decide to store the change information. You may decide to store every changed row as a whole, either in a history table or as xml in audit table. The former case requires having a history table with exactly same schema as the audited table, the latter makes data retrieval and management of the table a bit tricky. Both approaches also suffer from the tendency to consume...(&lt;a href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/04/28/columns-updated.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=13476" width="1" height="1"&gt;</content><author><name>Piotr Rodak</name><uri>http://sqlblogcasts.com/members/Piotr-Rodak.aspx</uri></author><category term="tips and tricks" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/tips+and+tricks/default.aspx" /><category term="t-sql" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/t-sql/default.aspx" /><category term="Numbers table" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/Numbers+table/default.aspx" /><category term="util" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/util/default.aspx" /><category term="script" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/script/default.aspx" /><category term="practices" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/practices/default.aspx" /><category term="programming" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/programming/default.aspx" /></entry><entry><title>Coding standards</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/03/11/coding-standards.aspx" /><id>http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/03/11/coding-standards.aspx</id><published>2010-03-11T22:07:00Z</published><updated>2010-03-11T22:07:00Z</updated><content type="html">This post will be about coding standards. There are countless articles and blog posts related to this topic, so I know this post will not be too revealing. Yet I would like to mention a few things I came across during my work with the T-SQL code. Naming convention - there are many of them obviously. Too bad if all of them are used in the same database, and sometimes even in the same stored procedure. It is not uncommon to see something like create procedure dbo . Proc1 ( @ParamId int ) as begin declare...(&lt;a href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/03/11/coding-standards.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=13259" width="1" height="1"&gt;</content><author><name>Piotr Rodak</name><uri>http://sqlblogcasts.com/members/Piotr-Rodak.aspx</uri></author><category term="tips and tricks" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/tips+and+tricks/default.aspx" /><category term="t-sql" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/t-sql/default.aspx" /><category term="source code" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/source+code/default.aspx" /><category term="script" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/script/default.aspx" /><category term="practices" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/practices/default.aspx" /><category term="programming" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/programming/default.aspx" /><category term="troubleshooting" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/troubleshooting/default.aspx" /></entry><entry><title>An internal error occurred on the report server - no disk space for database.</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/02/23/an-internal-error-occurred-on-the-report-server-no-disk-space-for-database.aspx" /><id>http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/02/23/an-internal-error-occurred-on-the-report-server-no-disk-space-for-database.aspx</id><published>2010-02-23T22:04:00Z</published><updated>2010-02-23T22:04:00Z</updated><content type="html">Last week was pretty hectic for me. I was developing SSRS report that was to be deployed to our QA, UAT and production environments. The report consists of many sections, which I had to implement as tables rather than subreports, because SSRS for SQL Server 2005 has many constraints, being unable to display dynamic headers and footers from subreports one of them. Having about 15 rather complicated tables on one design area is not a very comfortable way of work. The whole IDE is slow and tends to...(&lt;a href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/02/23/an-internal-error-occurred-on-the-report-server-no-disk-space-for-database.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=13141" width="1" height="1"&gt;</content><author><name>Piotr Rodak</name><uri>http://sqlblogcasts.com/members/Piotr-Rodak.aspx</uri></author><category term="errors" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/errors/default.aspx" /><category term="Reporting Services" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/Reporting+Services/default.aspx" /><category term="SSRS" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/SSRS/default.aspx" /><category term="error" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/error/default.aspx" /><category term="database maintenance" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/database+maintenance/default.aspx" /></entry><entry><title>Kayleigh</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/02/22/kayleigh.aspx" /><id>http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/02/22/kayleigh.aspx</id><published>2010-02-22T23:46:00Z</published><updated>2010-02-22T23:46:00Z</updated><content type="html">It&amp;#39;s been about 25 years since I&amp;#39;ve heard Misplaced Childhood or the first time in my life. There was time when I could sing the whole album along with Fish . Thankfully karaoke and youtube weren&amp;#39;t as popular in Poland in 1985 as they are now, or I could&amp;#39;ve ended up in a lip sync hit like these two chaps: http://www.youtube.com/watch?v=tMI7h78mDMA I learned a lot of english words from lyrics, sometimes to great joy of my english speaking friends. Yet I just realized today, what &amp;#39;dancing...(&lt;a href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/02/22/kayleigh.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=13125" width="1" height="1"&gt;</content><author><name>Piotr Rodak</name><uri>http://sqlblogcasts.com/members/Piotr-Rodak.aspx</uri></author><category term="revelations" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/revelations/default.aspx" /></entry><entry><title>relative query cost not accurate when using set rowcount</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/01/27/relative-query-cost-not-accurate-when-using-set-rowcount.aspx" /><id>http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/01/27/relative-query-cost-not-accurate-when-using-set-rowcount.aspx</id><published>2010-01-27T22:33:00Z</published><updated>2010-01-27T22:33:00Z</updated><content type="html">When tuning performance of a query, it is quite common to compare different variants of the query in the same batch and compare the execution plans to see if changes that you made actually work for better or not. Often you would compare just relative cost of execution plan of a query within the batch. I lived for a long time with innocent assumption that the relative cost is accurate and reliable. As Gail Shaw showed in her blog , this assumption doesn&amp;#39;t hold if you use scalar functions within...(&lt;a href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/01/27/relative-query-cost-not-accurate-when-using-set-rowcount.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=12936" width="1" height="1"&gt;</content><author><name>Piotr Rodak</name><uri>http://sqlblogcasts.com/members/Piotr-Rodak.aspx</uri></author><category term="tips and tricks" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/tips+and+tricks/default.aspx" /><category term="t-sql" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/t-sql/default.aspx" /><category term="source code" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/source+code/default.aspx" /><category term="script" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/script/default.aspx" /><category term="practices" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/practices/default.aspx" /><category term="concurrency" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/concurrency/default.aspx" /><category term="troubleshooting" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/troubleshooting/default.aspx" /></entry><entry><title>like in the old times</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/01/22/like-in-the-old-times.aspx" /><id>http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/01/22/like-in-the-old-times.aspx</id><published>2010-01-22T14:35:00Z</published><updated>2010-01-22T14:35:00Z</updated><content type="html">My little brother got recently an old 50mm Pentax-M 1:2 lens. While this lens is not known for the best image quality amongst Pentax prime 50mm lenses, it gave me first opportunity to take pictures &amp;#39;the old way&amp;#39; on my K10D. This is quite nostalgic feeling to have to focus and set aperture manually like in the old &amp;#39;80s with famous soviet camera Zenith . My brother has also some old lenses with M42 mount. I bought adapter allowing me to connect them to my camera and indeed, it works. I...(&lt;a href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/01/22/like-in-the-old-times.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=12901" width="1" height="1"&gt;</content><author><name>Piotr Rodak</name><uri>http://sqlblogcasts.com/members/Piotr-Rodak.aspx</uri></author><category term="photography" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/photography/default.aspx" /></entry><entry><title>updating column with a random value</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/01/13/updating-column-with-a-random-value.aspx" /><id>http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/01/13/updating-column-with-a-random-value.aspx</id><published>2010-01-13T21:54:00Z</published><updated>2010-01-13T21:54:00Z</updated><content type="html">I have been working recently on load testing of our ETL. One of the factors that determines amount of transfered data is a lookup table that is joined to the source. I populated this table with aproppriate values, and then realized that I also need some values in second column, and they were null. Let&amp;#39;s say the table looks like that: create table t101 ( a int , b char ( 10 ) ) go insert t101 ( a , b ) select 1 , &amp;#39;&amp;#39; union all select 2 , &amp;#39;&amp;#39; union all select 3 , &amp;#39;&amp;#39; union...(&lt;a href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/01/13/updating-column-with-a-random-value.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=12842" width="1" height="1"&gt;</content><author><name>Piotr Rodak</name><uri>http://sqlblogcasts.com/members/Piotr-Rodak.aspx</uri></author><category term="tips and tricks" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/tips+and+tricks/default.aspx" /><category term="t-sql" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/t-sql/default.aspx" /><category term="ETL" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/ETL/default.aspx" /><category term="source code" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/source+code/default.aspx" /><category term="script" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/script/default.aspx" /></entry><entry><title>updlock, holdlock and deadlocks</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/01/04/updlock-holdlock-and-deadlocks.aspx" /><id>http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/01/04/updlock-holdlock-and-deadlocks.aspx</id><published>2010-01-04T22:10:00Z</published><updated>2010-01-04T22:10:00Z</updated><content type="html">We have a process that manages sliding window over a number of tables in our reporting database. This process is triggered by first call to our reporting ETL. There is table that contains two dates that are important for the partitioning and business requirements. The table is build as the following example: if object_id ( &amp;#39;dbo.tDateTest&amp;#39; ) is not null drop table dbo . tDateTest go create table dbo . tDateTest ( FromDate datetime not null, ToDate datetime not null ) The table contains only...(&lt;a href="http://sqlblogcasts.com/blogs/piotr_rodak/archive/2010/01/04/updlock-holdlock-and-deadlocks.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=12778" width="1" height="1"&gt;</content><author><name>Piotr Rodak</name><uri>http://sqlblogcasts.com/members/Piotr-Rodak.aspx</uri></author><category term="t-sql" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/t-sql/default.aspx" /><category term="performance" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/performance/default.aspx" /><category term="trace flags" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/trace+flags/default.aspx" /><category term="deadlocks" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/deadlocks/default.aspx" /><category term="concurrency" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/concurrency/default.aspx" /><category term="troubleshooting" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/troubleshooting/default.aspx" /><category term="locking hits" scheme="http://sqlblogcasts.com/blogs/piotr_rodak/archive/tags/locking+hits/default.aspx" /></entry></feed>
