<?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>FruitBatInShades Code &#187; SQL</title>
	<atom:link href="http://www.fruitbatscode.com/category/sql/feed" rel="self" type="application/rss+xml" />
	<link>http://www.fruitbatscode.com</link>
	<description>Where the fruitbat keeps his notes</description>
	<lastBuildDate>Thu, 13 May 2010 08:29:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Proper case SQL Function</title>
		<link>http://www.fruitbatscode.com/uncategorized/proper-case-sql-function</link>
		<comments>http://www.fruitbatscode.com/uncategorized/proper-case-sql-function#comments</comments>
		<pubDate>Mon, 27 Jul 2009 09:54:34 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=293</guid>
		<description><![CDATA[Simple function to convert a string to proper case CREATE FUNCTION PROPERCASE &#40; --The string to be converted to proper case @input varchar&#40;8000&#41; &#41; --This function returns the proper case string of varchar type RETURNS varchar&#40;8000&#41; AS BEGIN IF @input IS NULL BEGIN --Just return NULL if input string is NULL RETURN NULL END &#160; [...]]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/uncategorized/proper-case-sql-function/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting T-Sql to MySql Procs</title>
		<link>http://www.fruitbatscode.com/cms/converting-t-sql-to-mysql-procs</link>
		<comments>http://www.fruitbatscode.com/cms/converting-t-sql-to-mysql-procs#comments</comments>
		<pubDate>Sun, 07 Jun 2009 17:31:15 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[cms]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=276</guid>
		<description><![CDATA[I spent all weekend trying to convert a Sql Server db to a MySql v5 db and found it quite a frustrating experience!  When you&#8217;re sytnax is incorrect MySql helpfully says &#8216;You have an error in your sql syntax near:&#8217; and error 1064. No help with which command causes the error and the position it [...]]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/cms/converting-t-sql-to-mysql-procs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dealing with duplicates in SQL</title>
		<link>http://www.fruitbatscode.com/sql/dealing-with-duplicates-in-sql</link>
		<comments>http://www.fruitbatscode.com/sql/dealing-with-duplicates-in-sql#comments</comments>
		<pubDate>Thu, 21 May 2009 08:41:58 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[My Stuff]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=254</guid>
		<description><![CDATA[Was explaining to a friend how to cope with duplicates today so thought I&#8217;d just stick a quick note up for him to refer too. Finding duplicates in SQL is relatively easy when dealing with one field, we just need to  count the number of occurances of the field: SELECT email, COUNT(email) AS NoOff FROM [...]]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/sql/dealing-with-duplicates-in-sql/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Midnight in SQL</title>
		<link>http://www.fruitbatscode.com/sql/getting-midnight-in-sql</link>
		<comments>http://www.fruitbatscode.com/sql/getting-midnight-in-sql#comments</comments>
		<pubDate>Thu, 16 Apr 2009 10:01:51 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=233</guid>
		<description><![CDATA[Just a little udf that gets midnight for a datetime. CREATE FUNCTION dbo.Midnight (@Date datetime) RETURNS Datetime AS BEGIN return CAST(FLOOR(CAST(@Date AS FLOAT)) AS DATETIME) END]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/sql/getting-midnight-in-sql/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parse Paths in SQL</title>
		<link>http://www.fruitbatscode.com/sql/parse-paths-in-sql</link>
		<comments>http://www.fruitbatscode.com/sql/parse-paths-in-sql#comments</comments>
		<pubDate>Thu, 16 Apr 2009 09:53:35 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[My Stuff]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=225</guid>
		<description><![CDATA[Just a couple of udf to handle paths in sql server, not very solid but if your paths are valid they work well. CREATE FUNCTION dbo.GetFileName (@Path varchar(512)) RETURNS varchar(255) AS BEGIN Return RIGHT(@Path, LEN(@Path) - dbo.LAST_INDEX(@Path, '\')) END CREATE FUNCTION dbo.GetDirectory (@Path varchar(512)) RETURNS varchar(255) AS BEGIN Return Left(@Path, dbo.LAST_INDEX(@Path, '\')) END CREATE FUNCTION [...]]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/sql/parse-paths-in-sql/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Assign user permission to entire database</title>
		<link>http://www.fruitbatscode.com/sql/assign-user-permission-to-entire-database</link>
		<comments>http://www.fruitbatscode.com/sql/assign-user-permission-to-entire-database#comments</comments>
		<pubDate>Tue, 27 Jan 2009 21:23:11 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[My Stuff]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=60</guid>
		<description><![CDATA[Sometimes when you restore a SQL Server backup, the permissions are not carried across! Its a real pain to tick all those boxes so here is the dirty way I use to create a script to assign them. The code below pulls out the tables and views from the database structure into a single column. [...]]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/sql/assign-user-permission-to-entire-database/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSV, CDF string &#8211; Multiple In by string IN(&#8220;1,2,3,4,5&#8243;) etc</title>
		<link>http://www.fruitbatscode.com/sql/csv-cdf-string-multiple-in-by-string-in12345-etc</link>
		<comments>http://www.fruitbatscode.com/sql/csv-cdf-string-multiple-in-by-string-in12345-etc#comments</comments>
		<pubDate>Tue, 27 Jan 2009 13:47:12 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=19</guid>
		<description><![CDATA[CREATE FUNCTION CSVTable&#40;@Str varchar&#40;7000&#41;&#41; returns @t TABLE &#40;numberval int, stringval varchar&#40;100&#41;, DateVal datetime&#41; AS begin &#160; declare @i int; declare @c varchar&#40;100&#41;; &#160; SET @Str = @Str + ',' SET @i = 1; SET @c = ''; &#160; while @i &#38;lt;= len&#40;@Str&#41; begin IF substring&#40;@Str,@i,1&#41; = ',' begin INSERT INTO @t VALUES &#40;CASE WHEN isnumeric&#40;@c&#41;=1 [...]]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/sql/csv-cdf-string-multiple-in-by-string-in12345-etc/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Essential SQL Server Date, Time and DateTime Functions</title>
		<link>http://www.fruitbatscode.com/sql/sql-server-date-functions</link>
		<comments>http://www.fruitbatscode.com/sql/sql-server-date-functions#comments</comments>
		<pubDate>Tue, 27 Jan 2009 12:36:34 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=11</guid>
		<description><![CDATA[Date and Time functions for Sql server that give ut the functionality it should have when relating to dates. Create Time, Date, DateTime and TimeSpans etc.]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/sql/sql-server-date-functions/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get Largest date</title>
		<link>http://www.fruitbatscode.com/sql/get-largest-date</link>
		<comments>http://www.fruitbatscode.com/sql/get-largest-date#comments</comments>
		<pubDate>Tue, 27 Jan 2009 12:33:46 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=9</guid>
		<description><![CDATA[CREATE FUNCTION fn_greatest_date &#40;@date_1 datetime, @date_2 datetime, @date_3 datetime&#41; RETURNS datetime AS BEGIN DECLARE @return_date datetime SELECT @return_date = max&#40;dateval&#41; FROM &#40; SELECT @date_1 AS dateval UNION ALL SELECT @date_2 UNION ALL SELECT @date_3 &#41; dates &#160; &#60;span id=&#34;more-9&#34;&#62;&#60;/span&#62; &#160; RETURN @return_date END GO]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/sql/get-largest-date/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
