Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bulk Insert Question
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00672742
Message ID:
00673646
Vues:
20
Hi Mike,

Thanks for the info. I decided that for what I'm trying to accomplish, there is probably an easier way to do this.

I'm parsing a 3-5 MB report file, then importing the "clean" data into 3 SQL Server tables. Inserting each record using a SP took a couple of minutes (about 15,000 to 20,000 records). Since this used to be a VFP app - two minutes for the import would not be acceptable to the users.

Instead, I parse the original report file, then create a "clean" import file (approx 1.3 - 2.0 MB in size) which is used to import using Bulk Insert. This takes between 6 - 10 seconds (note - the DB is local - but the users of this app have a high-speed network so it shouldn't take them much longer.

Here is the VB code I used for the bulk insert ...
Function funcBulkInsertDetails() As Boolean

 Dim cmdBulkInsDetails As New ADODB.Command
 
    Me.MousePointer = vbHourglass
         
    Set cmdBulkInsDetails.ActiveConnection = gobjDataAccess.objConn
           
    With cmdBulkInsDetails
    .CommandText = "BULK INSERT ATMPOS.dbo.[TransactionDetails] From " & _
            "'" & App.Path & "\Temp\SwitchDetails.txt' " & _
            "WITH (FIELDTERMINATOR = '|',KEEPNULLS)"
    .Execute
    End With
    
    Me.MousePointer = vbNormal
    
    funcBulkInsertDetails = True
    
End Function
>Have you tried using a parameter for the filename from with QA. I'm betting that that syntax is not allowed. You can use Dynamic SQL as a work around.
>
>-Mike
>
Al Williams

Anola MB, CANADA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform