Dell Released

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Wednesday, August 21, 2013

Split values over multiple rows with different delimiter meaning

Posted on 5:39 PM by Unknown
Split values over multiple rows with different delimiter meaning



Hi I have table Table1, this table are connected with others 4 tables:

Dim1, Dim2, Dim3, Dim4. In Table1 are different delimeter types:

No delimeter - (X_TEA) nothing to do

.. - (AGEN..XOGI) need to split row with values from AGEN to XOGI from

that dimension table

| - (24|25|LV_11..LV_25) split row in 3 rows with 24 , 25 and LV_11..LV_25

values.

<> - (<>17&<>36&<>61&<>63) split, multiple row with all values from that

dimension where they are not equal to 17, 36, 61, 63

*SQLFiddle*

Table1

| SCHEDULE NAME | LINE NO_ | ROW NO_ | ACCOUNT | DIMENSION 1 TOTALING |

DIMENSION 2 TOTALING | DIMENSION 3 TOTALING | DIMENSION 4

TOTALING |

------------------------------------------------------------------------------------------------------------------------------------------------------------

| MARKETING | 370000 | 1270 | 6 1010 | (null) |

11|12|13|24|25|LV_11..LV_25 | (null) |

(null) |

| MARKETING | 470000 | 1355 | 5 0100 | AGEN..XLIT|XOGI..WIND |

(null) | (null) |

(null) |

| MARKETING | 460000 | 1350 | 5 0103 | (null) |

(null) | (null) |

<>X_MARK_EST&<>ZZ_ZZMARK_BEL |

| MARKETING | 610000 | 1445 | 5 0102 | <>XLIT |

LV_63..LV_72 | (null) |

(null) |

| BIGSALES | 750000 | 1538 | 5 0908 | (null) |

(null) | (null) |

X_TEA |

| REVENUE | 275000 | 1250 | 5 0920 | (null) |

11|25|17|72 | (null) |

(null) |

Dim1

| CODE |

---------

| 11 |

| ACEN |

| AGEN |

| DIDEN |

| GADEN |

| LABEN |

| PADEN |

| XLIT |

| XOGI |

| WIND |

Dim2 (full in sqlfiddle)

| CODE |

---------

| 1 |

|.......|

| 28 |

| 61 |

| 63 |

| 72 |

| LV_11 |

| LV_22 |

| LV_25 |

| LV_63 |

| LV_72 |

Dim4

| CODE |

-----------------

| A_GIGI |

| G_TIGI |

| L_PIM |

| X_MARK_EST |

| X_TEA |

| ZZ_ZZMARK_BEL |

So how to split values over multiple rows with different delimiter

meaning? There probably would need use functions or some other sql server

components...

Desired Result:

| SCHEDULE NAME | LINE NO_ | ROW NO_ | ACCOUNT | DIMENSION 1 TOTALING |

DIMENSION 2 TOTALING | DIMENSION 3 TOTALING | DIMENSION 4

TOTALING |

------------------------------------------------------------------------------------------------------------------------------------------------------------

| MARKETING | 370000 | 1270 | 6 1010 | (null) |

11 | (null) |

(null) |

| MARKETING | 370000 | 1270 | 6 1010 | (null) |

12 | (null) |

(null) |

| MARKETING | 370000 | 1270 | 6 1010 | (null) |

13 | (null) |

(null) |

| MARKETING | 370000 | 1270 | 6 1010 | (null) |

24 | (null) |

(null) |

| MARKETING | 370000 | 1270 | 6 1010 | (null) |

25 | (null) |

(null) |

| MARKETING | 370000 | 1270 | 6 1010 | (null) |

LV_11 | (null) |

(null) |

| MARKETING | 370000 | 1270 | 6 1010 | (null) |

LV_22 | (null) |

(null) |

| MARKETING | 370000 | 1270 | 6 1010 | (null) |

LV_25 | (null) |

(null) |

| MARKETING | 470000 | 1355 | 5 0100 | AGEN |

(null) | (null) |

(null) |

| MARKETING | 470000 | 1355 | 5 0100 | DIDEN |

(null) | (null) |

(null) |

| MARKETING | 470000 | 1355 | 5 0100 | GADEN |

(null) | (null) |

(null) |

| MARKETING | 470000 | 1355 | 5 0100 | LABEN |

(null) | (null) |

(null) |

| MARKETING | 470000 | 1355 | 5 0100 | PADEN |

(null) | (null) |

(null) |

| MARKETING | 470000 | 1355 | 5 0100 | XLIT |

(null) | (null) |

(null) |

| MARKETING | 470000 | 1355 | 5 0100 | XOGI |

