Results 1 to 2 of 2

Thread: Sqldmo

  1. #1
    Join Date
    Jul 2002
    Posts
    1

    Unanswered: Sqldmo

    Hi,

    I used, SQLDMO object, database.Executeimmediate to run a batch file to create table in the database, after which I populate the table with table.Importdata. but I hit the following error message.

    424 Object required.

    however, after checking the DB the table was created.

    the code is something like,
    oSQLDatabase.ExecuteImmediate sSQLStatment,2
    oSQLTable.ImportData(oSQLBulkcopy)


  2. #2
    Join Date
    Dec 2001
    Location
    Toronto, Canada
    Posts
    335
    I thought that the table needed to exist when you defined your oSQLTable object. Here is what I do in Perl:
    Code:
    $oServer->Connect ($SQLServer, $xary{"Login"}, $xary{"Password"});
    $oDatabase = $oServer->Databases->{$dbQCA};
    $oTable = $oDatabase->Tables->{$tbQCA};
    
    $oBulkCopy->{"DataFileType"} = SQLDMODataFile_TabDelimitedChar;
    $oBulkCopy->{"UseBulkCopyOption"} = 1;
    $oBulkCopy->{"DataFilePath"}  = $BCPFile;
    $oBulkCopy->{"ImportRowsPerBatch"}  = 5000;
    
    $oTable->ImportData ($oBulkCopy);
    So to bulkcopy my table object $oTable exists when I create the object at the third line.
    Since your table does not exists maybe you should
    [list=a][*]Create your table with the Executeimmediate [*]Use the refresh method - oDatabase.Tables.Refresh[*]Create your oTable object[*]Do Bulkcopy[/list=a]
    MCDBA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •