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, recordset Set objDB = CreateObject(“ADODB.Connection”)
 Set recordset = CreateObject(“ADODB.Recordset”) objDB.Open DB_CONNECT_STRING
 sqlQuery = “SELECT COUNT (*) AS num FROM ” & Delta_Table recordset.Open sqlQuery, objDB
 If recordset.Fields(“num”) > 0 Then
   DeltaImportsPending = TRUE
 Else
   DeltaImportsPending = FALSE
   WriteLog(“No pending delta imports – stopping.”)
 End If objDB.Close
End Function