27.1.13

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:
given:
ItemID  |  ItemProperty
4511     | Black / Yellow / Red

desired:
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)
)
RETURNS
@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
)
AS
BEGIN

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

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

Feel free to contact me in the case of questions.
 

15.1.13

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:
DRIVER_UNLOADED_WITHOUT_CANCELLING_PENDING_OPERATIONS

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

16.2.12

UMTS- / Surf-Stick von o2 unter Ubuntu 11.10 einrichten und betreiben

Hallo @all,

ich wollte mein UMTS-Stick von o2 (MF100 von ZTE Corp.) unter Ubuntu einrichten. Dafür habe ich diese Seite benutzt.

Gruß,
Andrey

14.2.12

Brother DCP-J315W under Ubuntu: installation and configuration

Hello everyone,

a month ago I changed from Debian to Ubuntu. Actually, I had to do, because I ruined my Debian installation.

I will report about my migration later, now I want to tell about installing my printer/scanner Brother DCP-J315W under Ubuntu. This nice page describes, how to do it. It costed me something like 10 minutes to install the printer. Very-very nice! As I said earlier, Brother-devices rule!

Regards,
Andrey

15.8.11

"Brother DCP J315W" rules!

Hi,

this week-end I installed my new all-on-one device "Brother DCP J315W". I'm really impressed by that device. Everything ran smoothly, I could install both USB- and WLAN/WiFi-connections for the printer. I even could install both printer and scanner under Linux! This is amazing.

I will report about printing and scanning quality later.

Cheers,
Andrey

10.8.11

New all-in-one printer is there!

Hello @all,

it's time to replace my old "Olivetti SIMPLE_WAY" with a new device. I just bought "Brother DCP-J315W". Review comes later.

Cheers,
Andrey

1.7.11

I have passed Microsoft exam 70-445!

Hello @everyone,

this week I passed Microsoft exam 70-445 "
TS: Microsoft SQL Server 2005 Business Intelligence - Development and Maintenance". This exam gave me a title of MCTS. Nice! I'm really glad, because that was my Big Goal in the last time.

Cheers,
Andrey