{"id":1340,"date":"2015-12-07T17:00:19","date_gmt":"2015-12-07T17:00:19","guid":{"rendered":"http:\/\/elbsolutions.com\/projects\/?p=1340"},"modified":"2022-02-03T11:24:35","modified_gmt":"2022-02-03T17:24:35","slug":"i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function","status":"publish","type":"post","link":"https:\/\/elbsolutions.com\/projects\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\/","title":{"rendered":"I think making a dll in TSQL might be easier than a custom function"},"content":{"rendered":"<p>What I am trying to do is feed in a small string and it will filter some values out for me. This might be easier to do in visual studio than in a TSQL function. Here are some notes on my findings.<\/p>\n<p>I am simply feeding in &#8220;ABCD&#8221; and it will match the 2 letters AB and CD and filter out the corresponding values. So if I feed in ABCD from _ABWXYXCD_ITEM1_ITEM2_ITEM3_ITEM4_ then I expect the output _ABCD_ITEM1_ITEM4_<\/p>\n<p>Simple right? Phhh! Not quite in TSQL. Super easy in c#, but I have never made a dll before.<\/p>\n<p>Here is a start to my TSQL that would be part of a function. I thought to myself &#8211; lets stop while we are ahead&#8230;<!--more--><\/p>\n<p>&#8212; <a href=\"http:\/\/stackoverflow.com\/questions\/659051\/check-if-temp-table-exist-and-delete-if-it-exists-before-creating-a-temp-table\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/stackoverflow.com\/questions\/659051\/check-if-temp-table-exist-and-delete-if-it-exists-before-creating-a-temp-table<\/a><br \/>\n&#8212; <a href=\"http:\/\/stackoverflow.com\/questions\/8726111\/sql-server-find-nth-occurrence-in-a-string\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/stackoverflow.com\/questions\/8726111\/sql-server-find-nth-occurrence-in-a-stri<\/a>ng<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\n\r\nIF OBJECT_ID('tempdb..#T') IS NOT NULL\r\nDROP TABLE #T\r\n\r\nselect 'abc_1_2_3_4.gif ' as img, 0 As id into #T\r\n\r\ninsert INTO #T values ('zzz_12_3_3_45.gif',0)\r\nselect * from #T\r\n;with T as (\r\nselect 0 as row, charindex('_', img) pos, img, id from #T\r\nunion all\r\nselect pos + 1, charindex('_', img, pos + 1), img, id + 1\r\nfrom T\r\nwhere pos &gt; 0\r\n)\r\nselect\r\nimg, pos, id\r\nfrom T\r\nwhere pos &gt; 0\r\nAND id = 2\r\n\r\norder by img, pos\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>What I am trying to do is feed in a small string and it will filter some values out for me. This might be easier to do in visual studio than in a TSQL function. Here are some notes on my findings. I am simply feeding in &#8220;ABCD&#8221; and it will match the 2 letters [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-1340","post","type-post","status-publish","format-standard","hentry","category-sqlserver_ssrs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>I think making a dll in TSQL might be easier than a custom function - ELB Solutions.com Inc.<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/elbsolutions.com\/projects\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"I think making a dll in TSQL might be easier than a custom function - ELB Solutions.com Inc.\" \/>\n<meta property=\"og:description\" content=\"What I am trying to do is feed in a small string and it will filter some values out for me. This might be easier to do in visual studio than in a TSQL function. Here are some notes on my findings. I am simply feeding in &#8220;ABCD&#8221; and it will match the 2 letters [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/elbsolutions.com\/projects\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\/\" \/>\n<meta property=\"og:site_name\" content=\"ELB Solutions.com Inc.\" \/>\n<meta property=\"article:published_time\" content=\"2015-12-07T17:00:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-02-03T17:24:35+00:00\" \/>\n<meta name=\"author\" content=\"Etienne Bley\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Etienne Bley\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\\\/\"},\"author\":{\"name\":\"Etienne Bley\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/#\\\/schema\\\/person\\\/51e717c68f4f5917c63baf88f0896c39\"},\"headline\":\"I think making a dll in TSQL might be easier than a custom function\",\"datePublished\":\"2015-12-07T17:00:19+00:00\",\"dateModified\":\"2022-02-03T17:24:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\\\/\"},\"wordCount\":226,\"articleSection\":[\"SQLServer_SSRS\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\\\/\",\"url\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\\\/\",\"name\":\"I think making a dll in TSQL might be easier than a custom function - ELB Solutions.com Inc.\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/#website\"},\"datePublished\":\"2015-12-07T17:00:19+00:00\",\"dateModified\":\"2022-02-03T17:24:35+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/#\\\/schema\\\/person\\\/51e717c68f4f5917c63baf88f0896c39\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"I think making a dll in TSQL might be easier than a custom function\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/#website\",\"url\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/\",\"name\":\"ELB Solutions.com Inc.\",\"description\":\"Bringing all your IT Pieces together\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/#\\\/schema\\\/person\\\/51e717c68f4f5917c63baf88f0896c39\",\"name\":\"Etienne Bley\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g\",\"caption\":\"Etienne Bley\"},\"url\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/author\\\/etienne-bley\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"I think making a dll in TSQL might be easier than a custom function - ELB Solutions.com Inc.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/elbsolutions.com\/projects\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\/","og_locale":"en_US","og_type":"article","og_title":"I think making a dll in TSQL might be easier than a custom function - ELB Solutions.com Inc.","og_description":"What I am trying to do is feed in a small string and it will filter some values out for me. This might be easier to do in visual studio than in a TSQL function. Here are some notes on my findings. I am simply feeding in &#8220;ABCD&#8221; and it will match the 2 letters [&hellip;]","og_url":"https:\/\/elbsolutions.com\/projects\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\/","og_site_name":"ELB Solutions.com Inc.","article_published_time":"2015-12-07T17:00:19+00:00","article_modified_time":"2022-02-03T17:24:35+00:00","author":"Etienne Bley","twitter_misc":{"Written by":"Etienne Bley","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/elbsolutions.com\/projects\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\/#article","isPartOf":{"@id":"https:\/\/elbsolutions.com\/projects\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\/"},"author":{"name":"Etienne Bley","@id":"https:\/\/elbsolutions.com\/projects\/#\/schema\/person\/51e717c68f4f5917c63baf88f0896c39"},"headline":"I think making a dll in TSQL might be easier than a custom function","datePublished":"2015-12-07T17:00:19+00:00","dateModified":"2022-02-03T17:24:35+00:00","mainEntityOfPage":{"@id":"https:\/\/elbsolutions.com\/projects\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\/"},"wordCount":226,"articleSection":["SQLServer_SSRS"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/elbsolutions.com\/projects\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\/","url":"https:\/\/elbsolutions.com\/projects\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\/","name":"I think making a dll in TSQL might be easier than a custom function - ELB Solutions.com Inc.","isPartOf":{"@id":"https:\/\/elbsolutions.com\/projects\/#website"},"datePublished":"2015-12-07T17:00:19+00:00","dateModified":"2022-02-03T17:24:35+00:00","author":{"@id":"https:\/\/elbsolutions.com\/projects\/#\/schema\/person\/51e717c68f4f5917c63baf88f0896c39"},"breadcrumb":{"@id":"https:\/\/elbsolutions.com\/projects\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/elbsolutions.com\/projects\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/elbsolutions.com\/projects\/i-think-making-a-dll-in-tsql-might-be-easier-than-a-custom-function\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/elbsolutions.com\/projects\/"},{"@type":"ListItem","position":2,"name":"I think making a dll in TSQL might be easier than a custom function"}]},{"@type":"WebSite","@id":"https:\/\/elbsolutions.com\/projects\/#website","url":"https:\/\/elbsolutions.com\/projects\/","name":"ELB Solutions.com Inc.","description":"Bringing all your IT Pieces together","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/elbsolutions.com\/projects\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/elbsolutions.com\/projects\/#\/schema\/person\/51e717c68f4f5917c63baf88f0896c39","name":"Etienne Bley","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g","caption":"Etienne Bley"},"url":"https:\/\/elbsolutions.com\/projects\/author\/etienne-bley\/"}]}},"_links":{"self":[{"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/posts\/1340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/comments?post=1340"}],"version-history":[{"count":8,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/posts\/1340\/revisions"}],"predecessor-version":[{"id":2703,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/posts\/1340\/revisions\/2703"}],"wp:attachment":[{"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/media?parent=1340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/categories?post=1340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/tags?post=1340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}