{"id":29,"date":"2007-06-23T06:54:52","date_gmt":"2007-06-23T06:54:52","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?p=29"},"modified":"2023-01-16T06:25:15","modified_gmt":"2023-01-16T06:25:15","slug":"combining-dts-with-miis-imports","status":"publish","type":"post","link":"https:\/\/www.wapshere.com\/missmiis\/combining-dts-with-miis-imports","title":{"rendered":"Combining DTS with MIIS Imports"},"content":{"rendered":"<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Continuing on from <a href=\"https:\/\/www.wapshere.com\/missmiis\/?p=20\">this post<\/a>, let&#8217;s say you&#8217;ve got a DTS package that is successfully creating Delta tables. You will now want to combine this with your MIIS Delta Import job.<\/span><\/span><\/p>\n<h3 style=\"margin: 12pt 0cm 3pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Arial;\">Simple Scheduling<\/span><\/span><\/h3>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">If your system is not particularly time critical you may be able to get away with very basic scheduling. SQL allows you to schedule DTS packages to run at certain times. You could perhaps run the DTS on the hour, and then run your delta imports at a quarter past.<\/span><\/span><\/p>\n<p><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">You&#8217;d quickly run into problems with this approach as you tried to push import times closer together. There is no way to test the DTS has actually completed before starting the Import in MIIS. And how would you decide whether it was okay to remove lines from the Delta table?<\/span><\/span><\/p>\n<h3 style=\"margin: 12pt 0cm 3pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Arial;\">With dtsrun and MASequencer<\/span><\/span><\/h3>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">The next level of complexity is to call the DTS from outside SQL, and to co-ordinate that with the running of the Delta Import. In your SQL installation you should find a command line tool called <strong>dtsrun.exe<\/strong>. (On my server it is in Program FilesMicrosoft SQL Server80ToolsBinn.) <\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\">\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Using dtsrun you can make yourself a neat little batch file that will run the DTS. Then, using MASequencer from the <\/span><a href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkId=22788\"><span style=\"font-family: Times New Roman;\">MIIS Resource Toolkit<\/span><\/a><span style=\"font-family: Times New Roman;\">, set the DTS batch file as a pre-step to running the Delta Import task in MIIS.<\/span><\/span><\/p>\n<h3 style=\"margin: 12pt 0cm 3pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Arial;\">A VBScript Approach<\/span><\/span><\/h3>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">I run my DTS packages as part of the <a href=\"https:\/\/www.wapshere.com\/missmiis\/?p=26\">scheduling script<\/a> I wrote. I should really include a reference for where I got this function from &#8211; I certainly didn&#8217;t write it myself, but I&#8217;m afraid I can&#8217;t remember. So with apologies to the actual author:<\/span><\/span><\/p>\n<blockquote><p><span lang=\"EN-GB\"><span style=\"font-family: Microsoft Sans Serif; font-size: xx-small;\">Function RunDTS(packageName)<br \/>\n&#8216;Run a DTS and return a status of 0 (success) or -1 (failed)<br \/>\nConst DTSSQLStgFlag_UseTrustedConnection = 256<br \/>\nConst DTSStepExecResult_Failure = 1<br \/>\nConst DTSStepExecResult_Success = 0<br \/>\nDim objPkg, strError, iCount<\/span><\/span><span lang=\"EN-GB\"><span style=\"font-family: Microsoft Sans Serif; font-size: xx-small;\">\u00c2\u00a0\u00e2\u20ac\u02dcExecute the package<br \/>\nWriteLog \u00e2\u20ac\u0153Executing DTS \u00e2\u20ac\u0153 &amp; packageName<br \/>\nSet objPkg = CreateObject(\u00e2\u20ac\u0153DTS.Package\u00e2\u20ac\u009d)<br \/>\nobjPkg.LoadFromSQLServer MIIS_MachineName,,,DTSSQLStgFlag_UseTrustedConnection,,,,packageName<br \/>\nobjPkg.Execute<\/span><\/span><\/p>\n<p>&#8216;\u02dcCheck for errors<br \/>\nFor iCount = 1 To objPkg.Steps.Count<br \/>\nIf objPkg.Steps(iCount).ExecutionResult = DTSStepExecResult_Failure Then<br \/>\nstrError = strError + objPkg.Steps(iCount).Name + \u00e2\u20ac\u0153 failed. \u00e2\u20ac\u0153 + chr(13)<br \/>\nEnd If<br \/>\nNext<\/p>\n<p>If strError = \u00e2\u20ac\u0153\u00e2\u20ac\u009d Then<br \/>\nWriteLog \u00e2\u20ac\u0153DTS package \u00e2\u20ac\u0153 &amp; packagename &amp; \u00e2\u20ac\u0153 completed successfully\u00e2\u20ac\u009d<br \/>\nRunDTS = 0<br \/>\nElse<br \/>\nWriteLog \u00e2\u20ac\u0153DTS package \u00e2\u20ac\u0153 &amp; packagename &amp; \u00e2\u20ac\u0153 failed with error \u00e2\u20ac\u009d &amp; strError<br \/>\nRunDTS = -1<br \/>\nEnd If<br \/>\nSet objPkg = Nothing<br \/>\nEnd Function<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Continuing on from this post, let&#8217;s say you&#8217;ve got a DTS package that is successfully creating Delta tables. You will now want to combine this with your MIIS Delta Import job. Simple Scheduling If your system is not particularly time critical you may be able to get away with very basic scheduling. SQL allows you&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[34,28,5,10],"tags":[],"class_list":["post-29","post","type-post","status-publish","format-standard","hentry","category-ilm2007","category-miis2003","category-sql","category-vbscript"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pkp1o-t","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/29","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/types\/post"}],"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=29"}],"version-history":[{"count":3,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/29\/revisions"}],"predecessor-version":[{"id":3342,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/29\/revisions\/3342"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/categories?post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/tags?post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}