<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" version="2.0">
  <channel>
    <title>Delphi.co.za</title>
    <link>http://www.delphi.co.za/</link>
    <description>development architecture</description>
    <language>en-us</language>
    <copyright>Simon Munro</copyright>
    <lastBuildDate>Tue, 11 Jul 2006 13:24:34 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 1.8.5223.2</generator>
    <managingEditor>simon@delphi.co.za</managingEditor>
    <webMaster>simon@delphi.co.za</webMaster>
    <item>
      <trackback:ping>http://www.delphi.co.za/Trackback.aspx?guid=56a56e23-d9d5-44dd-9f0b-0f8b80d0b462</trackback:ping>
      <pingback:server>http://www.delphi.co.za/pingback.aspx</pingback:server>
      <pingback:target>http://www.delphi.co.za/PermaLink,guid,56a56e23-d9d5-44dd-9f0b-0f8b80d0b462.aspx</pingback:target>
      <dc:creator>myemail@myemail.com (Your DisplayName here!)</dc:creator>
      <wfw:comment>http://www.delphi.co.za/CommentView,guid,56a56e23-d9d5-44dd-9f0b-0f8b80d0b462.aspx</wfw:comment>
      <wfw:commentRss>http://www.delphi.co.za/SyndicationService.asmx/GetEntryCommentsRss?guid=56a56e23-d9d5-44dd-9f0b-0f8b80d0b462</wfw:commentRss>
      <title>Handling Metadata from SQL Stored procedures in Visual Studio and SSIS</title>
      <guid>http://www.delphi.co.za/PermaLink,guid,56a56e23-d9d5-44dd-9f0b-0f8b80d0b462.aspx</guid>
      <link>http://www.delphi.co.za/PermaLink,guid,56a56e23-d9d5-44dd-9f0b-0f8b80d0b462.aspx</link>
      <pubDate>Tue, 11 Jul 2006 13:24:34 GMT</pubDate>
      <description>&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;When writing
   complex sproc’s in T-SQL you can sometimes run into the problem that IDEs and other
   tools, while trying to parse the query, are unable to realise that the query actually
   works.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;This
   is because they try and interpret the query to get the metadata (the format of the
   result, rather than the result itself), rather than execute it – not such a bad thing
   since you don’t want an IDE to execute a sproc willy-nilly, which could result in
   all sorts of side effects.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;The main place
   where developers will encounter this is when trying to configure a TableAdapter (or
   something) that uses temp tables.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;Consider the
   following sproc:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font face="Times New Roman" color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;font size=1&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;CREATE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;PROCEDURE&lt;/span&gt;&lt;font color=#000000&gt; [dbo]&lt;/font&gt;&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;&lt;font color=#000000&gt;[DoSomething]&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font size=1&gt;AS&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;font size=1&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;CREATE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;TABLE&lt;/span&gt;&lt;font color=#000000&gt; #MyTable &lt;/font&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;&lt;font color=#000000&gt;Id &lt;/font&gt;&lt;span style="COLOR: blue"&gt;int&lt;/span&gt;&lt;span style="COLOR: gray"&gt;,&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;Name&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;nvarchar&lt;/span&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;&lt;font color=#000000&gt;50&lt;/font&gt;&lt;span style="COLOR: gray"&gt;))&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;font size=1&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;INSERT&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;INTO&lt;/span&gt;&lt;font color=#000000&gt; #MyTable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;font size=1&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VALUES&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;(&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;1&lt;/font&gt;&lt;span style="COLOR: gray"&gt;,&lt;/span&gt;&lt;span style="COLOR: red"&gt;'Name1'&lt;/span&gt;&lt;span style="COLOR: gray"&gt;)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;font size=1&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SELECT&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: gray"&gt;*&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;FROM&lt;/span&gt;&lt;font color=#000000&gt; #MyTable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font face="Times New Roman" color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;Executing this
   procedure via SQL renders the expected result as follows:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font face="Times New Roman" color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;(1
   row(s) affected)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;Id&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Name&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;-----------
   --------------------------------------------------&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;1&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Name1&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;(1
   row(s) affected)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;However if you
   try and create a TableAdapter in Visual Studio using the same sproc, you get an error
   that looks something like this:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font face="Times New Roman" color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /&gt;
   &lt;v:shapetype id=_x0000_t75 stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"&gt;
      &lt;v:stroke joinstyle="miter"&gt;&lt;/v:stroke&gt;
      &lt;v:formulas&gt;
         &lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;&lt;/v:f&gt;
         &lt;v:f eqn="sum @0 1 0"&gt;&lt;/v:f&gt;
         &lt;v:f eqn="sum 0 0 @1"&gt;&lt;/v:f&gt;
         &lt;v:f eqn="prod @2 1 2"&gt;&lt;/v:f&gt;
         &lt;v:f eqn="prod @3 21600 pixelWidth"&gt;&lt;/v:f&gt;
         &lt;v:f eqn="prod @3 21600 pixelHeight"&gt;&lt;/v:f&gt;
         &lt;v:f eqn="sum @0 0 1"&gt;&lt;/v:f&gt;
         &lt;v:f eqn="prod @6 1 2"&gt;&lt;/v:f&gt;
         &lt;v:f eqn="prod @7 21600 pixelWidth"&gt;&lt;/v:f&gt;
         &lt;v:f eqn="sum @8 21600 0"&gt;&lt;/v:f&gt;
         &lt;v:f eqn="prod @7 21600 pixelHeight"&gt;&lt;/v:f&gt;
         &lt;v:f eqn="sum @10 21600 0"&gt;&lt;/v:f&gt;
      &lt;/v:formulas&gt;
      &lt;v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"&gt;&lt;/v:path&gt;
      &lt;o:lock aspectratio="t" v:ext="edit"&gt;&lt;/o:lock&gt;
   &lt;/v:shapetype&gt;
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font face="Times New Roman" color=#000000 size=3&gt;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;img height=92 alt=Step1.png src="http://www.delphi.co.za/content/binary/Step1.png" width=408 border=0&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;The short solution
   is not to use temp tables, but rather table variables – which for lots of other reasons
   is arguably better.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;The altered sproc
   would then look like this:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font face="Times New Roman" color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;font size=1&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ALTER&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;PROCEDURE&lt;/span&gt;&lt;font color=#000000&gt; [dbo]&lt;/font&gt;&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;&lt;font color=#000000&gt;[DoSomething]&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font size=1&gt;AS&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;font size=1&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DECLARE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; @MyTable &lt;/font&gt;&lt;span style="COLOR: blue"&gt;table&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;&lt;font color=#000000&gt;Id &lt;/font&gt;&lt;span style="COLOR: blue"&gt;int&lt;/span&gt;&lt;span style="COLOR: gray"&gt;,&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;Name&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;nvarchar&lt;/span&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;&lt;font color=#000000&gt;50&lt;/font&gt;&lt;span style="COLOR: gray"&gt;))&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;font size=1&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;INSERT&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;INTO&lt;/span&gt;&lt;font color=#000000&gt; @MyTable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;font size=1&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VALUES&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;(&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;1&lt;/font&gt;&lt;span style="COLOR: gray"&gt;,&lt;/span&gt;&lt;span style="COLOR: red"&gt;'Name1'&lt;/span&gt;&lt;span style="COLOR: gray"&gt;)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font size=1&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;font size=1&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SELECT&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: gray"&gt;*&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;FROM&lt;/span&gt;&lt;font color=#000000&gt; @MyTable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;font color=#000000&gt;&lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;That is fine,
   but occasionally you may need to use temp tables and developers land up creating ‘permanent’
   temp tables or some other approach.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;The
   question remains, how can we force Visual Studio to ignore the metadata and actually
   execute the sproc?&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;In some cases temp
   tables may be unavoidable – particularly if you are using someone else’s sproc.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;The
   quick solution is to use the SET FMTONLY statement which when turned off would seem
   to return data as well as metadata to the client.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;The
   SQL Books say the SET FMTONLY &lt;/span&gt;&lt;span lang=EN-ZA style="FONT-SIZE: 8pt; mso-ansi-language: EN-ZA"&gt;&lt;font size=2&gt;‘&lt;/font&gt;&lt;/span&gt;&lt;font size=2&gt;&lt;span style="FONT-SIZE: 8pt; COLOR: black; FONT-FAMILY: Verdana"&gt;Returns
   only metadata to the client.’ &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;I
   am making the assumption therefore that setting it to ‘OFF’ returns something else
   as well – I suspect it is the data.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;So, to use a
   sproc that uses temp tables in Visual Studio, the sproc could be changed to:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font face="Times New Roman" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ALTER&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;PROCEDURE&lt;/span&gt;&lt;font color=#000000&gt; [dbo]&lt;/font&gt;&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;&lt;font color=#000000&gt;[DoSomething]&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;AS&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SET&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;FMTONLY&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;OFF&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;CREATE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;TABLE&lt;/span&gt;&lt;font color=#000000&gt; #MyTable &lt;/font&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;&lt;font color=#000000&gt;Id &lt;/font&gt;&lt;span style="COLOR: blue"&gt;int&lt;/span&gt;&lt;span style="COLOR: gray"&gt;,&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;Name&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;nvarchar&lt;/span&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;&lt;font color=#000000&gt;50&lt;/font&gt;&lt;span style="COLOR: gray"&gt;))&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;INSERT&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;INTO&lt;/span&gt;&lt;font color=#000000&gt; #MyTable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VALUES&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;(&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;1&lt;/font&gt;&lt;span style="COLOR: gray"&gt;,&lt;/span&gt;&lt;span style="COLOR: red"&gt;'Name1'&lt;/span&gt;&lt;span style="COLOR: gray"&gt;)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SELECT&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: gray"&gt;*&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;FROM&lt;/span&gt;&lt;font color=#000000&gt; #MyTable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font face="Times New Roman" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;… making Visual
   studio happy.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;Interestingly,
   SSIS (SQL Server Integration Services) has an additional quirk.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Firstly,
   if you use a temp table without turning FMTONLY to OFF, and write a source query of
   ‘EXEC DoSomething’ you receive an error message ‘This SQL statement is not a query’
   – SSIS doesn’t even parse your carefully constructed SQL.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;You
   know that 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;ol style="MARGIN-TOP: 0cm" type=a&gt;
   &lt;li class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt"&gt;
      &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;It works in
      the query analyser&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/span&gt; 
   &lt;li class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt"&gt;
      &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;It is a query&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/span&gt; 
   &lt;li class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt"&gt;
      &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;You are more
      intelligent than your PC, so if you know it is a query then it must be a query.&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/span&gt;
   &lt;/li&gt;
