CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Trying to copy database in SQLite to MSSQL


New User

Jul 25, 2012, 10:31 AM

Post #1 of 1 (9385 views)
Trying to copy database in SQLite to MSSQL Can't Post

I am trying to copy database after inserting the test results into a file from SQLite to MSSQL

The below sub routine is in
sub get_data
undef $/;
open (my $QFH, "< /sql/summary.sql") or die "error can't open this file $!";
my $sth= $dbh_oracle->prepare(<$QFH>) or
die ("Cannot connect to the database: ".$DBI::errstr."\n");
close $QFH;
my $hash_ref = $sth->fetchall_hashref('MYTABLE');
return $hash_ref;

And you call it from main and use the output as follows:

my $hash_ref = get_data();
my $message = "";
foreach my $table (sort keys %$hash_ref) {
$message .= join(":", "Alert", $table, $$hash_ref{$table}{'FLAG'}) . "\n";

using this in SQLite
my $cmd_file = "sqlite3_cmd.txt";
open( FH, ">$cmd_file") or die "Error: ($pgm) Cannot open $cmd_file for writing\n";
print FH $cmd_file;
close( FH);
my $sqlite = `sqlite3 /projects/wpan_scratch/users/.rsqdb/BCM4345_btfmA0.db < $cmd_file`;

# remove create tables
$sqlite =~ s/\nCREATE TABLE.*?\);\s*/\n/mgs;
$sqlite =~ s/INSERT\s+INTO\s*"test"/INSERT INTO "$tst_table_name"/mgs;
$sqlite =~ s/INSERT\s+INTO\s*"regressions"/INSERT INTO "$reg_table_name"/mgs;

but i need to know how to call a file in mssql .
kindly help me out


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives