<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>hibbins.com &#187; Code</title>
	<atom:link href="http://www.hibbins.com/category/softwaredevelopment/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hibbins.com</link>
	<description>Software Development: C#, SQL Server, .NET, Analysis Services, Reporting Services, Intergration Services, OLAP, PHP, HTML, XML, CSS, Java, Javascript and anything else technical, complex and hibbins.com</description>
	<lastBuildDate>Thu, 15 Apr 2010 02:02:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>T-SQL Date Only Function</title>
		<link>http://www.hibbins.com/2009/11/24/t-sql-date-only-function/</link>
		<comments>http://www.hibbins.com/2009/11/24/t-sql-date-only-function/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 07:00:38 +0000</pubDate>
		<dc:creator>Jon Hibbins</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MSSQL2005]]></category>
		<category><![CDATA[MSSQL2008]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[TSQL]]></category>

		<guid isPermaLink="false">http://www.hibbins.com/?p=243</guid>
		<description><![CDATA[
CREATE FUNCTION &#91;dbo&#93;.&#91;DateOnly&#93; &#40;@Date DATETIME&#41;
RETURNS DATETIME
BEGIN
    RETURN DATEADD&#40;d, DATEDIFF&#40;d, 0, @Date&#41;, 0&#41;
END


  addthis_url    = 'http%3A%2F%2Fwww.hibbins.com%2F2009%2F11%2F24%2Ft-sql-date-only-function%2F';
  addthis_title  = 'T-SQL+Date+Only+Function';
  addthis_pub    = 'JHibbins';

]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">FUNCTION</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>DateOnly<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#40;</span>@Date DATETIME<span style="color: #66cc66;">&#41;</span>
RETURNS DATETIME
BEGIN
    <span style="color: #993333; font-weight: bold;">RETURN</span> DATEADD<span style="color: #66cc66;">&#40;</span>d<span style="color: #66cc66;">,</span> DATEDIFF<span style="color: #66cc66;">&#40;</span>d<span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span> @Date<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
END</pre></div></div>

<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.hibbins.com%2F2009%2F11%2F24%2Ft-sql-date-only-function%2F';
  addthis_title  = 'T-SQL+Date+Only+Function';
  addthis_pub    = 'JHibbins';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.hibbins.com/2009/11/24/t-sql-date-only-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TSQL Last Day Of The Month</title>
		<link>http://www.hibbins.com/2009/11/23/tsql-last-day-of-the-month/</link>
		<comments>http://www.hibbins.com/2009/11/23/tsql-last-day-of-the-month/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 11:43:45 +0000</pubDate>
		<dc:creator>Jon Hibbins</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[MSSQL2005]]></category>
		<category><![CDATA[MSSQL2008]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[TSQL]]></category>

		<guid isPermaLink="false">http://www.hibbins.com/?p=230</guid>
		<description><![CDATA[
CREATE FUNCTION &#91;dbo&#93;.&#91;LastDayOfTheMonth&#93; &#40;@Date DATETIME &#41;
RETURNS DATETIME
BEGIN
    RETURN dateadd&#40;ms, -3, DATEADD&#40;mm, DATEDIFF&#40;m, 0, @Date&#41; + 1, 0&#41;&#41;
END


  addthis_url    = 'http%3A%2F%2Fwww.hibbins.com%2F2009%2F11%2F23%2Ftsql-last-day-of-the-month%2F';
  addthis_title  = 'TSQL+Last+Day+Of+The+Month';
  addthis_pub    = 'JHibbins';

]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">FUNCTION</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>LastDayOfTheMonth<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#40;</span>@Date DATETIME <span style="color: #66cc66;">&#41;</span>
RETURNS DATETIME
BEGIN
    <span style="color: #993333; font-weight: bold;">RETURN</span> dateadd<span style="color: #66cc66;">&#40;</span>ms<span style="color: #66cc66;">,</span> <span style="color: #66cc66;">-</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">,</span> DATEADD<span style="color: #66cc66;">&#40;</span>mm<span style="color: #66cc66;">,</span> DATEDIFF<span style="color: #66cc66;">&#40;</span>m<span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span> @Date<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
END</pre></div></div>

<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.hibbins.com%2F2009%2F11%2F23%2Ftsql-last-day-of-the-month%2F';
  addthis_title  = 'TSQL+Last+Day+Of+The+Month';
  addthis_pub    = 'JHibbins';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.hibbins.com/2009/11/23/tsql-last-day-of-the-month/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Server CE on OSX 10.6 Snow Leopard</title>
		<link>http://www.hibbins.com/2009/10/18/zend-server-ce-on-osx-10-6-snow-leopard/</link>
		<comments>http://www.hibbins.com/2009/10/18/zend-server-ce-on-osx-10-6-snow-leopard/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 11:36:08 +0000</pubDate>
		<dc:creator>Jon Hibbins</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[10.6]]></category>
		<category><![CDATA[CE]]></category>
		<category><![CDATA[Comunity Edition]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Snow Leopard]]></category>
		<category><![CDATA[Watchdog]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://www.hibbins.com/?p=225</guid>
		<description><![CDATA[When I installed Zend Server CE on OSX 10.6 Snow Leopard the admin interface failed, the following fixed the issue :
1. Download this: Watchdog update
2. Backup watchdog with the command
sudo mv /usr/local/zend/bin/watchdog /usr/local/zend/bin/watchdogOLD
3. Extract the new watchdog to /usr/local/zend/bin/ (I used the go to folder in finder, if you can view hidden files)
4. Run the [...]]]></description>
			<content:encoded><![CDATA[<p>When I installed Zend Server CE on OSX 10.6 Snow Leopard the admin interface failed, the following fixed the issue :</p>
<p>1. Download this: <a title=" downloaded 93 times" href="http://www.cobbweb.me/downloads/files/watchdog.tar.gz">Watchdog update</a></p>
<p>2. Backup watchdog with the command</p>
<pre style="font-family: monospace;"><span style="color: #ff00ff;"><span style="font-weight: bold;">sudo</span> <span style="font-weight: bold;">mv</span></span> <span style="color: #336633; font-weight: bold;">/</span>usr<span style="color: #336633; font-weight: bold;">/</span>local<span style="color: #336633; font-weight: bold;">/</span>zend<span style="color: #336633; font-weight: bold;">/</span>bin<span style="color: #336633; font-weight: bold;">/</span>watchdog <span style="color: #336633; font-weight: bold;">/</span>usr<span style="color: #336633; font-weight: bold;">/</span>local<span style="color: #336633; font-weight: bold;">/</span>zend<span style="color: #336633; font-weight: bold;">/</span>bin<span style="color: #336633; font-weight: bold;">/</span>watchdogOLD</pre>
<p>3. Extract the new watchdog to /usr/local/zend/bin/ (I used the go to folder in finder, if you can view hidden files)</p>
<p>4. Run the following command to restart the Zend server</p>
<pre style="font-family: monospace;"><span style="color: #ff00ff;"><strong>sudo</strong> </span>/usr/local/zend/bin/zendctl.sh restart</pre>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.hibbins.com%2F2009%2F10%2F18%2Fzend-server-ce-on-osx-10-6-snow-leopard%2F';
  addthis_title  = 'Zend+Server+CE+on+OSX+10.6+Snow+Leopard';
  addthis_pub    = 'JHibbins';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.hibbins.com/2009/10/18/zend-server-ce-on-osx-10-6-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>4 Coding tips</title>
		<link>http://www.hibbins.com/2009/08/26/4-coding-tips/</link>
		<comments>http://www.hibbins.com/2009/08/26/4-coding-tips/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 09:49:00 +0000</pubDate>
		<dc:creator>Jon Hibbins</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Comment]]></category>
		<category><![CDATA[Duplicates]]></category>
		<category><![CDATA[Tip]]></category>

		<guid isPermaLink="false">http://www.hibbins.com/?p=223</guid>
		<description><![CDATA[4 Coding tips]]></description>
			<content:encoded><![CDATA[<p><strong>1: Delete It !</strong><br />
If a chunk of code comment or class is not used, don&#8217;t comment it out, just delete it.</p>
<p><strong>2: Write clear code.<br />
</strong> &#8220;make sure you document code that&#8217;s hard to understand&#8221;. Question: why is the code hard to understand?</p>
<p><strong>3: Comment </strong><br />
Comments can indeed be useful but mostly as a summary of action</p>
<p><strong>4: Don&#8217;t Repeat Yourself </strong><br />
Duplication is bad. If you have more than 4-5 lines of code that do the same thing in a single class, refactor to remove duplication.</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.hibbins.com%2F2009%2F08%2F26%2F4-coding-tips%2F';
  addthis_title  = '4+Coding+tips';
  addthis_pub    = 'JHibbins';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.hibbins.com/2009/08/26/4-coding-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check if a Javascript function exists</title>
		<link>http://www.hibbins.com/2009/03/22/check-if-a-javascript-function-exists/</link>
		<comments>http://www.hibbins.com/2009/03/22/check-if-a-javascript-function-exists/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 13:40:23 +0000</pubDate>
		<dc:creator>Jon Hibbins</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Call]]></category>
		<category><![CDATA[Check]]></category>
		<category><![CDATA[Exists]]></category>
		<category><![CDATA[Function]]></category>

		<guid isPermaLink="false">http://www.hibbins.com/?p=212</guid>
		<description><![CDATA[If you want to check if a Javascript function exists before you attempt to call it and get an error try:

// Check if a Javascript function exists and run it if it does
if&#40;typeof window.Function == 'function'&#41; &#123;
    Function&#40;&#41;;
&#125;


  addthis_url    = 'http%3A%2F%2Fwww.hibbins.com%2F2009%2F03%2F22%2Fcheck-if-a-javascript-function-exists%2F';
  addthis_title  = 'Check+if+a+Javascript+function+exists';
  addthis_pub [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to check if a Javascript function exists before you attempt to call it and get an error try:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// Check if a Javascript function exists and run it if it does</span>
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> window.<span style="color: #003366; font-weight: bold;">Function</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'function'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">Function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.hibbins.com%2F2009%2F03%2F22%2Fcheck-if-a-javascript-function-exists%2F';
  addthis_title  = 'Check+if+a+Javascript+function+exists';
  addthis_pub    = 'JHibbins';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.hibbins.com/2009/03/22/check-if-a-javascript-function-exists/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iPhone 3.0</title>
		<link>http://www.hibbins.com/2009/03/17/iphone-30/</link>
		<comments>http://www.hibbins.com/2009/03/17/iphone-30/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 22:41:20 +0000</pubDate>
		<dc:creator>Jon Hibbins</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Platform]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[3.0]]></category>
		<category><![CDATA[copy]]></category>
		<category><![CDATA[cut]]></category>
		<category><![CDATA[mms]]></category>
		<category><![CDATA[paste]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://www.hibbins.com/?p=217</guid>
		<description><![CDATA[Apple has announced the iPhone 3.0 software update which includes an updated Software Development Kit (SDK) with over 1,000 completely new APIs.
Here are a few highlighted features:

Search your iPhone
Cut, copy, and paste
Send photos, contacts, audio files, and location via MMS*
Read and compose email and text messages in landscape

And yes, I am running it (I have [...]]]></description>
			<content:encoded><![CDATA[<p>Apple has announced the <a href="http://www.apple.com/iphone/preview-iphone-os/" target="_blank">iPhone 3.0 software update</a> which includes an updated Software Development Kit (SDK) with over 1,000 completely new APIs.</p>
<p>Here are a few highlighted features:</p>
<ul>
<li>Search your iPhone</li>
<li>Cut, copy, and paste</li>
<li>Send photos, contacts, audio files, and location via MMS*</li>
<li>Read and compose email and text messages in landscape</li>
</ul>
<p>And yes, I am running it (I have an Apple Developer Account), and so far I found one bug (on safari re-highlighting the address bar can sometimes make the address disapear) and an un-announced fearure (the call history list is now much more verbose)</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.hibbins.com%2F2009%2F03%2F17%2Fiphone-30%2F';
  addthis_title  = 'iPhone+3.0';
  addthis_pub    = 'JHibbins';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.hibbins.com/2009/03/17/iphone-30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVN Port TCP Port is 3690</title>
		<link>http://www.hibbins.com/2009/02/12/svn-port-tcp-port-is-3690/</link>
		<comments>http://www.hibbins.com/2009/02/12/svn-port-tcp-port-is-3690/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 10:29:43 +0000</pubDate>
		<dc:creator>Jon Hibbins</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Platform]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Unix/Linux]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[3690]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Port]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[TCP]]></category>

		<guid isPermaLink="false">http://www.hibbins.com/?p=192</guid>
		<description><![CDATA[SVN Port TCP Port is 3690]]></description>
			<content:encoded><![CDATA[<p>If you need to access SVN remotely, by default it runs on port TCP port 3690, so you need to make sure it is open in your firewall etc.</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.hibbins.com%2F2009%2F02%2F12%2Fsvn-port-tcp-port-is-3690%2F';
  addthis_title  = 'SVN+Port+TCP+Port+is+3690';
  addthis_pub    = 'JHibbins';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.hibbins.com/2009/02/12/svn-port-tcp-port-is-3690/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SQL Server Schema,Table,Function and Stored procedure Auditing</title>
		<link>http://www.hibbins.com/2008/12/17/sql-server-schematablefunction-and-stored-procedure-auditing/</link>
		<comments>http://www.hibbins.com/2008/12/17/sql-server-schematablefunction-and-stored-procedure-auditing/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 16:09:47 +0000</pubDate>
		<dc:creator>Jon Hibbins</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[MSSQL2005]]></category>
		<category><![CDATA[MSSQL2008]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Audit]]></category>
		<category><![CDATA[Function]]></category>
		<category><![CDATA[SQL Server Schema]]></category>
		<category><![CDATA[Stored Procedure]]></category>
		<category><![CDATA[Table]]></category>

		<guid isPermaLink="false">http://www.hibbins.com/?p=187</guid>
		<description><![CDATA[If you like to know what&#8217;s changing on your SQL Server then the following code creates an audit table and the associated trigger for logging the changes
The Audit Object Table

CREATE TABLE &#91;dbo&#93;.&#91;AuditObjects&#93;&#40;
 &#91;EventID&#93; &#91;int&#93; IDENTITY&#40;1,1&#41; NOT NULL
,&#91;EventData&#93; &#91;xml&#93; NULL
PRIMARY KEY CLUSTERED &#40;
   &#91;EventID&#93; ASC
&#41; WITH &#40;IGNORE_DUP_KEY = OFF&#41; ON &#91;PRIMARY&#93;
&#41; ON &#91;PRIMARY&#93;

And the [...]]]></description>
			<content:encoded><![CDATA[<p>If you like to know what&#8217;s changing on your SQL Server then the following code creates an audit table and the associated trigger for logging the changes</p>
<p>The Audit Object Table</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>AuditObjects<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#40;</span>
 <span style="color: #66cc66;">&#91;</span>EventID<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#91;</span>int<span style="color: #66cc66;">&#93;</span> IDENTITY<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span>
<span style="color: #66cc66;">,</span><span style="color: #66cc66;">&#91;</span>EventData<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#91;</span>xml<span style="color: #66cc66;">&#93;</span> <span style="color: #993333; font-weight: bold;">NULL</span>
<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span> CLUSTERED <span style="color: #66cc66;">&#40;</span>
   <span style="color: #66cc66;">&#91;</span>EventID<span style="color: #66cc66;">&#93;</span> <span style="color: #993333; font-weight: bold;">ASC</span>
<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">WITH</span> <span style="color: #66cc66;">&#40;</span>IGNORE_DUP_KEY <span style="color: #66cc66;">=</span> OFF<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #66cc66;">&#91;</span><span style="color: #993333; font-weight: bold;">PRIMARY</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #66cc66;">&#91;</span><span style="color: #993333; font-weight: bold;">PRIMARY</span><span style="color: #66cc66;">&#93;</span></pre></div></div>

<p>And the associated Trigger</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TRIGGER</span> <span style="color: #66cc66;">&#91;</span>TriggerAuditObjects<span style="color: #66cc66;">&#93;</span>
<span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #993333; font-weight: bold;">DATABASE</span>
<span style="color: #993333; font-weight: bold;">FOR</span> DDL_DATABASE_LEVEL_EVENTS
<span style="color: #993333; font-weight: bold;">AS</span>
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>AuditObjects<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#40;</span>EventData<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> EVENTDATA<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
GO
ENABLE <span style="color: #993333; font-weight: bold;">TRIGGER</span> <span style="color: #66cc66;">&#91;</span>TriggerAuditObjects<span style="color: #66cc66;">&#93;</span> <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #993333; font-weight: bold;">DATABASE</span></pre></div></div>

<p>You can now use xpath queries to analyse the data</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.hibbins.com%2F2008%2F12%2F17%2Fsql-server-schematablefunction-and-stored-procedure-auditing%2F';
  addthis_title  = 'SQL+Server+Schema%2CTable%2CFunction+and+Stored+procedure+Auditing';
  addthis_pub    = 'JHibbins';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.hibbins.com/2008/12/17/sql-server-schematablefunction-and-stored-procedure-auditing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Search Stored Procedures</title>
		<link>http://www.hibbins.com/2008/12/05/search-stored-procedures/</link>
		<comments>http://www.hibbins.com/2008/12/05/search-stored-procedures/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 09:21:50 +0000</pubDate>
		<dc:creator>Jon Hibbins</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MSSQL2005]]></category>
		<category><![CDATA[MSSQL2008]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Find]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[Replace]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[Stored Procedures]]></category>

		<guid isPermaLink="false">http://www.hibbins.com/?p=173</guid>
		<description><![CDATA[Ever had the need to search stored procedures to find redundant tables or text that needs replacing or re-factoring ?
Here&#8217;s a script to help (Sorry for the cursor, I&#8217;m sad with myself for using it   )

-- Search string
DECLARE @SearchString nvarchar&#40;50&#41;
SET @SearchString = 'Search String'
&#160;
-- Required Declares
DECLARE @getdbname sysname
DECLARE @sqlstm nvarchar&#40;1000&#41;
DECLARE SeachCursor cursor FOR [...]]]></description>
			<content:encoded><![CDATA[<p>Ever had the need to search stored procedures to find redundant tables or text that needs replacing or re-factoring ?</p>
<p>Here&#8217;s a script to help (Sorry for the cursor, I&#8217;m sad with myself for using it <img src='http://www.hibbins.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' />  )</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">-- Search string</span>
DECLARE @SearchString nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">SET</span> @SearchString <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'Search String'</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- Required Declares</span>
DECLARE @getdbname sysname
DECLARE @sqlstm nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#41;</span>
DECLARE SeachCursor cursor <span style="color: #993333; font-weight: bold;">FOR</span> 
<span style="color: #808080; font-style: italic;">-- Get All The Names into the SeachCursor</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #ff0000;">'['</span><span style="color: #66cc66;">+</span>name<span style="color: #66cc66;">+</span><span style="color: #ff0000;">']'</span> <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #66cc66;">&#91;</span>master<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>sysdatabases<span style="color: #66cc66;">&#93;</span> <span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> name 
OPEN SeachCursor
<span style="color: #808080; font-style: italic;">-- Add the Search Pattern</span>
<span style="color: #993333; font-weight: bold;">SET</span> @SearchString <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'%'</span> <span style="color: #66cc66;">+</span> @SearchString <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">'%'</span>
<span style="color: #808080; font-style: italic;">--Get the first Name</span>
FETCH NEXT <span style="color: #993333; font-weight: bold;">FROM</span> SeachCursor <span style="color: #993333; font-weight: bold;">INTO</span> @getdbname
WHILE @@FETCH_STATUS<span style="color: #66cc66;">=</span><span style="color: #cc66cc;">0</span>
	BEGIN
	<span style="color: #808080; font-style: italic;">--set the statement to define the search condition, with variables</span>
	<span style="color: #993333; font-weight: bold;">SET</span> @sqlstm <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'
	SELECT [SP].[Specific_Catalog] AS [Database_Name], [SP].[Routine_Name] AS [Stored Procedure Name],[SP].[Routine_Definition] AS [Routine_Definition]
	FROM '</span><span style="color: #66cc66;">+</span> @getdbname<span style="color: #66cc66;">+</span><span style="color: #ff0000;">'.[Information_Schema].[Routines] AS [SP]
	WHERE PatIndex('</span><span style="color: #66cc66;">+</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #66cc66;">+</span>@SearchString<span style="color: #66cc66;">+</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #66cc66;">+</span><span style="color: #ff0000;">', [Routine_Definition]) &gt; 0'</span>
	<span style="color: #808080; font-style: italic;">--Execute the Query</span>
	EXEC <span style="color: #66cc66;">&#40;</span>@sqlstm<span style="color: #66cc66;">&#41;</span>
	FETCH NEXT <span style="color: #993333; font-weight: bold;">FROM</span> SeachCursor <span style="color: #993333; font-weight: bold;">INTO</span> @getdbname
	END
<span style="color: #808080; font-style: italic;">--Close the Cursor and Deallocate it from memory</span>
CLOSE SeachCursor
DEALLOCATE SeachCursor</pre></div></div>

<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.hibbins.com%2F2008%2F12%2F05%2Fsearch-stored-procedures%2F';
  addthis_title  = 'Search+Stored+Procedures';
  addthis_pub    = 'JHibbins';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.hibbins.com/2008/12/05/search-stored-procedures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL 2008 Enable Changes To Tables</title>
		<link>http://www.hibbins.com/2008/10/08/sql-2008-enable-changes-to-tables/</link>
		<comments>http://www.hibbins.com/2008/10/08/sql-2008-enable-changes-to-tables/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 13:23:34 +0000</pubDate>
		<dc:creator>Jon Hibbins</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MSSQL2008]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[Microsoft SQL Server Management Studio]]></category>
		<category><![CDATA[not permitted]]></category>
		<category><![CDATA[re-created]]></category>
		<category><![CDATA[re-creation]]></category>
		<category><![CDATA[saving]]></category>

		<guid isPermaLink="false">http://www.hibbins.com/?p=168</guid>
		<description><![CDATA[If you get the error in the SQL 2008 Management Studio :
&#8220;Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can&#8217;t be re-created or enabled the option Prevent saving changes that require the table to be [...]]]></description>
			<content:encoded><![CDATA[<p>If you get the error in the SQL 2008 Management Studio :</p>
<p><em>&#8220;Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can&#8217;t be re-created or enabled the option Prevent saving changes that require the table to be re-created.&#8221;</em></p>
<p>You can enable changes inside the Microsoft SQL Server Management Studio by going to &#8216;Tools|Options|Designers&#8217; then unchecking the &#8216;Prevent saving changes that require table re-creation&#8217; option</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.hibbins.com%2F2008%2F10%2F08%2Fsql-2008-enable-changes-to-tables%2F';
  addthis_title  = 'SQL+2008+Enable+Changes+To+Tables';
  addthis_pub    = 'JHibbins';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.hibbins.com/2008/10/08/sql-2008-enable-changes-to-tables/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>
