Update: Implemented Jeffas suggestion ;)

Due to licensing costs (etc) for interfacing to SQLServer on anything other than a M$ platform - we decided moving to MySQL was the way to go. I could use the data exporter for any tables other than those that had text or blob style columns.

Consequently here is a program that handles each data pull/insert on a table by table basis. You need to update the SQL but that should be ok.

Note:
1) This is a Windows only app.
2) As I was dealing with BLOBS I had to restart the MySQL server with set-variable=max_allowed_packet=16M to stop it bombing on the larger sets of data.
3) I have already created the tables on the MySQL server.
# Port from SQL Server to MySQL use strict; use warnings 'all'; use DBI; use DBD::mysql; use Win32::OLE; use constant adOpenKeySet => 1; my $db_datasource = 'driver={SQL Server};Server=HOST; database=DB;uid= +UID;pwd=PWD;'; my $db_connection = new Win32::OLE('ADODB.Connection'); $db_connection->Open($db_datasource); my $dsn = "DBI:mysql:database=DB;host=HOSTNAME"; my $my_sql = DBI->connect($dsn, 'me', 'julie', {RaiseError=>1}); # notice use of RaiseError - goodbye DBI::errstr! my $table = 'OTHER_TABLE'; my @field = qw(ID description file_data); my $rs = new Win32::OLE("ADODB.Recordset"); $rs->Open("SELECT * FROM $table", $db_connection, adOpenKeySet); # Prepare our insert my $insert_sql = "INSERT INTO $table (" . join(',',@field) . ') VALUES (' . join(',',map '?',@field) . ')' ; my $sth = $my_sql->prepare($insert_sql); while (!$rs->EOF) { $sth->execute( map $rs->{$_}{Value}, @field ); $rs->MoveNext(); } $rs->close(); $db_connection->close(); $my_sql->disconnect();
This should be good enough as a basis for any port tool someone else may need to write.

In reply to Porting from SQL Server to MySQL by simon.proctor

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.