{"id":178,"date":"2006-12-21T12:04:21","date_gmt":"2006-12-21T10:04:21","guid":{"rendered":"http:\/\/soci.hu\/blog\/index.php\/2006\/12\/21\/string-split-sql-ben-masodszor\/"},"modified":"2006-12-21T12:04:21","modified_gmt":"2006-12-21T10:04:21","slug":"string-split-sql-ben-masodszor","status":"publish","type":"post","link":"https:\/\/soci.hu\/blog\/index.php\/2006\/12\/21\/string-split-sql-ben-masodszor\/","title":{"rendered":"String split SQL-ben, m\u00e1sodszor"},"content":{"rendered":"<p>Kor\u00e1bbi <a href=\"http:\/\/soci.hu\/blog\/index.php\/2006\/12\/20\/szellemes-stringsplit-tsqlhez\/\" target=\"_blank\">bejegyz\u00e9semben<\/a> bemutattam egy agyament string splitet, tiszt\u00e1n sql lek\u00e9rdez\u00e9ssel megoldva. \u00c9n az\u00e9rt annyira nem iszonyodok a procedur\u00e1lis m\u00f3dszerekt\u0151l, f\u0151leg, ha azok 100-szor \u00e1tl\u00e1that\u00f3bb k\u00f3dot eredm\u00e9nyeznek, mint ama perverz p\u00e9lda. \u00c9n valahogy \u00edgy spliteltem legut\u00f3bb egy feladat kapcs\u00e1n:<\/p>\n<p>declare\u00a0@path nvarchar(2048)<br \/>\nset @path = &#8216;\/alma\/korte\/barack&#8217;<\/p>\n<p>declare @slash_pos int, @next_slash int<br \/>\ndeclare @path_component nvarchar(256)<br \/>\ndeclare @path_prepared nvarchar(2050)<br \/>\nset @slash_pos = 1<\/p>\n<p>if (right(@path, 1) != &#8216;\/&#8217;)<br \/>\n\u00a0set @path_prepared = @path + &#8216;\/&#8217;<br \/>\nelse<br \/>\n\u00a0set @path_prepared = @path<\/p>\n<p>while(@slash_pos < len(@path))\nbegin\n\u00a0set @next_slash = charindex('\/', @path_prepared, @slash_pos+1)\n\u00a0set @path_component = substring(@path_prepared, @slash_pos+1, @next_slash-@slash_pos-1)\n\u00a0set @slash_pos = @next_slash\n\n\u00a0print @path_component\nend\n\nNekem ez ezerszer \u00e1tl\u00e1that\u00f3bb, mint a t\u00e1bl\u00e1s-hekkel\u0151s megold\u00e1s.\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kor\u00e1bbi bejegyz\u00e9semben bemutattam egy agyament string splitet, tiszt\u00e1n sql lek\u00e9rdez\u00e9ssel megoldva. \u00c9n az\u00e9rt annyira nem iszonyodok a procedur\u00e1lis m\u00f3dszerekt\u0151l, f\u0151leg, ha azok&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-178","post","type-post","status-publish","format-standard","hentry","category-sql-server"],"_links":{"self":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/178","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=178"}],"version-history":[{"count":0,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/178\/revisions"}],"wp:attachment":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}