(null) | (null) |

(null) |

| MARKETING | 470000 | 1355 | 5 0100 | WIND |

(null) | (null) |

(null) |

| MARKETING | 460000 | 1350 | 5 0103 | (null) |

(null) | (null) | A_GIGI

|

| MARKETING | 460000 | 1350 | 5 0103 | (null) |

(null) | (null) | G_TIGI

|

| MARKETING | 460000 | 1350 | 5 0103 | (null) |

(null) | (null) | L_PIM

|

| MARKETING | 460000 | 1350 | 5 0103 | (null) |

(null) | (null) | X_TEA

|

| MARKETING | 610000 | 1445 | 5 0102 | 11 |

LV_63 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | ACEN |

LV_63 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | AGEN |

LV_63 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | DIDEN |

LV_63 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | GADEN |

LV_63 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | LABEN |

LV_63 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | PADEN |

LV_63 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | XOGI |

LV_63 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | WIND |

LV_63 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | 11 |

LV_72 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | ACEN |

LV_72 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | AGEN |

LV_72 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | DIDEN |

LV_72 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | GADEN |

LV_72 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | LABEN |

LV_72 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | PADEN |

LV_72 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | XOGI |

LV_72 | (null) |

(null) |

| MARKETING | 610000 | 1445 | 5 0102 | WIND |

LV_72 | (null) |

(null) |

| BIGSALES | 750000 | 1538 | 5 0908 | (null) |

(null) | (null) |

X_TEA |

| REVENUE | 275000 | 1250 | 5 0920 | (null) |

11 | (null) |

(null) |

| REVENUE | 275000 | 1250 | 5 0920 | (null) |

25 | (null) |

(null) |

| REVENUE | 275000 | 1250 | 5 0920 | (null) |

17 | (null) |

(null) |

| REVENUE | 275000 | 1250 | 5 0920 | (null) |

72 | (null) |

(null) |

PS. MS SQL SERVER 2008. For this problem I'm using split function in this

answer to split lines over | Split values over multiple rows . But after

that need to split over rest delimeters what I maybe can do... But with

this string <>X_MARK_EST&<>ZZ_ZZMARK_BEL I don't know how to split this

