<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>RSS feed for InstantSpot site fro</title><link>http://fro.instantspot.com</link><description>Just playing around.</description><language>en-us</language><copyright>This work is Copyright &#xA9; 2009 by fro</copyright><generator>RSSVille ColdFusion FeedMaker, version 1.0</generator><pubDate>Sat, 07 Nov 2009 15:35:18 GMT</pubDate><item><title>SQL Server List Length Function</title><link>http://fro.instantspot.com/blog/2008/02/19/SQL-Server-List-Length-Function</link><description>&lt;p&gt;I know lists aren&apos;t good to store in a database, but something came up in which I needed to be able to get the list length of a VARCHAR filed.&amp;nbsp; Instead of having to loop it each time, I decided to see what kind of functions were already out there.&amp;nbsp; I found a &lt;a href=&quot;http://www.sql-server-helper.com/functions/count-string.aspx&quot;&gt;count string function&lt;/a&gt;, but it wasn&apos;t exactly what I was looking for, so I took the idea and ran with it.&lt;/p&gt; &lt;p&gt;This function takes a list (VARCHAR) and delimiter (VARCHAR) and returns the number of items in the list.&lt;/p&gt; &lt;p&gt;&lt;div class=&quot;code&quot; &gt;&lt;pre&gt;/*  UDF_LISTLEN  ==================================================  Created on 02/19/2008 by Robert Froehling   - returns the length of a list   - this was modified from count string function at the link below   - http://www.sql-server-helper.com/functions/count-string.aspx */  CREATE FUNCTION UDF_LISTLEN(  @list VARCHAR(8000),  @delim VARCHAR(5)) RETURNS TINYINT BEGIN  -- define the vars to use  DECLARE @modString VARCHAR(8000)  DECLARE @newString VARCHAR(8000)  DECLARE @oldStringLen SMALLINT  DECLARE @modStringLen SMALLINT  DECLARE @newStringLen SMALLINT  DECLARE @delimLen TINYINT  DECLARE @diff TINYINT   -- set some default vars  SET @oldStringLen = LEN(@list)  SET @delimLen = LEN(@delim)  SET @modString = @list  SET @modStringLen = LEN(@modString)   -- if the first part of the string is the delim then remove it  IF SUBSTRING(@modString, 1, @delimLen) = @delim  BEGIN   SET @modString = SUBSTRING(@modString, @delimLen + 1, @oldStringLen - @delimLen)   SET @modStringLen = LEN(@modString)  END   -- if the last part of the string is the delim then remove it  IF SUBSTRING(@modString, @modStringLen - @delimLen + 1, @delimLen) = @delim  BEGIN   SET @modString = SUBSTRING(@modString, 1, @modStringLen - @delimLen)   SET @modStringLen = LEN(@modString)  END   -- count the lengths and setup the diff to return  SET @newString = REPLACE(@list, @delim, &apos;&apos;)  SET @newStringLen = LEN(@newString)  SET @diff = @modStringLen - @newStringLen + 1   RETURN @diff END&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;Here is a usage example.&lt;/p&gt; &lt;p&gt;&lt;div class=&quot;code&quot; &gt;&lt;pre&gt;DECLARE @list VARCHAR(500) DECLARE @delim VARCHAR(1) SET @list = &apos;fro,ev,jc,ds&apos; SET @delim = &apos;,&apos; PRINT master.dbo.udf_listlen(@list, @delim)&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&amp;nbsp; I should point out that I&apos;ve only tested this on SQL Server 2000.&lt;/p&gt;</description><pubDate>Tue, 19 Feb 2008 16:54:00 GMT</pubDate><guid>http://fro.instantspot.com/blog/2008/02/19/SQL-Server-List-Length-Function</guid><category>microsoft,sql server</category></item><item><title>Reminder To Self - Cannot Concatenate NULL in SQL Server 2000</title><link>http://fro.instantspot.com/blog/2008/02/08/Reminder-To-Self--Cannot-Concatenate-NULL-in-SQL-Server-2000</link><description>&lt;p&gt;In SQL Server 2000, I&apos;m not sure about 2005 yet, you can&apos;t concatenate on&amp;nbsp;a NULL value.&amp;nbsp; The result will continue to be NULL.&lt;/p&gt; &lt;p&gt;By running this you get an output of NULL.&lt;/p&gt; &lt;p&gt;&lt;div class=&quot;code&quot; &gt;&lt;pre&gt;DECLARE @my_string VARCHAR(20) SET @my_string = @my_string + &apos;something&apos; PRINT @my_string&lt;/pre&gt;&lt;/div&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;You have to set the variable to something other than NULL before using concatenation.&lt;/p&gt; &lt;p&gt;&lt;div class=&quot;code&quot; &gt;&lt;pre&gt;DECLARE @my_string VARCHAR(20) SET @my_string = &apos;&apos; SET @my_string = @my_string + &apos;something&apos; PRINT @my_string&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;This had me hung up for almost an hour.&lt;/p&gt;</description><pubDate>Fri, 08 Feb 2008 22:24:00 GMT</pubDate><guid>http://fro.instantspot.com/blog/2008/02/08/Reminder-To-Self--Cannot-Concatenate-NULL-in-SQL-Server-2000</guid><category>microsoft,sql server</category></item><item><title>SQL Server Data Types (ntext, text, and image) To Be Removed</title><link>http://fro.instantspot.com/blog/2008/02/07/SQL-Server-Data-Types-ntext-text-and-image-To-Be-Removed</link><description>&lt;p&gt;I was doing some research on data types in various DB engines when you came across the SQL Server 2005 documentation on data types and found that the &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/ms187993.aspx&quot;&gt;ntext, text, and image data types will be&amp;nbsp;removed in a&amp;nbsp;future version of SQL Server&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;When you plan on upgrading to a new version of anything, make sure to check the documentation for any deprecated functionality that you&apos;re using.&lt;/p&gt; &lt;p&gt;This doesn&apos;t impact me at the moment, as we haven&apos;t even upgraded to 2005 yet.&lt;/p&gt;</description><pubDate>Thu, 07 Feb 2008 19:19:00 GMT</pubDate><guid>http://fro.instantspot.com/blog/2008/02/07/SQL-Server-Data-Types-ntext-text-and-image-To-Be-Removed</guid><category>microsoft,sql server</category></item><item><title>SQL Server Identity</title><link>http://fro.instantspot.com/blog/2008/01/07/SQL-Server-Identity</link><description>&lt;p&gt;  Here is a pretty good article about the differences between @@IDENTITY, SCOPE_IDENTITY(), and IDENT_CURRENT(&amp;#39;tablename&amp;#39;) for SQL Server.&amp;nbsp; I didn&amp;#39;t even know about IDENT_CURRENT(&amp;#39;tablename&amp;#39;) before.  &lt;/p&gt;  &lt;p&gt;  &lt;a href=&quot;http://www.mssqltips.com/tip.asp?tip=1385&quot;&gt;http://www.mssqltips.com/tip.asp?tip=1385&lt;/a&gt;  &lt;/p&gt;  &lt;p&gt;  &amp;nbsp;  &lt;/p&gt;  </description><pubDate>Mon, 07 Jan 2008 22:34:08 GMT</pubDate><guid>http://fro.instantspot.com/blog/2008/01/07/SQL-Server-Identity</guid><category>sql server</category></item><item><title>Friday</title><link>http://fro.instantspot.com/blog/2006/09/15/Friday</link><description>&lt;p&gt;  &lt;font face=&quot;arial,helvetica,sans-serif&quot; size=&quot;2&quot;&gt;Well, it&amp;#39;s Friday.&amp;nbsp; Thank goodness for that.&lt;/font&gt;   &lt;/p&gt;  </description><pubDate>Fri, 15 Sep 2006 19:54:35 GMT</pubDate><guid>http://fro.instantspot.com/blog/2006/09/15/Friday</guid></item></channel></rss>