Category Archives: Helper

Converting CSV to Table rows in SQL Server and Oracle

Another useful block of code that will help in converting CSV to a table row.

with temp as
(
    select 108 Id, 'australia, australia, united states of america, iran' str
    UNION ALL
    select 109, 'india, iran, iraq'
    UNION ALL
    SELECT 109, 'israel, australia'
), xmlData as
(
     SELECT Id,  
         CAST ('<M>' + REPLACE(str, ',', '</M><M>') + '</M>' AS XML) AS Data  
     FROM  temp
)
SELECT xmlData.Id,  
     ltrim(rtrim(Split.a.value('.', 'VARCHAR(100)'))) AS Data  
FROM  xmlData CROSS APPLY Data.nodes ('/M') AS Split(a)

and in Oracle,

with temp as
(
    select 108 Id, 'australia, australia, united states of america, iran' str  from dual
    UNION ALL
    select 109, 'india, iran, iraq' from dual
    UNION ALL
    SELECT 109, 'israel, australia' FROM dual
)
SELECT DISTINCT ID, ltrim(regexp_substr(str, '[^' || ',' || ']+', 1, LEVEL)) str
FROM temp T
CONNECT BY regexp_substr(str, '[^' || ',' || ']+', 1, LEVEL) IS NOT NULL
ORDER BY ID;

Steps to move from BlogEngine.net to WordPress

Thought it’s a good idea to put in the steps to migrate from BlogEngine.net to WordPress. All you need is to just follow these steps.

  1. In your Blogengine Administrator’s “Settings” page use “Export” to export the feeds to a BlogML XML file.
  2. Perform a “Find and Replace” to replace all the image and attachment references (I mean the src and href values) in the BlogML file.
  3. Also note that the exported BlogML won’t have the categories properly named. You can change the names at this time or you can do it after the blogs are imported to WordPress.
  4. Extract the files in WordPress.zip and copy the files to /wp-admin/import/ in your WordPress folder.
  5. Now use the Tools -> Import from WordPress and use the BlogML to import the file. You can run the import tool multiple times if the tool had missed importing any of your blog.

Enjoy blogging in WordPress.