<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Test Driven Developer - SQL</title>
    <link>http://testdrivendeveloper.com/</link>
    <description>You got a TEST for that?</description>
    <language>en-us</language>
    <copyright>John E. Boal</copyright>
    <lastBuildDate>Wed, 06 May 2009 17:00:43 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.1.8102.813</generator>
    <managingEditor>web_master1@TestDrivenDeveloper.com</managingEditor>
    <webMaster>web_master1@TestDrivenDeveloper.com</webMaster>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=9f5eeb1e-b674-4ae6-abd5-8073de4e03df</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,9f5eeb1e-b674-4ae6-abd5-8073de4e03df.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,9f5eeb1e-b674-4ae6-abd5-8073de4e03df.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=9f5eeb1e-b674-4ae6-abd5-8073de4e03df</wfw:commentRss>
      <title>SQL Server Queues PRINT output</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,9f5eeb1e-b674-4ae6-abd5-8073de4e03df.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2009/05/06/SQLServerQueuesPRINTOutput.aspx</link>
      <pubDate>Wed, 06 May 2009 17:00:43 GMT</pubDate>
      <description>&lt;div&gt;Ideally, SQL queries are executed really fast (sub-second). However there are times when it takes many seconds, even many minutes to execute each step. We have traditionally used the PRINT statement in SQL to output trace type information to the console so we can see what's happening.&lt;br&gt;&lt;br&gt;Recently I noticed that the PRINT statement output wasn't coming out when I expected it should. In doing some research on the issue, I discovered that the PRINT statement output is queued and batched rather than real-time.&lt;br&gt;&lt;br&gt;The solution for this problem is to use the RAISEERROR statement instead. Here is an example:&lt;br&gt;&lt;br&gt;DECLARE @msg NVARCHAR(MAX) = 'status message'&lt;br&gt;RAISERROR (@msg, 0, 1) WITH NOWAIT&lt;br&gt;&lt;br&gt;The severity of 0 tells SQL that everything is still fine, and NOWAIT instruction tells SQL not to queue it but to output immediately. The 1 is a locator that can be used to tell someone where to find the source of a particular message, if they are kept unique throughout the code.&lt;br&gt;&lt;br&gt;So, for long-running queries, use RAISEERROR and get those status messages out in real-time!&lt;br&gt;&lt;p&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=9f5eeb1e-b674-4ae6-abd5-8073de4e03df"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,9f5eeb1e-b674-4ae6-abd5-8073de4e03df.aspx</comments>
      <category>SQL</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=e36a37f3-53c9-460d-8042-ee50090f0ad0</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,e36a37f3-53c9-460d-8042-ee50090f0ad0.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,e36a37f3-53c9-460d-8042-ee50090f0ad0.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=e36a37f3-53c9-460d-8042-ee50090f0ad0</wfw:commentRss>
      <title>Unit Testing and Test Driven Development - a Practical Guide</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,e36a37f3-53c9-460d-8042-ee50090f0ad0.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/11/15/UnitTestingAndTestDrivenDevelopmentAPracticalGuide.aspx</link>
      <pubDate>Sat, 15 Nov 2008 21:08:59 GMT</pubDate>
      <description>&lt;div&gt;Here is a presentation I wrote on what Unit Testing is all about, and how TDD fits into the ATDD cycle.&lt;br&gt;&lt;br&gt;There are specific things here on testing the UI code with Selenium and JSUnit, and recommendations on how to do unit testing on your database code.&lt;br&gt;&lt;br&gt;This presentation is in PDF format, but I can post the PPTX format also if needed.&lt;br&gt;&lt;p&gt;&lt;/p&gt;&lt;a href="http://testdrivendeveloper.com/content/binary/A%20Practical%20Guide%20to%20Unit%20Testing1.pdf"&gt;A Practical Guide to Unit Testing1.pdf (503.29 KB)&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=e36a37f3-53c9-460d-8042-ee50090f0ad0"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,e36a37f3-53c9-460d-8042-ee50090f0ad0.aspx</comments>
      <category>ATDD</category>
      <category>Mocks</category>
      <category>Refactoring</category>
      <category>Selenium</category>
      <category>TDD</category>
      <category>Testing</category>
      <category>Unit Tests</category>
      <category>SQL</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=43b275ad-d66d-4544-b378-822d75adfe9e</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,43b275ad-d66d-4544-b378-822d75adfe9e.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,43b275ad-d66d-4544-b378-822d75adfe9e.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=43b275ad-d66d-4544-b378-822d75adfe9e</wfw:commentRss>
      <title>Testing SQL Tables</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,43b275ad-d66d-4544-b378-822d75adfe9e.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/01/14/TestingSQLTables.aspx</link>
      <pubDate>Mon, 14 Jan 2008 16:15:53 GMT</pubDate>
      <description>&lt;div&gt;&lt;div&gt;Have you ever wanted to test a table in the database for the correct structure? Ever had someone make a column nullable that shouldn't have been? ever have someone make a column VARCHAR instead of NVARCHAR? INT instead of BIGINT? SMALLDATETIME instead of DATETIME? This is an easy way for bugs to creep in - when the code is written for one version of the database and then someone makes a change... So if you haven't been testing your tables (SQL&amp;nbsp;should be TDD'd too), perhaps you should...&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Here is a handy stored procedure you could use that describes a table in an easy-to-test way.&lt;/div&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;/font&gt;&lt;div&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/div&gt;


&lt;div&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font face="Courier New"&gt;CREATE &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;PROCEDURE&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; describe &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#808080" size="2"&gt;(&lt;/font&gt;&lt;font size="2"&gt;@table_name &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;varchar&lt;/font&gt;&lt;font color="#808080" size="2"&gt;(&lt;/font&gt;&lt;font size="2"&gt;90&lt;/font&gt;&lt;font color="#808080" size="2"&gt;))&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/div&gt;

&lt;div&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font face="Courier New"&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font face="Courier New"&gt;SELECT &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;DISTINCT&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/div&gt;

&lt;div&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&amp;nbsp; sc&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;font size="2"&gt;column_id &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;as&lt;/font&gt;&lt;font size="2"&gt; ColumnNumber&lt;/font&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/div&gt;

&lt;div&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&amp;nbsp; cols&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;font size="2"&gt;column_name &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;as&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Name&lt;/font&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/div&gt;

&lt;div&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&amp;nbsp; cols&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;font size="2"&gt;data_type &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;as&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Type&lt;/font&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;br&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#ff00ff" size="2"&gt;&amp;nbsp; ISNULL&lt;/font&gt;&lt;font color="#808080" size="2"&gt;(&lt;/font&gt;&lt;font size="2"&gt;cols&lt;/font&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;font size="2"&gt;character_maximum_length&lt;/font&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;font size="2"&gt; 0&lt;/font&gt;&lt;font color="#808080" size="2"&gt;)&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;as&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Length&lt;/font&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/div&gt;

&lt;div&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&amp;nbsp; cols&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;font size="2"&gt;is_nullable &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;as&lt;/font&gt;&lt;font size="2"&gt; Nullable&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2" face="Courier New"&gt; &lt;/font&gt;&lt;/div&gt;

&lt;div&gt;&lt;font color="#0000ff" size="2" face="Courier New"&gt;FROM&lt;/font&gt;&lt;/div&gt;
&lt;p&gt;&lt;font color="#008000" size="2" face="Courier New"&gt;&amp;nbsp; information_schema.columns&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;&lt;font face="Courier New"&gt; cols&lt;/font&gt;&lt;font face="Times New Roman"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#808080" size="2"&gt;&lt;br&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New"&gt;&lt;font color="#808080" size="2"&gt;&amp;nbsp; INNER&lt;/font&gt;&lt;font color="#000000" size="2"&gt; &lt;/font&gt;&lt;font color="#808080" size="2"&gt;JOIN&lt;/font&gt;&lt;font color="#000000" size="2"&gt; &lt;/font&gt;&lt;font color="#008000" size="2"&gt;sys.columns&lt;/font&gt;&lt;font color="#000000" size="2"&gt; sc &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;ON&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;br&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cols&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;font size="2"&gt;column_name &lt;/font&gt;&lt;font color="#808080" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt; sc&lt;/font&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;font size="2"&gt;name&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#808080" size="2"&gt;AND&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff00ff" size="2"&gt;OBJECT_NAME&lt;/font&gt;&lt;font color="#808080" size="2"&gt;(&lt;/font&gt;&lt;font size="2"&gt;sc&lt;/font&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;font color="#ff00ff" size="2"&gt;object_id&lt;/font&gt;&lt;font color="#808080" size="2"&gt;)&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#808080" size="2"&gt;=&lt;/font&gt;&lt;font size="2"&gt; @table_name&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/p&gt;


&lt;div&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font face="Courier New"&gt;ORDER &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;BY&lt;/font&gt;&lt;font color="#000000" size="2"&gt; sc&lt;/font&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;column_id&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#000000" size="3"&gt; &lt;/font&gt;&lt;/div&gt;

&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Just call it with the table name and&amp;nbsp;it produces a nice format the tests can use to extract the info they need to check.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;font face="Courier New"&gt;# Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Length Nullable&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Courier New"&gt;1 Id&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NO&lt;br&gt;2&amp;nbsp;TypeId&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NO&lt;br&gt;3&amp;nbsp;Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nvarchar&amp;nbsp;50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NO&lt;br&gt;4&amp;nbsp;Description&amp;nbsp; nvarchar&amp;nbsp;1500&amp;nbsp;&amp;nbsp; NO&lt;br&gt;5&amp;nbsp;CreateDate&amp;nbsp;&amp;nbsp; datetime&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NO&lt;br&gt;6&amp;nbsp;UpdateDate&amp;nbsp;&amp;nbsp; datetime&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; YES&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="3" face="Times New Roman"&gt;just employ a data reader to read the data in the test, and your unit tests&amp;nbsp;can ensure that all of the tables have the right structure.&lt;/font&gt;&lt;/div&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=43b275ad-d66d-4544-b378-822d75adfe9e"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,43b275ad-d66d-4544-b378-822d75adfe9e.aspx</comments>
      <category>SQL</category>
      <category>Tools</category>
      <category>Unit Tests</category>
    </item>
  </channel>
</rss>