Archive

Archive for December, 2009

Migrating Data

December 16th, 2009

When migrating between Courion environments I often run into situations where I need to not only migrate the structure of a table, but also the data. This is most common when migrating configuration tables. I looked for some SQL that would generate insert statements from a given table, and came across this blog entry.

This solution was not perfect, as it didn’t properly handle columns with spaces or that used reserved words in their names.  Luckily someone else had fixed this and placed the solution in the comments.  There is still one drawback that it handles empty columns as NULLs, but it still handles 90% of the work.  If I have the time, I’ll try to work that out and post an updated solution.

SQL Code and usage after the jump.

Read more…

Post to Twitter Tweet This Post Post to Digg Digg This Post Post to Facebook Facebook

mike Uncategorized

Custom Courion Transformation: VB-STRING

December 14th, 2009

I recently ran into a situation where I needed to take the output of a macro and assign it to a variable in a separate VBScript Courion macro.  In order to handle the line returns as well as embedded quotation marks I created a custom transformation.  To implement, simply create a file called CustomTransformations.xml in the CourionService\Transformations Directory, and include the following XML Code:

<?xml version="1.0" encoding="UTF-8"?>
<transformations>
  <!-- VBScript String Adds leading and trailing quotes,
    escapes internal quotes and handles crlf's-->
  <transformation name="VB-STRING">
    <prefix>"</prefix>
    <replacements>
      <replace from="&quot;" to="&quot;&quot;"/>
      <replace from="&#x000d;&#x000a;" to="&quot; &amp; vbcrlf &amp; &quot;"/>
    </replacements>
    <postfix>"</postfix>
    <seperator> &amp; "," &amp; </seperator>
  </transformation>
</transformations>

Post to Twitter Tweet This Post Post to Digg Digg This Post Post to Facebook Facebook

mike Courion

Twitter links powered by Tweet This v1.6.1, a WordPress plugin for Twitter.