&lt;/ol&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;The best way
   to convince SSIS that the query is actually a query is to insert the SET FMTONLY OFF
   line into the sproc (without changing the source query that SSIS uses – see it was
   a query!).&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;You may think that the solution
   is the same as with Visual Studio (use table variables), but SSIS was written by some
   other development team and has a different attitude and personality.&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;If you execute
   a sproc with table variables or temp tables with FMTONLY OFF you get something like
   the following:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font face="Times New Roman" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font face="Times New Roman" color=#000000&gt;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;img height=612 alt=Step2.png src="http://www.delphi.co.za/content/binary/Step2.png" width=536 border=0&gt;&amp;nbsp;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;If you look
   carefully, the ‘Executing’ successful (is a valid query) but the ‘Pre-Execute’ fails.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;I
   tried to turn off the pre-execute as an option in the designer with no success.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;The
   quick answer is to add &lt;/font&gt;&lt;/span&gt;&lt;font face=Verdana&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SET&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;NOCOUNT&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;ON&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt; &lt;span lang=EN-ZA&gt;to
   the sproc, which for some reason lets the pre-execute run successfully.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;I
   am not sure why, the SQL Books say that NOCOUNT &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size=2&gt;&lt;span style="FONT-SIZE: 8pt; COLOR: navy; FONT-FAMILY: Arial"&gt;‘&lt;/span&gt;&lt;span style="FONT-SIZE: 8pt; COLOR: black; FONT-FAMILY: Verdana"&gt;Stops
   the message that shows the number of rows affected by a Transact-SQL statement from
   being returned as part of the results&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"&gt;’&lt;/span&gt;&lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;,
   which doesn’t seem relevant to pre-execute – but it does work.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;The
   query would then be changed to:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
   &lt;o:p&gt;
      &lt;font face="Times New Roman" color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ALTER&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;PROCEDURE&lt;/span&gt;&lt;font color=#000000&gt; [dbo]&lt;/font&gt;&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;&lt;font color=#000000&gt;[DoSomething]&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;AS&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SET&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;FMTONLY&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;OFF&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SET&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;NOCOUNT&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;ON&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;CREATE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;TABLE&lt;/span&gt;&lt;font color=#000000&gt; #MyTable &lt;/font&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;&lt;font color=#000000&gt;Id &lt;/font&gt;&lt;span style="COLOR: blue"&gt;int&lt;/span&gt;&lt;span style="COLOR: gray"&gt;,&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;Name&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;nvarchar&lt;/span&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;&lt;font color=#000000&gt;50&lt;/font&gt;&lt;span style="COLOR: gray"&gt;))&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;INSERT&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;INTO&lt;/span&gt;&lt;font color=#000000&gt; #MyTable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VALUES&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;(&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;1&lt;/font&gt;&lt;span style="COLOR: gray"&gt;,&lt;/span&gt;&lt;span style="COLOR: red"&gt;'Name1'&lt;/span&gt;&lt;span style="COLOR: gray"&gt;)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SELECT&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: gray"&gt;*&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;FROM&lt;/span&gt;&lt;font color=#000000&gt; #MyTable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;Or, if using
   table variables:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;CREATE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;PROCEDURE&lt;/span&gt;&lt;font color=#000000&gt; [dbo]&lt;/font&gt;&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;&lt;font color=#000000&gt;[DoSomething1]&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;AS&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SET&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;NOCOUNT&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;ON&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DECLARE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; @MyTable &lt;/font&gt;&lt;span style="COLOR: blue"&gt;table&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;&lt;font color=#000000&gt;Id &lt;/font&gt;&lt;span style="COLOR: blue"&gt;int&lt;/span&gt;&lt;span style="COLOR: gray"&gt;,&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;Name&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;nvarchar&lt;/span&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;&lt;font color=#000000&gt;50&lt;/font&gt;&lt;span style="COLOR: gray"&gt;))&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;INSERT&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;INTO&lt;/span&gt;&lt;font color=#000000&gt; @MyTable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;VALUES&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;(&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;1&lt;/font&gt;&lt;span style="COLOR: gray"&gt;,&lt;/span&gt;&lt;span style="COLOR: red"&gt;'Name1'&lt;/span&gt;&lt;span style="COLOR: gray"&gt;)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SELECT&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: gray"&gt;*&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;FROM&lt;/span&gt;&lt;font color=#000000&gt; @MyTable&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;
   &lt;o:p&gt;
      &lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;In summary:&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;ol style="MARGIN-TOP: 0cm" type=a&gt;
   &lt;li class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-list: l1 level1 lfo2; tab-stops: list 36.0pt"&gt;
      &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;Rather use table
      variables than temp tables&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/span&gt; 
   &lt;li class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-list: l1 level1 lfo2; tab-stops: list 36.0pt"&gt;
      &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;When using temp
      tables use &lt;/font&gt;&lt;/span&gt;&lt;font face=Verdana&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SET&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;FMTONLY&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;OFF&lt;/span&gt;&lt;/span&gt;&lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
      &lt;o:p&gt;&lt;/o:p&gt;
      &lt;/span&gt; &lt;/font&gt; 
   &lt;li class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-list: l1 level1 lfo2; tab-stops: list 36.0pt"&gt;
      &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;When using SSIS,
      use &lt;/font&gt;&lt;/span&gt;&lt;font face=Verdana&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SET
      NOCOUNT&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;ON&lt;/span&gt;&lt;/span&gt;&lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;
      &lt;o:p&gt;&lt;/o:p&gt;
      &lt;/span&gt; &lt;/font&gt; 
   &lt;li class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-list: l1 level1 lfo2; tab-stops: list 36.0pt"&gt;
      &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;If SSIS says
      your query is not a query it may be trying to fool you.&lt;/font&gt;&lt;/span&gt;
   &lt;/li&gt;
