{"id":126,"date":"2008-07-07T17:04:36","date_gmt":"2008-07-07T17:04:36","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?page_id=126"},"modified":"2008-07-07T17:04:36","modified_gmt":"2008-07-07T17:04:36","slug":"vbscript-function-deltaimportspending","status":"publish","type":"page","link":"https:\/\/www.wapshere.com\/missmiis\/vbscript-function-deltaimportspending","title":{"rendered":"vbscript: Function DeltaImportsPending"},"content":{"rendered":"<p>To use with Delta imports from SQL &#8211; check if there are any lines in the Delta table before running an Import. By only running delta imports when there&#8217;s actually something to do you can save on time and transaction log space.<\/p>\n<blockquote>\n<p class=\"Code\" style=\"margin: 0cm 0cm 0pt;\"><span lang=\"EN-GB\">Const DB_CONNECT_STRING = \u00e2\u20ac\u0153Provider=SQLOLEDB;Data Source=(local);Initial Catalog=<em>DB-name<\/em>;Integrated Security=SSPI\u00e2\u20ac\u009d<\/span><\/p>\n<p>&#8216;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n&#8216;\u00c2\u00a0 Function DeltaImportsPending<br \/>\n&#8216;\u00c2\u00a0 + Returns TRUE if the Delta table has content<br \/>\n&#8216;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Function DeltaImportsPending(Delta_Table)<br \/>\n\u00c2\u00a0 Dim objDB, sqlQuery, recordset<\/p>\n<p>\u00c2\u00a0 Set objDB = CreateObject(&#8220;ADODB.Connection&#8221;)<br \/>\n\u00c2\u00a0 Set recordset = CreateObject(&#8220;ADODB.Recordset&#8221;)<\/p>\n<p>\u00c2\u00a0 objDB.Open DB_CONNECT_STRING<br \/>\n\u00c2\u00a0 sqlQuery = &#8220;SELECT COUNT (*) AS num FROM &#8221; &amp; Delta_Table<\/p>\n<p>\u00c2\u00a0 recordset.Open sqlQuery, objDB<\/p>\n<p>\u00c2\u00a0 If recordset.Fields(&#8220;num&#8221;) &gt; 0 Then<br \/>\n\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 DeltaImportsPending = TRUE<br \/>\n\u00c2\u00a0 Else<br \/>\n\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 DeltaImportsPending = FALSE<br \/>\n\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 WriteLog(&#8220;No pending delta imports &#8211; stopping.&#8221;)<br \/>\n\u00c2\u00a0 End If<\/p>\n<p>\u00c2\u00a0 objDB.Close<\/p>\n<p>End Function<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>To use with Delta imports from SQL &#8211; check if there are any lines in the Delta table before running an Import. By only running delta imports when there&#8217;s actually something to do you can save on time and transaction log space. Const DB_CONNECT_STRING = \u00e2\u20ac\u0153Provider=SQLOLEDB;Data Source=(local);Initial Catalog=DB-name;Integrated Security=SSPI\u00e2\u20ac\u009d &#8216;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8216;\u00c2\u00a0 Function DeltaImportsPending &#8216;\u00c2\u00a0 +&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-126","page","type-page","status-publish","hentry"],"jetpack_shortlink":"https:\/\/wp.me\/Pkp1o-22","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages\/126","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/comments?post=126"}],"version-history":[{"count":0,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages\/126\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}