advertisement

Article:
  Faster Filtered SQL Server Imports
Subject:   Bug in test script
Date:   2007-05-17 06:26:30
From:   CPG
My thanks to Zhen Liu for alerting me to an error in the test script.


If the System DSN name is not the same as the name of the database it points to (‘NWIND’ points to ‘Northwind’ in the test script) the following error results:-


Step Step1 failed, error:
-2147467259
Cannot open database requested in login 'NWIND'. Login fails.


The quick fix is to name the system DSN that attaches to the Northwind database 'Northwind' rather than 'NWIND', but to allow the program to work with dsn names that are different to the database name, make the following changes to the code.


Modify the code that handles the command line arguments:-


my ($server, $dsn, $database, $table, $dataFile);
# Check for 5 arguments; server, dsn, database, table and data-file
if (scalar @ARGV == 5){
($server, $dsn, $database, $table, $dataFile) = @ARGV;
} else {
die "Call with 5 arguments: server, dsn, database, table and data-file\n";
}


Change the parameter that is passed to getColumnName():-


### Get the column definitions for the table
(my $rDefs = dtsBulkLoad::getColumnName($dsn, $table)) || die "No def\n";


and call with the following command line arguments:-


dtsBulkLoad.pl Server01 NWIND Northwind Customers c:\temp\customers.txt