&lt;/ol&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-list: l1 level1 lfo2; tab-stops: list 36.0pt"&gt;
   &lt;span lang=EN-ZA style="mso-ansi-language: EN-ZA"&gt;&lt;font color=#000000&gt;Simon Munro&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http://www.delphi.co.za/PermaLink,guid,56a56e23-d9d5-44dd-9f0b-0f8b80d0b462.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.delphi.co.za/PermaLink,guid,56a56e23-d9d5-44dd-9f0b-0f8b80d0b462.aspx" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt; &lt;img width="0" height="0" src="http://www.delphi.co.za/aggbug.ashx?id=56a56e23-d9d5-44dd-9f0b-0f8b80d0b462" /&gt;</description>
      <comments>http://www.delphi.co.za/CommentView,guid,56a56e23-d9d5-44dd-9f0b-0f8b80d0b462.aspx</comments>
      <category>Database</category>
    </item>
    <item>
      <trackback:ping>http://www.delphi.co.za/Trackback.aspx?guid=c8ed3581-6569-42c0-acf6-2628c4be7a0d</trackback:ping>
      <pingback:server>http://www.delphi.co.za/pingback.aspx</pingback:server>
      <pingback:target>http://www.delphi.co.za/PermaLink,guid,c8ed3581-6569-42c0-acf6-2628c4be7a0d.aspx</pingback:target>
      <dc:creator>myemail@myemail.com (Your DisplayName here!)</dc:creator>
      <wfw:comment>http://www.delphi.co.za/CommentView,guid,c8ed3581-6569-42c0-acf6-2628c4be7a0d.aspx</wfw:comment>
      <wfw:commentRss>http://www.delphi.co.za/SyndicationService.asmx/GetEntryCommentsRss?guid=c8ed3581-6569-42c0-acf6-2628c4be7a0d</wfw:commentRss>
      <title>My favourite SQL 2005 new feature</title>
      <guid>http://www.delphi.co.za/PermaLink,guid,c8ed3581-6569-42c0-acf6-2628c4be7a0d.aspx</guid>
      <link>http://www.delphi.co.za/PermaLink,guid,c8ed3581-6569-42c0-acf6-2628c4be7a0d.aspx</link>
      <pubDate>Wed, 22 Mar 2006 10:45:49 GMT</pubDate>
      <description>&lt;p&gt;
   &lt;font color=#000000&gt;I have been looking at parts of SQL Server 2005 since the June
   CTP and been implementing SQL 2005 in production and development environments since
   December last year.&amp;nbsp; The difference between investigating the features and doing
   an implementation is that in an actual implementation you use the most practical and
   useful features, rather than the cool features that you may use one day in some future
   architecture.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;font color=#000000&gt;SQL Server Reporting services is cool and useful - but is a separate
   bundled package - so I consider it a new product, not a new feature.&amp;nbsp; Similarly
   with SQL Server Integration Services - a great step in the direction of visual programming
   and DSL's (Domain Specific Languages).&amp;nbsp; Other features are intriguing and I intend
   to put them to use on some future architecture; the Service Broker, Database Mirroring
   and CLR Integration are some of the features that pique my interest.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;font color=#000000&gt;Currently there are two things that I used immediately and so
   extensively that I almost can’t imagine what it was like developing for SQL Server
   a few months ago – those two are Schemas and Error Handling.&amp;nbsp; I would have to
   say that the addition of try-catch block has made the biggest difference.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;font color=#000000&gt;T-SQL is often viewed as a second-rate language compared to C#,
   Java or other modern (or at least Object Oriented) languages.&amp;nbsp; However the set-based
   bias of T-SQL has always meant that a lot of functionality can be developed in stored
   procedures – some would argue too much.&amp;nbsp; The addition of the try-catch block
   brings T-SQL closer to being a more elegant and usable language.&amp;nbsp; Handling errors,
   particularly within the scope of transactions was difficult and cumbersome prior to
   SQL2005 – the need to inspect @@ERROR after every statement meant that the code was
   either riddled with too many error checks and conditional statements to exit elegantly
   or had insufficient error handling that would leave data in an inconsistent state.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;font color=#000000&gt;Although not necessarily a candidate for a ‘best practice’ award,
   I have a chunk of boilerplate code that I put in virtually every stored procedure
   – allowing me to handle errors gracefully and to roll back transactions.&amp;nbsp; This
   code even reports the exact line number that an error occurred (including errors that
   occur in triggers or nested stored procedures)&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;BEGIN&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;TRANSACTION&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;BEGIN&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;TRY&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt;&amp;nbsp; &lt;/font&gt;&lt;span style="COLOR: green"&gt;--
   Do stuff&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;END&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;TRY&lt;/span&gt;&lt;font color=#000000&gt; 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;BEGIN&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;CATCH&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt;&amp;nbsp; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;IF&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: fuchsia"&gt;@@TRANCOUNT&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: gray"&gt;&amp;gt;&lt;/span&gt;&lt;font color=#000000&gt; 0&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;ROLLBACK&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;TRANSACTION&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt;&amp;nbsp; 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt;&amp;nbsp; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;DECLARE&lt;/span&gt;&lt;font color=#000000&gt; @ErrorMessage &lt;/font&gt;&lt;span style="COLOR: blue"&gt;nvarchar&lt;/span&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;&lt;font color=#000000&gt;4000&lt;/font&gt;&lt;span style="COLOR: gray"&gt;)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt;&amp;nbsp; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;DECLARE&lt;/span&gt;&lt;font color=#000000&gt; @ErrorSeverity &lt;/font&gt;&lt;span style="COLOR: blue"&gt;int&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt;&amp;nbsp; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;DECLARE&lt;/span&gt;&lt;font color=#000000&gt; @ErrorState &lt;/font&gt;&lt;span style="COLOR: blue"&gt;int&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;
   &lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt;&amp;nbsp; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;SELECT&lt;/span&gt;&lt;font color=#000000&gt; 
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   @ErrorMessage &lt;/font&gt;&lt;span style="COLOR: gray"&gt;=&lt;/span&gt;&lt;font color=#000000&gt; N&lt;/font&gt;&lt;span style="COLOR: red"&gt;'Error
   in '&lt;/span&gt;&lt;span style="COLOR: gray"&gt;+&lt;/span&gt;&lt;font color=#000000&gt;ERROR_PROCEDURE&lt;/font&gt;&lt;span style="COLOR: gray"&gt;()+&lt;/span&gt;&lt;font color=#000000&gt;N&lt;/font&gt;&lt;span style="COLOR: red"&gt;'
   (Line '&lt;/span&gt;&lt;span style="COLOR: gray"&gt;+&lt;/span&gt;&lt;span style="COLOR: fuchsia"&gt;CAST&lt;/span&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;&lt;font color=#000000&gt;ERROR_LINE&lt;/font&gt;&lt;span style="COLOR: gray"&gt;()&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;AS&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;nvarchar&lt;/span&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;&lt;font color=#000000&gt;20&lt;/font&gt;&lt;span style="COLOR: gray"&gt;))+&lt;/span&gt;&lt;font color=#000000&gt;N&lt;/font&gt;&lt;span style="COLOR: red"&gt;')
   : '&lt;/span&gt;&lt;span style="COLOR: gray"&gt;+&lt;/span&gt;&lt;font color=#000000&gt;ERROR_MESSAGE&lt;/font&gt;&lt;span style="COLOR: gray"&gt;(),&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   @ErrorSeverity &lt;/font&gt;&lt;span style="COLOR: gray"&gt;=&lt;/span&gt;&lt;font color=#000000&gt; 1&lt;/font&gt;&lt;span style="COLOR: gray"&gt;,&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   @ErrorState &lt;/font&gt;&lt;span style="COLOR: gray"&gt;=&lt;/span&gt;&lt;font color=#000000&gt; ERROR_STATE&lt;/font&gt;&lt;span style="COLOR: gray"&gt;()&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'"&gt;
   &lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt;&amp;nbsp; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;RAISERROR&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;&lt;font color=#000000&gt;@ErrorMessage&lt;/font&gt;&lt;span style="COLOR: gray"&gt;,&lt;/span&gt;&lt;font color=#000000&gt; @ErrorSeverity&lt;/font&gt;&lt;span style="COLOR: gray"&gt;,&lt;/span&gt;&lt;font color=#000000&gt; @ErrorState&lt;/font&gt;&lt;span style="COLOR: gray"&gt;)&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;END&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;CATCH&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;IF&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: fuchsia"&gt;@@TRANCOUNT&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: gray"&gt;&amp;gt;&lt;/span&gt;&lt;font color=#000000&gt; 0&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
   &lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;font color=#000000&gt;&amp;nbsp; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;COMMIT&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;TRANSACTION&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;
   &lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;
   &lt;font color=#000000&gt;It may not look like much and there are far more sophisticated
   uses of exception handling, but putting the above code into your stored procedures
   will increase the quality of your code and the integrity of your database by orders
   of magnitude for virtually no effort.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;font color=#000000&gt;Simon Munro&lt;/font&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.delphi.co.za/aggbug.ashx?id=c8ed3581-6569-42c0-acf6-2628c4be7a0d" /&gt;</description>
      <comments>http://www.delphi.co.za/CommentView,guid,c8ed3581-6569-42c0-acf6-2628c4be7a0d.aspx</comments>
      <category>Database</category>
    </item>
    <item>
      <trackback:ping>http://www.delphi.co.za/Trackback.aspx?guid=a2136f69-99ce-415e-9c20-739132a3ac1b</trackback:ping>
      <pingback:server>http://www.delphi.co.za/pingback.aspx</pingback:server>
      <pingback:target>http://www.delphi.co.za/PermaLink,guid,a2136f69-99ce-415e-9c20-739132a3ac1b.aspx</pingback:target>
      <dc:creator>myemail@myemail.com (Your DisplayName here!)</dc:creator>
      <wfw:comment>http://www.delphi.co.za/CommentView,guid,a2136f69-99ce-415e-9c20-739132a3ac1b.aspx</wfw:comment>
      <wfw:commentRss>http://www.delphi.co.za/SyndicationService.asmx/GetEntryCommentsRss?guid=a2136f69-99ce-415e-9c20-739132a3ac1b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p>
          <font color="#000000">Virtually every architect has wrestled with problem of where
      to put ‘Business Logic’ and as technology changes and matures I doubt there will ever
      be a correct answer.  The rules stating that ‘business logic’ should always go
      here or there are stated by people who would only be able to depict application architecture
      with a set of crayons and a colouring-in book.   I have seen applications
      where none of the 'business logic' is in the database and a whole lot of wrapper classes
      do everything that a database would do (such as enforce foreign key constraints) -
      to the other extreme where virtually the entire application is developed in the database. 
      As with everything in software architecture, you need to weigh the pros and cons that
      are specific to your application.  So some pointers:</font>
        </p>
        <ul>
          <li>
            <font color="#000000">Define what you mean by 'Business Logic' - this means many different
         things to different people and it is a good idea to establish some sort of baseline. 
         One could argue that tables in the database, by virtue of the fact that they represent
         business semantics, are in fact business logic.  Generally 'Business Logic' refers
         to some sort of procedural programming, but you would be well advised to define, agree
         and document what functions your business logic performs.  You will probably
         find that 'business logic' spans all layers and technologies - you have to understand
         what type of business logic goes where.</font>
          </li>
          <li>
            <font color="#000000">RDBMS's do perform some 'business logic' incredibly fast and
         it would be pointless to try and 'roll your own' mechanism in another layer. 
         Things that are best left to the database include enforcing referential integrity,
         ensuring primary keys are unique etc.</font>
          </li>
          <li>
            <font color="#000000">Most native database languages (by this I refer to PL/SQL &amp;
         T-SQL - not Java or .NET in the database) execute extremely fast and almost always
         faster than an external language.  There are some cases that you can see a performance
         benefit in external applications, but this is usually for bulk operations where plenty
         memory is available - where you can suck lots of data out, work with it in memory
         and dump records into the database in one go.  As a .NET or Java developer, you
         will almost always lose an argument if performance is an issue.</font>
          </li>
          <li>
            <font color="#000000">Database vendors are trying to turn their databases into application
         servers and referring to 'the Oracle database' actually refers to more than just the
         RDBMS.  SQL2005 has a 'Database Engine' (the RDBMS) as well as 'Reporting Services',
         'Integration Services' etc. which, although bundled with the database are not really
         part of the RDBMS.  So when assessing the 'extended' functionality that is offered
         such as providing 'Business Object Services' out of the database, think carefully
         that this is not the core of the database and the suitability of the database platform
         for providing the architectural framework needs to be assessed as if it was any other
         (non-database) technology.  My favourite example is a database 'feature' of being
         able to send email from within database stored procedures; not RDBMS functionality
         at all!  Obviously database vendors want to sell more product and create tie-in
         to their platform, particularly Oracle who uses the well establish RDBMS brand to
         punt the rest of their products - be wary of database vendor marketing material.</font>
          </li>
          <li>
            <font color="#000000">On the newer database platforms you can run Java or .NET code
         that is executed by the database.  This is useful in some cases but mostly it
         is unnecessary because the native languages a frikkin' fast by comparison as the engine
         has been coded up over the years with them in mind, and the set-based paradigm that
         we are used to in database languages doesn't translate all that well with more object
         oriented constructs.  Mostly you would use this for accessing some external functionality. 
         Also, the database has less control over these types of applications and badly coded
         .NET or Java on the database server can bring it to its knees.  In SQL2005 the
         CLR actually runs inside the SQL memory space and processes and is managed by the
         database engine - allowing the database itself to prioritise, allocate memory or even
         kill rogue tasks in order to satisfy the real RDBMS operations that are being performed. 
         I know that Oracle9i spawned off JVM's that were in control of the OS, not the database
         - I don't know if this has changed in 10g.</font>
          </li>
          <li>
            <font color="#000000">Lastly - make sure that you are consistent in where you put
         business logic.  Often the biggest problem is that in one module a type of business
         logic is in one place and in and in another module it is elsewhere making it difficult
         to maintain, debug and migrate.  Wherever you decide to put the business logic
         (or parts of it), make sure that it is consistent across the project.</font>
          </li>
        </ul>
        <p>
          <font color="#000000">This question has been around for a long time and will there
      will never be an answer that applies across the board.  Like everything in systems
      architecture, you have to look at the specifics of your project to come up with the
      best approach.</font>
        </p>
        <p>
          <font color="#000000">Simon Munro</font>
        </p>
        <p>
          <font color="#000000">
          </font> 
   </p>
        <p>
          <font color="#000000"> 
      </font>
        </p>
        <img width="0" height="0" src="http://www.delphi.co.za/aggbug.ashx?id=a2136f69-99ce-415e-9c20-739132a3ac1b" />
      </body>
      <title>Do I put Business Logic in the database?</title>
      <guid>http://www.delphi.co.za/PermaLink,guid,a2136f69-99ce-415e-9c20-739132a3ac1b.aspx</guid>
      <link>http://www.delphi.co.za/PermaLink,guid,a2136f69-99ce-415e-9c20-739132a3ac1b.aspx</link>
      <pubDate>Wed, 08 Mar 2006 10:59:53 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;font color=#000000&gt;Virtually every architect has wrestled with problem of where to
   put ‘Business Logic’ and as technology changes and matures I doubt there will ever
   be a correct answer.&amp;nbsp; The rules stating that ‘business logic’ should always go
   here or there are stated by people who would only be able to depict application architecture
   with a set of crayons and a colouring-in book.&amp;nbsp;&amp;nbsp; I have seen applications
   where none of the 'business logic' is in the database and a whole lot of wrapper classes
   do everything that a database would do (such as enforce foreign key constraints) -
   to the other extreme where virtually the entire application is developed in the database.&amp;nbsp;
   As with everything in software architecture, you need to weigh the pros and cons that
   are specific to your application.&amp;nbsp; So some pointers:&lt;/font&gt;
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      &lt;font color=#000000&gt;Define what you mean by 'Business Logic' - this means many different
      things to different people and it is a good idea to establish some sort of baseline.&amp;nbsp;
      One could argue that tables in the database, by virtue of the fact that they represent
      business semantics, are in fact business logic.&amp;nbsp; Generally 'Business Logic' refers
      to some sort of procedural programming, but you would be well advised to define, agree
      and document what functions your business logic performs.&amp;nbsp; You will probably
      find that 'business logic' spans all layers and technologies - you have to understand
      what type of business logic goes where.&lt;/font&gt; 
   &lt;li&gt;
      &lt;font color=#000000&gt;RDBMS's do perform some 'business logic' incredibly fast and it
      would be pointless to try and 'roll your own' mechanism in another layer.&amp;nbsp; Things
      that are best left to the database include enforcing referential integrity, ensuring
      primary keys are unique etc.&lt;/font&gt; 
   &lt;li&gt;
      &lt;font color=#000000&gt;Most native database languages (by this I refer to PL/SQL &amp;amp;
      T-SQL - not Java or .NET in the database) execute extremely fast and almost always
      faster than an external language.&amp;nbsp; There are some cases that you can see a performance
      benefit in external applications, but this is usually for bulk operations where plenty
      memory is available - where you can suck lots of data out, work with it in memory
      and dump records into the database in one go.&amp;nbsp; As a .NET or Java developer, you
      will almost always lose an argument if performance is an issue.&lt;/font&gt; 
   &lt;li&gt;
      &lt;font color=#000000&gt;Database vendors are trying to turn their databases into application
      servers and referring to 'the Oracle database' actually refers to more than just the
      RDBMS.&amp;nbsp; SQL2005 has a 'Database Engine' (the RDBMS) as well as 'Reporting Services',
      'Integration Services' etc. which, although bundled with the database are not really
      part of the RDBMS.&amp;nbsp; So when assessing the 'extended' functionality that is offered
      such as providing 'Business Object Services' out of the database, think carefully
      that this is not the core of the database and the suitability of the database platform
      for providing the architectural framework needs to be assessed as if it was any other
      (non-database) technology.&amp;nbsp; My favourite example is a database 'feature' of being
      able to send email from within database stored procedures; not RDBMS functionality
      at all!&amp;nbsp; Obviously database vendors want to sell more product and create tie-in
      to their platform, particularly Oracle who uses the well establish RDBMS brand to
      punt the rest of their products - be wary of database vendor marketing material.&lt;/font&gt; 
   &lt;li&gt;
      &lt;font color=#000000&gt;On the newer database platforms you can run Java or .NET code
      that is executed by the database.&amp;nbsp; This is useful in some cases but mostly it
      is unnecessary because the native languages a frikkin' fast by comparison as the engine
      has been coded up over the years with them in mind, and the set-based paradigm that
      we are used to in database languages doesn't translate all that well with more object
      oriented constructs.&amp;nbsp; Mostly you would use this for accessing some external functionality.&amp;nbsp;
      Also, the database has less control over these types of applications and badly coded
      .NET or Java on the database server can bring it to its knees.&amp;nbsp; In SQL2005 the
      CLR actually runs inside the SQL memory space and processes and is managed by the
      database engine - allowing the database itself to prioritise, allocate memory or even
      kill rogue tasks in order to satisfy the real RDBMS operations that are being performed.&amp;nbsp;
      I know that Oracle9i spawned off JVM's that were in control of the OS, not the database
      - I don't know if this has changed in 10g.&lt;/font&gt; 
   &lt;li&gt;
      &lt;font color=#000000&gt;Lastly - make sure that you are consistent in where you put business
      logic.&amp;nbsp; Often the biggest problem is that in one module a type of business logic
      is in one place and in and in another module it is elsewhere making it difficult to
      maintain, debug and migrate.&amp;nbsp; Wherever you decide to put the business logic (or
      parts of it), make sure that it is consistent across the project.&lt;/font&gt;
   &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   &lt;font color=#000000&gt;This question has been around for a long time and will there will
   never be an answer that applies across the board.&amp;nbsp; Like everything in systems
   architecture, you have to look at the specifics of your project to come up with the
   best approach.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;font color=#000000&gt;Simon Munro&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;font color=#000000&gt;&lt;/font&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
   &lt;font color=#000000&gt;&amp;nbsp;
&lt;/p&gt;
&gt;&lt;img width="0" height="0" src="http://www.delphi.co.za/aggbug.ashx?id=a2136f69-99ce-415e-9c20-739132a3ac1b" /&gt;</description>
      <comments>http://www.delphi.co.za/CommentView,guid,a2136f69-99ce-415e-9c20-739132a3ac1b.aspx</comments>
      <category>Database</category>
    </item>
  </channel>
</rss>