SQL Server 2005/2008: SPLIT-function for strings

When processing data in a database table, sometimes you need to split a string value in a column, which has format "Val1Val2...ValN", into parts Val1, Val2, etc. Example:
ItemID  |  ItemProperty
4511     | Black / Yellow / Red

ItemID  |  ItemPropertySingleValue
4511     |  Black
4511     |  Yellow
4511     |  Red

Since T-SQL doesn't have such a function by default, I searched a bit in the Internet and found a nice idea to use XML data type to do the job. Here is a T-SQL function, which takes as parameters key column value, string to split and separator and returns a table, containing of pairs key value + substring. Additionally an index/position of each substring in the original string is returned - in this way values form certain levels/depth can be selected.

CREATE FUNCTION [dbo].[splitCategoriesForItem]
       -- Add the parameters for the function here
       @pItemNr nvarchar(255), -- ID of the item
       @pCategoriesString nvarchar(255), -- string of categories to split (in the case of pixi-export - column TonTrText
       @pSeparator nvarchar(1)
@tblResult TABLE
       PrdKey nvarchar(255), -- ID of the item
       Value nvarchar(max), -- extracted value
       valueIndex int IDENTITY(1,1) -- index/position of the value in a string

             WITH Vals AS (
                           @pItemNr as ItemKey
                           ,CAST('''' + REPLACE(@pCategoriesString, @pSeparator, '''') + '''' AS XML) XmlColumn
             ) -- close CTE

             INSERT INTO @tblResult
                    , _res.Value
             FROM (
                             ItemKey AS PrdKey
                           , LTRIM(RTRIM(C.value(''.'',''varchar(max)''))) AS Value
                    FROM    Vals
                    CROSS APPLY Vals.XmlColumn.nodes(''/d'') AS T(C)
             ) _res

Feel free to contact me in the case of questions.


Use of VirtualPC-drives in Linux using VirtualBox

Hello @all,

many years ago I created a "VirtualPC-2007"-drive with WindowsXP. Some time ago I had to use that drive under Linux. After searching on the Web I found out, that "VirtualBox" by Oracle would be able to run virtual machines using VirtPC-drives.

So, I created a virtual PC in "VirtualBox" using "Virtualpc"-drive (OMG, what an ugly sentence...). But when I tried to run my virtual PC, Windows crashed with "Blue Screen of Death". I managed to capture the error:

This message was caused by driver processr.sys. I searched for a solution and found this blog: http://morgansimonsen.wordpress.com/2011/03/12/blue-screen-bsod-on-virtualbox-vm/

So, I tried to disable processr.sys, but got an error that this service is not installed. So, I decided to ask an author about further steps. Waiting for his response...

Update: the CORRECT command is

sc config processor start= disabled