{"id":346,"date":"2016-01-28T14:00:58","date_gmt":"2016-01-28T13:00:58","guid":{"rendered":"http:\/\/sqlkover.com\/?p=346"},"modified":"2016-01-27T22:01:05","modified_gmt":"2016-01-27T21:01:05","slug":"reblog-building-the-script-component","status":"publish","type":"post","link":"https:\/\/sqlkover.com\/reblog-building-the-script-component\/","title":{"rendered":"Reblog: Building the Script Component"},"content":{"rendered":"<body><p><\/p>\n<p style=\"text-align: justify;\"><em><strong>SQLKover update:<\/strong> For some reason, this was my\u00a0most popular blog post on the old LTD site. Over 110,000 views. People must be building them script components.\u00a0<\/em><\/p>\n<p style=\"text-align: justify;\"><strong>The problem<\/strong><\/p>\n<p style=\"text-align: justify;\">From time to time I have to script out some logic using a Script Component in a SSIS package. Business as usual for most developers, but since I hardly have a .NET background, it\u2019s always a very stressful experience (I may be over exaggerating a bit). Sometimes it happens I write a little piece of code with a small bug, it happens to the best of us.<\/p>\n<pre class=\"lang:c# decode:true\">public override void Input0_ProcessInputRow(InputBuffer row)\n{\n    byte test = -1; \/\/ do something stupid here\n    \/\/ rest of the code\n}<\/pre>\n<p style=\"text-align: justify;\">For those who haven\u2019t noticed: you cannot store -1 in a byte. Anyway, the wonderful designer that is the Visual Studio shell fails to warn me of my little indiscretion. Leaving me with a script component that won\u2019t compile.<\/p>\n<figure id=\"attachment_350\" class=\"thumbnail wp-caption alignnone\" style=\"width: 686px\"><a href=\"http:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/nocompile.png\" rel=\"attachment wp-att-350\"><img decoding=\"async\" class=\"wp-image-350 size-full\" src=\"http:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/nocompile.png\" alt=\"nocompile\" width=\"676\" height=\"212\" loading=\"lazy\" srcset=\"https:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/nocompile.png 676w, https:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/nocompile-300x94.png 300w\" sizes=\"auto, (max-width: 676px) 100vw, 676px\" \/><\/a><figcaption class=\"caption wp-caption-text\">Yes, that\u2019s SSIS 2008 folks!<\/figcaption><\/figure>\n<p style=\"text-align: justify;\">The matching errors aren\u2019t helpful either.<\/p>\n<p style=\"text-align: justify;\"><a href=\"http:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/errors.png\" rel=\"attachment wp-att-349\"><img decoding=\"async\" class=\"alignnone size-full wp-image-349\" src=\"http:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/errors.png\" alt=\"errors\" width=\"853\" height=\"307\" loading=\"lazy\" srcset=\"https:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/errors.png 853w, https:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/errors-300x108.png 300w, https:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/errors-768x276.png 768w\" sizes=\"auto, (max-width: 853px) 100vw, 853px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\"><strong>The solution<\/strong><\/p>\n<p style=\"text-align: justify;\">The solution is elegant yet simple: we force the designer to tell us what\u2019s wrong by building the code inside the script component.<\/p>\n<p style=\"text-align: justify;\"><a href=\"http:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/button.png\" rel=\"attachment wp-att-348\"><img decoding=\"async\" class=\"alignnone size-full wp-image-348\" src=\"http:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/button.png\" alt=\"button\" width=\"467\" height=\"125\" loading=\"lazy\" srcset=\"https:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/button.png 467w, https:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/button-300x80.png 300w\" sizes=\"auto, (max-width: 467px) 100vw, 467px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">This results in a blue squiggly being added to the code, together with a decent explanation.<\/p>\n<p style=\"text-align: justify;\"><a href=\"http:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/buildscript.png\" rel=\"attachment wp-att-347\"><img decoding=\"async\" class=\"alignnone size-full wp-image-347\" src=\"http:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/buildscript.png\" alt=\"buildscript\" width=\"559\" height=\"227\" loading=\"lazy\" srcset=\"https:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/buildscript.png 559w, https:\/\/sqlkover.com\/wp-content\/uploads\/2016\/01\/buildscript-300x122.png 300w\" sizes=\"auto, (max-width: 559px) 100vw, 559px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">The moral of this story: if the script component is giving you a hard time, hit that build button!<\/p>\n<p><\/p>\n<\/body>","protected":false},"excerpt":{"rendered":"<p>SQLKover update: For some reason, this was my\u00a0most popular blog post on the old LTD site. Over 110,000 views. People must be building them script components.\u00a0 The problem From time to time I have to script out some logic using a Script Component in a SSIS package. Business as usual for most developers, but since [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5],"tags":[20,99,17,16],"class_list":["post-346","post","type-post","status-publish","format-standard","hentry","category-ssis","tag-reblog","tag-script-component","tag-ssis","tag-syndicated"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sqlkover.com\/wp-json\/wp\/v2\/posts\/346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sqlkover.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlkover.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlkover.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlkover.com\/wp-json\/wp\/v2\/comments?post=346"}],"version-history":[{"count":1,"href":"https:\/\/sqlkover.com\/wp-json\/wp\/v2\/posts\/346\/revisions"}],"predecessor-version":[{"id":354,"href":"https:\/\/sqlkover.com\/wp-json\/wp\/v2\/posts\/346\/revisions\/354"}],"wp:attachment":[{"href":"https:\/\/sqlkover.com\/wp-json\/wp\/v2\/media?parent=346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlkover.com\/wp-json\/wp\/v2\/categories?post=346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlkover.com\/wp-json\/wp\/v2\/tags?post=346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}