Constancia

VB_Bulk_Insert

Sep 28th, 2013
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     Public Sub ImportarFichero(Optional bBorrar As Boolean = True, Optional FilaIni As Integer = 2)
  2.  
  3.         Try
  4.             If bBorrar Then
  5.                 sSql = "TRUNCATE " & sTabla
  6.                 EjecutaSQL()
  7.             End If
  8.  
  9.             sSql = "BULK INSERT [TEMP].[dbo].[A_tbODIN_Boletines] "
  10.             sSql = sSql & "FROM " & "'" & sRutaFichero & sFichero & "' "
  11.             sSql = sSql & "WITH (ROWTERMINATOR ='\n',FIRSTROW = " & FilaIni & ")"
  12.             EjecutaSQL()
  13.         Catch ex As Exception
  14.             ssError = "ImportarFichero() : " & ex.Message
  15.         End Try
  16.  
  17.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment