To use with Delta imports from SQL – check if there are any lines in the Delta table before running an Import. By only running delta imports when there’s actually something to do you can save on time and transaction log space.
Const DB_CONNECT_STRING = “Provider=SQLOLEDB;Data Source=(local);Initial Catalog=DB-name;Integrated Security=SSPI”
‘—————————————————–
‘ Function DeltaImportsPending
‘ + Returns TRUE if the Delta table has content
‘—————————————————–Function DeltaImportsPending(Delta_Table)
Dim objDB, sqlQuery, recordsetSet objDB = CreateObject(“ADODB.Connection”)
Set recordset = CreateObject(“ADODB.Recordset”)objDB.Open DB_CONNECT_STRING
sqlQuery = “SELECT COUNT (*) AS num FROM ” & Delta_Tablerecordset.Open sqlQuery, objDB
If recordset.Fields(“num”) > 0 Then
DeltaImportsPending = TRUE
Else
DeltaImportsPending = FALSE
WriteLog(“No pending delta imports – stopping.”)
End IfobjDB.Close
End Function