row. And basically I need solution without using some temporaliy tables.
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • The Google Visualization API Query Language: Query parse error: Encountered " "," ", "" at line 1, column 24. Was expecting one of:
    The Google Visualization API Query Language: Query parse error: Encountered " "," ", "" at line 1, column 24. ...
  • Android - error opening file just created
    Android - error opening file just created I'm new to android developement and trying to do some file IO. Whenever I run this block of co...
  • Udated Streak 7 Manual & Quick Start Guide With Honeycomb
    For those of you who bought the Streak 7 before the Honeycomb 3.2 update, you have in your possession an out of date Manual & Quick Star...
  • URL constantly results in a badbox
    URL constantly results in a badbox I am trying to insert a long url into a latex document. I'm using hyperref package to make them click...
  • Cannot connect to SQL Server 2012
    Cannot connect to SQL Server 2012 I'm trying to connect to a SQL Server 2012 database using C#, both the server and program are on the s...
  • fanotify unable monitor entire system for FAN_OPEN_PERM event by multi-threaded program, and to ignore directories
    fanotify unable monitor entire system for FAN_OPEN_PERM event by multi-threaded program, and to ignore directories I want to monitor whole s...
  • Left-justified equations with left tags (so it looks like an enumeration)
    Left-justified equations with left tags (so it looks like an enumeration) I want to make a math enivornment (preferably a customized align/f...
  • Application or Object defined error - VBA Excel 2013
    Application or Object defined error - VBA Excel 2013 I want code to check one column of data for a condition ie: Range Qualification. If the...
  • Should I make multiple SQLite databases for better concurrency?
    Should I make multiple SQLite databases for better concurrency? I'm very new to SQL and relational databases (just started learning last...
  • Receiving null messages on android, how to fix it?
    Receiving null messages on android, how to fix it? I've a galaxy s3 with android 4.1.2 For some reason I don't know why I'm cons...

Categories

  • Games
  • News
  • Streak 5
  • Streak 7
  • Tips

Blog Archive

  • ▼  2013 (124)
    • ▼  August (124)
      • Should I make multiple SQLite databases for better...
      • Difference between Nil and nil and Null in Objecti...
      • Cannot connect to SQL Server 2012
      • Android - error opening file just created
      • PHP SimpleXML doesn't output anything
      • Memory leak (igraph, watts.strogatz.game, get.all....
      • How do I position a div on top of another div
      • Updating foreign key references on the DbContext C...
      • Convert string to DateTime and format
      • call function on click outside of a particular div
      • OperationalError when inserting into sqlite 3 in P...
      • Trying to print a string character by character wi...
      • I need to make my JPanel resize dynamically as new...
      • How to retrieve images from cache memory?
      • how to add jscrollpane to jframe?
      • Query on how to Select Date before the latest Date...
      • Does archive size of tar, zip and rar effect the t...
      • How do I make a DOM object follow a circular path ...
      • how to use for loop for my issue
      • AngularJS - Pass variable from a controller & upda...
      • Windows 2012: how to make power button work in eve...
      • IN OBOUT grid, how to move from first grid to anot...
      • Am I using the form action correctly?
      • Increasing the font size of a webview conflict wit...
      • quicktags "link" button doesn't work, but all othe...
      • Cannot access local variables using systemtap
      • Remove/avoid adding target link to URL
      • Left-justified equations with left tags (so it loo...
      • [ Marriage & Divorce ] Open Question : My boyfrien...
      • livetv2pc)))WaTch (Rugby) Australia vs New Zealand...
      • The Google Visualization API Query Language: Query...
      • iOS 7 phone-number link doesn't work when webpage ...
      • Cross-browser textarea maxlength
      • candied mints storage and transporting long distance
      • how to convert objectHTML into html
      • Mellin transform definition
      • Multiple Google Calendars with one Google Cal ID
      • Dell PowerEdge 2950 PCIe Training Error -- No PCIe...
      • Reset Disk - Windows Storage Server 2012
      • Windows Phone 8 - Keeping background location trac...
      • Django forms design suggestiom
      • Magento Upgrade, getting error with tier prices fr...
      • Bouncing between "Adapter is detached" and "No wra...
      • How to create overlapping - not stacking - shapes ...
      • Enclosing capsules around list based arrays [on hold]
      • Identifying Switch case argument (Perl)
      • asp.net ModalPopupExtender not behaving properly
      • fanotify unable monitor entire system for FAN_OPEN...
      • Jquery UI datepicker inline "onclick" handler caus...
      • URL constantly results in a badbox
      • Split values over multiple rows with different del...
      • How to aggregate data without group by
      • Angular $scope.$watch on (for in... ) don't work
      • Using Modernizr to test browser support for css ca...
      • Content overlapping in navigation menu?
      • cls file - multiple files
      • Differences between "fortification nouns"
      • filtration on the cohomology of a complex
      • Problems with every aspect of facebook that involv...
      • Extract data from last line in a text file using PHP
      • How to properly provide data for ?
      • ConditionalPanel doesn't support variables with do...
      • Frequent out of memory issues
      • Undefine reference for libraries, so How could I f...
      • radio buttons checked with jquery not holding prop...
      • How to modify bash command to change permissions
      • header(Content-type: image/jpeg) not working
      • Removing smart quotes from an SQL server text column
      • Getting out of sync server response
      • thesis work" vs "thesis
      • php radio post wrong same value after submit
      • Several questions about trigonometry and functions
      • A div that adapts to its background
      • Why are there two different versions of the mean a...
      • Restore only some volumes from a multiOS system image
      • system of pde (solid mechanics)
      • Application or Object defined error - VBA Excel 2013
      • Deleting the last few revisions: SVN best practice
      • Choose blackberry 10 platform to use call logs, me...
      • Procedure or function usp_logout has too many argu...
      • how can i use combination of unix signals (like SI...
      • Basic Javascript Countdown Timer Taking Longer Tha...
      • WordPress Guest Author - How can I use custom fiel...
      • button to generate html delete method?
      • socket.io redis ECONNREFUSED
      • Can one http request call multiple css files?
      • .htaccess related codeigniter. why error 404 page ...
      • Undefined symbols error from static framework
      • XML Sitemap Generator for URL with 1.5 million pages?
      • How do I prevent Microsoft DNS from reporting vers...
      • Solve the equation for x, y and z: $\sqrt{x-y+z}=\...
      • A basic doubt on linear dependence of vectors
      • mysql charsets, can I perform the conversion in py...
      • Mirrors Edge video settings are locked
      • Receiving null messages on android, how to fix it?
      • changing an onEdit function to run onOpen
      • Handle Multiple Form tag in asp.net page?
      • Getting click event on parent page of button in frame
      • Fix column width with tabularx
      • best software to use to make a website
  • ►  2012 (6)
    • ►  February (2)
    • ►  January (4)
  • ►  2011 (10)
    • ►  December (1)
    • ►  November (2)
    • ►  October (7)
Powered by Blogger.

About Me

Unknown
View my complete profile