{"id":20,"date":"2007-06-17T22:41:14","date_gmt":"2007-06-17T22:41:14","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?p=20"},"modified":"2023-01-16T06:03:37","modified_gmt":"2023-01-16T06:03:37","slug":"a-cheaters-guide-to-dts-packages","status":"publish","type":"post","link":"https:\/\/www.wapshere.com\/missmiis\/a-cheaters-guide-to-dts-packages","title":{"rendered":"A Cheater&#8217;s Guide to DTS Packages"},"content":{"rendered":"<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Let me just say, at this point, that SQL was a mystery to me before I started working with MIIS. I&#8217;d always looked at it from a sys admin point of view &#8211; set up the server, install SQL, maybe even do some patching, and then hand it straight over to the DB people.<\/span><\/span><\/p>\n<p><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">But you can&#8217;t do MIIS without learning some SQL so I soon found myself bugging my friendly, neighbourhood DBA for advice on query scripts and how to go about running them. It seemed I needed something called a DTS package.<\/span><\/span><\/p>\n<p><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">The reason I&#8217;m calling this post a cheater&#8217;s guide is because I&#8217;ve never done any proper reading or study on how DTS packages <em>should<\/em> be constructed &#8211; I&#8217;ve just figured out how to cobble one together for my own purposes. This is neither ground-breaking nor particularly challenging, but it is something I had to discover on my MIIS journey, so I&#8217;m including it here.<\/span><\/span><\/p>\n<p><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Some steps for creating a simple DTS.<\/span><\/span><\/p>\n<ol style=\"margin-top: 0cm;\" type=\"1\">\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 36.0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Create the DTS:<\/span><\/span>\n<ol style=\"margin-top: 0cm;\" type=\"a\">\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 72.0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">In SQL Enterprise Manager, open the local server and go to <strong>Data Transformation Services<\/strong> -&gt; <strong>Local Packages<\/strong>.<\/span><\/span><\/li>\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 72.0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Create a New Package.<\/span><\/span><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<ol style=\"margin-top: 0cm;\" start=\"2\" type=\"1\">\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 36.0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Create a Connection to the database you will be working on:<\/span><\/span>\n<ol style=\"margin-top: 0cm;\" type=\"a\">\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 72.0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Click <strong>Connection<\/strong> -&gt; <strong>Microsoft OLE Provider for SQL Server<\/strong>.<\/span><\/span><\/li>\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 72.0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">When configuring the Connection settings, I normally change the Connection name to be the database name. <\/span><\/span><\/li>\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 72.0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Just leave the server as (local). This makes it easier to replicate the DTS between dev, test and DR servers.<\/span><\/span><\/li>\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 72.0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">I always use Windows Authentication. It is important to make sure the account that will be running the DTS has appropriate rights to the database in SQL. (You can always cheat and make the account a local Administrator &#8211; but no one ever does that right?)<\/span><\/span><span lang=\"EN-GB\"><br \/>\n<\/span><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><span lang=\"EN-GB\"><img decoding=\"async\" src=\"https:\/\/www.wapshere.com\/images\/dts-connection.GIF\" \/> <\/span><\/p>\n<ol style=\"margin-top: 0cm;\" start=\"3\" type=\"1\">\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 36.0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Now create a SQL Task for the DTS to run:<\/span><\/span>\n<ol style=\"margin-top: 0cm;\" type=\"a\">\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 72.0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Click <strong>Task<\/strong> -&gt; <strong>Execute SQL Task<\/strong>.<\/span><\/span><\/li>\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 72.0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Change the <strong>Description<\/strong> to something meaningful.<\/span><\/span><\/li>\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 72.0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Make sure the <strong>Existing Connection<\/strong> is set to use the Connection you just created.<\/span><\/span><\/li>\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 72.0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Paste your SQL query script into the <strong>SQL Statement<\/strong> window. This can be anything that you&#8217;ve successfully run from Query Analyzer. (For some examples see the <a href=\"https:\/\/www.wapshere.com\/missmiis\/?p=12\">delta table<\/a> and <a href=\"https:\/\/www.wapshere.com\/missmiis\/?p=18\">attribute-level<\/a> posts.)<\/span><\/span><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><span lang=\"EN-GB\"><img decoding=\"async\" src=\"https:\/\/www.wapshere.com\/images\/dts-sqltask.GIF\" \/> <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\">\n<ol style=\"margin-top: 0cm;\" start=\"4\" type=\"1\">\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 36.0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Create further SQL tasks.<\/span><\/span><\/li>\n<\/ol>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">You could put all your SQL statements into a single Task, but it&#8217;s much nicer to split them down into sub-tasks. This makes the DTS easier to understand at a glance, and also gives you extra information if the DTS fails. As far as I can tell, native SQL logging for DTS packages is pretty much non-existant &#8211; about the only information you can get back is which task the DTS failed on. The more you break down your SQL statements into sub-tasks, the better idea you&#8217;ll have about where the failure occurred.<\/span><\/span><\/p>\n<ul>\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 36.0pt;\"><span lang=\"EN-GB\">Connect your tasks in running order.<\/span><\/li>\n<\/ul>\n<ol style=\"margin-top: 0cm;\" type=\"a\">\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 72.0pt;\"><span lang=\"EN-GB\">Highlight the first and second task.<\/span><\/li>\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 72.0pt;\"><span lang=\"EN-GB\">From the <strong>Workflow<\/strong> menu choose <strong>On Success<\/strong>.<\/span><\/li>\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 72.0pt;\"><span lang=\"EN-GB\">Continue joining your other tasks until finished.<\/span><\/li>\n<\/ol>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Here&#8217;s a picture of a DTS I created to generate four Delta tables.<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span lang=\"EN-GB\"><img decoding=\"async\" src=\"https:\/\/www.wapshere.com\/images\/dts-createdeltas.GIF\" \/> <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span lang=\"EN-GB\"><span style=\"font-family: Times New Roman;\">Once you get your DTS going you&#8217;re going to want to synchronise the running of it with your MIIS import jobs, and there are also some issues about how and when to clear the delta tables- but these can be covered in other posts.<\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let me just say, at this point, that SQL was a mystery to me before I started working with MIIS. I&#8217;d always looked at it from a sys admin point of view &#8211; set up the server, install SQL, maybe even do some patching, and then hand it straight over to the DB people. But&#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":[5],"tags":[],"class_list":["post-20","post","type-post","status-publish","format-standard","hentry","category-sql"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pkp1o-k","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/20","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=20"}],"version-history":[{"count":3,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/20\/revisions"}],"predecessor-version":[{"id":3337,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/20\/revisions\/3337"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=20"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/categories?post=20"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/tags?post=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}