Move a node and sub-nodes in a hierarchyid

I have a hierarchyid that's roughly like this:
/1/...
/2/
I want to move /1/... so that it and all its children are below /2, so that the new hierarchy table looks like this
/2/1/....
I've followed this example
but it only moves the children of /1 and not /1 itself. I'd like to move /1 itself and all its children. I can't just specify / as the old parent, because that would include /2 and I'm sure it would chuck a huge wobbly anyway!
So, how can I move a node and it's children, and not just the children?
Thanks.

I found the correct example from Microsoft, and it has saved me from digging myself into a deeper hole (as I was, trying to mangle that other example to death!)
http://technet.microsoft.com/en-us/library/bb677173.aspx#BKMK_MovingSubtrees

Similar Messages

  • Email and sub acounts

    Is there any way I can move my email and sub accounts over to my verizon business accounts?

    Yes, depending on your services you'll need either a "repoint" or a "scrub." You will have to contact Verizon's tech support to get it done though. They have options available on their Contact Us page.
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.
    "All knowledge is worth having."

  • Move a node inside a XML (Jdev 11.1.1)

    Hello to all,
    I'm trying to write a query to move a node inside a XML.
    For example from:
    <root>
    <fields>
    <field id="1">...</field>
    <field id="2">...</field>
    <field id="3">...</field>
    <field id="4">...</field>
    *<field id="5">...</field>*
    </fields>
    </root>
    to:
    <root>
    <fields>
    <field id="1">...</field>
    *<field id="5">...</field>*
    <field id="2">...</field>
    <field id="3">...</field>
    <field id="4">...</field>
    </fields>
    </root>
    I can do this by 3 steps:
    1. exctractnode +//field[@id="5"]+ for recovering <field id="5">...</field>
    2. deleteXML for node +//field[@id="5"]+
    3. insertXMLBefore +//field[@id="2"]+
    Is it possible to do this in only 1 step and for multiple DOMs? (I need to do this in java)
    Thank you,
    Cristian
    Edited by: baol on 3-feb-2011 5.53

    And it not make a real UPDATE on XMLTYPE fileld XML on my table Document.Then make it an UPDATE :)
    SQL> create table document (
      2   doc_id number,
      3   xml    xmltype
      4  );
    Table created
    SQL> insert into document values(1,
      2  xmltype('<root>
      3    <fields>
      4      <field id="1">F1</field>
      5      <field id="2">F2</field>
      6      <field id="3">F3</field>
      7      <field id="4">F4</field>
      8      <field id="5">F5</field>
      9    </fields>
    10  </root>')
    11  );
    1 row inserted
    SQL> update document d
      2  set d.xml =
      3         insertXMLBefore(
      4           deleteXML(
      5             d.xml,
      6             '//field[@id="5"]'
      7           ),
      8           '//field[@id="2"]',
      9           XMLQuery('$d//field[@id="5"]' passing d.xml as "d" returning content)
    10         )
    11  where d.doc_id = 1
    12  ;
    1 row updated
    SQL> set long 10000
    SQL> select xmlserialize(document xml as clob indent) from document;
    XMLSERIALIZE(DOCUMENTXMLASCLOB
    <root>
      <fields>
        <field id="1">F1</field>
        <field id="5">F5</field>
        <field id="2">F2</field>
        <field id="3">F3</field>
        <field id="4">F4</field>
      </fields>
    </root>
    And since you're working with java, don't forget to use bind variables to execute the statement.
    Something like (not tested) :
    update document d
    set d.xml =
           insertXMLBefore(
             deleteXML(
               d.xml,
               '//field[@id="'|| ? ||'"]'
             '//field[@id="'|| ? ||'"]',
             XMLQuery('$d//field[@id=$ID]'
               passing d.xml as "d",
                       ? as "ID"
               returning content
    where d.doc_id = 1
    ;

  • I am struggling! Help! I need to move 3500 pics-in TIFF format in 175 folders and sub folders from my old PSE6, Windows XP to my new PSE13, Windows8.1. I have the PSE6 backed up on an external hard drive. What is the safe way to do this? Can anyone at Ado

    I am struggling! Help! I need to move 3500 pics-in TIFF format in 175 folders and sub folders from my old PSE6, Windows XP to my new PSE13, Windows8.1. I have the PSE6 backed up on an external hard drive. What is the safe way to do this? Can anyone at Adobe help me? Please?

    Use the Organizer backup & restore method, starting the restore from the TLY file. Probably best to use a custom location as the XP file structure will be different. See this link for further help:
    http://helpx.adobe.com/photoshop-elements/kb/backup-restore-move-catalog-photoshop.html

  • Best way to move the distribution and subscriber to another server

    What is the best way to move the distribution and subscriber role to a different server for transactional replication?
    Stop activity on the publisher then script out the drop and create and point to the new ones?
    The publisher will remain the same server.
    Thank you!
    Paula

    Hi Paula,
    According to your description, you want to move distribution database and subscription database to a different server.
    Firstly, to move distribution database without dropping and recreating the replication topology, you could follow the steps in the
    article . However, the best way I recommend is to remove the replication, create the distribution on the new server, and recreate publication and subscription.
    To make this process simple, you could use SQL Server Management Studio (SSMS) to generate scripts and run the scripts to recreate publications and subscriptions or drop publications and subscriptions as the screenshot below. Checking ‘To create or enable
    the components’ generates the script for creating the publications and subscriptions, and Checking ‘To drop or disable the components’ generates the script for dropping the publications and subscriptions.
    Firstly, please use SSMS to generate the script which is used to create publications and subscriptions.
    1.Connect to Publisher, or Subscriber in SSMS, and then expand the server node.
    2.Right-click the Replication folder, and then click Generate Scripts.
    3.In the Generate SQL Script dialog box, check ‘To create or enable the components’.
    4.Click Script to File.
    5.Enter a file name in the Script File Location dialog box, and then click Save. A status message is displayed.
    6.Click OK, and then click Close. For more information about the process, please refer to the article:
    http://msdn.microsoft.com/en-us/library/ms152483.aspx.
    Secondly, follow the steps above, check ‘To drop or disable the components’ to generate the script used to drop publications and subscriptions. Then run the script to drop publications and subscriptions.
    Thirdly, please disable distribution using Transact-SQL or SSMS following the steps in the article:
    http://technet.microsoft.com/en-us/library/ms152757(v=sql.105).aspx.
    Fourthly, please create the distribution at the new server using Transact-SQL or SSMS following the steps in the article:
    http://msdn.microsoft.com/en-us/library/ms151192.aspx#TsqlProcedure.
    Last, please run the script generated in the first step to recreate publications and subscriptions.
    Regards,
    Michelle Li
    If you have any feedback on our support, please click
    here.

  • How do I manging multiple copies of movies for AppleTV and iPod in iTunes?

    I do not have an AppleTV yet, but I am considering getting one. I was wondering how those who have both an iPod and ATV manage the syncing of Movies that may have different resolutions?
    If I want to have the same movie on ATV and my iPod I would need two copies in iTunes at different resolutions, correct? At least when I look at the iTunes export in iMovie it shows I can have a higher resolution for the ATV than the iPod.
    So, how do you manage the auto syncing of these multiple copies so that they aren't all copied to both devices? iTunes doesn't have good Movie management as far as sub-folders, etc. I would like iTunes to treat these copies as one movie and only sync the appropriate resolution for the device.
    I also notice that multiple copies then show up in FrontRow as well. It would be nice if only the highest resolution would show up.
    Thanks,
    Scott

    Just create 2 different playlists like
    Movie-ATV
    Movie-iPod
    Put those video files with higher resolution on playlist Movie-ATV
    Put those video files with lower resolution on playlist Movie-iPod
    in iTunes Preferences choose your ATV only to sync the 1st movie playlist - and your iPod only to sync the 2nd one.

  • Using Site Content and Structure unable to move documents,pages and getting weird error message

    Hi ,
    earlier we are moving a page ,document from one site to another sub site with in the Site Collection.
    Now,we are getting a un-readable format error.
    After selecting the destination we are getting the error.
    and the file can't move.
    What might me be the error.
    Expecting answers related to my question.
    1.As we can do using Internet Explorer,
    2. Using Send To also we can move.
    Using this Site Content and structure we can maintain Versoining also.
    If any one face the same issue then we can easily find out the solution.
    Regards ,
    Prathap 
    SP Developer
    Specify the destination to move the items you selected.

    Hi,
    Using Site Content and Structure unable to move documents,pages and getting weird error message
    We are getting Below error:
    When Moving Document items from one site to another site in the same site collection using Site content and structure(But it's working in same site,we can move documents from one library to another library)
    1576|/wEWwwECuLLErw0Cy+nFYwK84baBAgK6zNqsAgLs0Le0BQK1s8uaCAL5qrm3CAKk7K6pDwKo9a0GArm+xr4NApKe9KUKAoajpK4CAqqU/2sChJXBtAIC052rYQKS+LTPAgLe+7uQAwLO0re/BwLgoaw2AojAlIMOApSO4JoNAuvW7MoKAojz2P4OAuOMt9EGAv/ns1wC64qI7gEC0LymmAcCro3lnQkCj7viwAsC8Met9QEC3a/DHALg4ZO6AQKAn8ebCALvr72DAwKm/NGmAgKN4aayCQLmmczsCgL+46qSAQKH7paCDgLouOHjDwKGuNCBCQKwuob2CQKP78n3BwLQ7vSYCALxlcvIBALRuajXAwK6/vr4AwKx8YasCQLti5igAQKay7JZAta625IFAuTy6rUKAvnC7eQKApvB3ugPAoTBua8BAoyajvgMAsGdloEJAvH+2KECAua7k9AGAv3Lzd8HAtPD3ocOAuX7hM4GAqO1g9sIAtn65sgFAuDkr9QEAt7I1KkMAryhltsIAtizx/kBAvzS7IcBAr+YhK4PAsO3rtADAvea+sADAsvc4IgKAp/1vIoMApelp3ICl+PqiwwC/KX1gwUC3fv58gIC7ZG/pwIC4cnupQgCq7mdlgYCjciR+AwC8/ue4gkC4YWJywUCs+rviAECpuyJigECkfr5rgkC08rHoQ0C+erayQUCjMqStQkCpIuKtwEC+dG5ngICoZ3/og0CspXoxwwC+pzgmwwCkoD5mAYCn/qH2AcC/N/pvAcCv5OtwAICuZquqgcC0/OFnwkC2/2wzQMCrJrO9woC69G52ggC64nunggCtLOIsQEC9LyC7gUC0ry/zgIC1ZDvgQ0C98OfMgL4kaj3CQKXhebCCwKi3bjPBQKYuojTCAKc4+fxCAKyjLfoBALVxO8SAsXSyuQLAqyvkNIPApDV5PgDAtufwJwEAu2BsoYLAs3Oqd8PAo6i+YMDAsy706oCAsLjx7kLApu3+9gKAuLnvMoIAtWywo8OAv6MjvIHAtSDhJwNArXRmL0LAraZvUcC5cGygQoCz5HN7A0C+YzY9AMCmtWQ6AUC/oHF8w4CxeTgmg8CgszujQECss22vgYCp6HBuggCkfm+FAKngqb5BgKkuIzAAQKPspKCCQLu+eDvCwKf5YrEBQKl0M3ACgKm85DvDALCu/nfCwLbwO38DgLoz5eyDQLfr9XLCwL20/eUDgL7hpr3DAKh1tfbCgL48OuNBwK4tuKaCALpgbn5CgLC4dKvBgKKlu76CwKfhKLJAQLurPTIAwLG0o+hAgKI5Y6dDALq+OOlCQKxjuuICAK8yrLHBwLcrOSSAwLoiJfQCwKKyvrtBALXkbCBCgKt4bG9BQLr6qnxCwLC2pz2DQKQ7OuZBALt7t+DDAKR47b8CAKi6pPGCQKLl4r3CQK5yfj+AwLgzYvjDwKUjerODQK7mOPTCQL9qP3qBgKYiOL9AgLA8pSaBwKay8fBDQLqw93DCgKkjpf/CwLsyquQCwKtpbGsDALMtKmxBwKPpvCmBOAFHtmBuG3iNmIT9fQ8Z1TWMpjZ122|cccccccccnncnnnnn|

  • How do I create a message box for a listbox, with a 'move item up' and a 'move item down' button?

    In my listbox I want to create an error message for when I click the 'move item up' button and the item is already at the top of the list, but I am not sure how to do it.
    Here is the code I have right now:
    if (ListBox. )
    MessageBox.Show("Item is already at the top of list.");
    return;
    I also want to know how I would do the same for a 'move item down' button (if it is at the bottom of the list and I click 'move item down' button).
    Thanks.

    Here is the code,
    C#
    public void button1_click(object sender, EventArgs e)
    if (ListBox1.SelectedIndex == 0) {
    //MSGBOX
    return;
    //'Your move up code
    public void button2_click(object sender, EventArgs e)
    if (ListBox1.SelectedIndex == ListBox1.Items.Count - 1) {
    //MSGBOX
    return;
    //'Your move down code
    Insert each code in their own buttons.
    VB.net
    Public Sub button1_click(sender As Object, e As EventArgs) Handles UpButton.click
    If ListBox1.SelectedIndex = 0 Then
    'MSGBOX
    Exit Sub
    End If
    ''Your move up code
    End Sub
    Public Sub button2_click(sender As Object, e As EventArgs) Handles DownButton.click
    If ListBox1.SelectedIndex = ListBox1.Items.Count - 1 Then
    'MSGBOX
    Exit Sub
    End If
    ''Your move down code
    End Sub

  • How does idx and sub files work?

    How can I get idx and sub files to work on quicktime and apple tv? I have a mp4 movie with those subtitle files and wonder how they work.
    Message was edited by: elangsru

    Go to ine.com and sign up for a free membership. They offer free streaming of the CCNA R/S and CCNA Voice videos. You can also use Google to find many resources to read on.

  • Book numbering properties window – Section and Sub-section grayed out

    In FM 12, I have a book composed of one front-matter file and 9 chapter files. The chapters (1-9) auto-numbered without any problems and pagination is correct. I want to add section and subsection numbers. Within each file I added autonumber format tags to the headers used specifically for section and subsection titles on the first chapter page and autonumber format tags within the body of the chapters. The autonumber tags are –
    <$chapnum>.<$sectionnum>\t
    <$chapnum>.<$sectionnum>.<$subsectionnum>\t
    for paragraph tags Heading 2 and Heading 3, respectfully.
    When I select numbering in the book file window and click on either the Section and Sub-section tab, the windows are grayed out. I know I'm missing something obvious. I've gone through help files, manuals and tutorials for hours and can't find what I need. Any advice about where I can look to sort this out?
    Thank you.

    Almost, but not quite. FM books (now) have the ability to specify internal Folders and Groups. You can then assign (i.e. move) the relevant FM files into these structures to create more of a hierarchical structure in the book - see: Adobe FrameMaker 12 * About books and also see: Numbering in Hierarchical Books « TechComm Central by Adobe
    Once the file is assigned to a folder or sub-folder, then the section and subsection numbering properties become available for that file.

  • In which sequence are queries and sub-queries executed by the SQL Engine

    In which sequence are queries and sub-queries executed by the SQL Engine?
    Which is correct ?
    a. primary query -> sub query -> sub sub query and so on
    b. sub sub query -> sub query -> prime query
    c. the whole query is interpreted at one time
    d. there is no fixed sequence of interpretation, the query parser takes a decision on the fly

    In which sequence are queries and sub-queries executed by the SQL Engine?
    Which is correct ?
    a. primary query -> sub query -> sub sub query and so on
    b. sub sub query -> sub query -> prime query
    c. the whole query is interpreted at one time
    d. there is no fixed sequence of interpretation, the query parser takes a decision on the fly
    Hi, below may help you understanding simple subquery & correlated subquery
    refer :
    http://sqlmag.com/t-sql/t-sql-starters-simple-and-correlated-subqueries
    a) if it is correlated subquery
     A correlated subquery is one that depends on a value in the outer query. In programming terms, you pass the subroutine an argument, then the subroutine evaluates the query and returns a result. You move on to the next record and repeat the process. The
    net effect is that the subquery runs once for every row in the main query; this situation is inefficient.
                                  A possible alternative is to rewrite the correlated subquery as a join. However,
    some situations require a subquery. Eg- IN(with outer table refernce)
    so  main query -> subquery
    b) if it is simple subquery
    A subquery is a query that SQL Server must evaluate before it can process the main query, Eg- IN(with out outer table refernce)
    so subquery-> main query
    c) correlated query interpreted row by row with subquery, while subquery is interpreted at one time(outer table and inner table)
    d) in most case it depends on the whether it is correlated subquery or simple subquery
    Thanks
    Saravana Kumar C

  • When I use the selection tool to move vector points and bend edges, I only see the change in wire frame.

    When I use the selection tool to move vector points and bend edges, I only see the change in wire frame.  Once I commit by letting go of the mouse button, the object does change.  It just previews with a wire frame. I would like to see the preview change on the solid object.  Is there a setting somewhere?
    I sure hope I am explaining this for people to understand .
    Thanks
    Ed

    Hi Ed,
    What do you mean by wire frame??And are you using selection or sub-selection tool since you have mentioned about vector point I doubt if it is sub-selection tool.Could you please attach a video demonstrating the issue where we see the mismatch in the preview and the output, so that we can understand the problem better and try to resolve it.
    Thanks,
    Sangeeta

  • PGI for both main and sub items (Sales BOM)

    Hello SD friends,
    I'm trying to map some BOM scenario.
    Only main item should be relevant for princing.
    Here's what I've done :
    1. Create sales BOM via CS01
    2. Maintain item category group ERLA for main item and NORM for sub item MM01
    3. Maintain item category TAQ for main item and TAE for sub item VOV4
    When I wanna do PGI, system creates material document only for main item.
    Which means that PGI has not been done for sub items.
    Is there any way to make PGI possible for both main and sub items ??
    Regards,
    Bahia.

    Can you clear, that why you want to issue both Main item/Sub Item, where your pricing is @ main item level.
    in Main item level Pricing, Main item itself includes components. Once you issue the main item. from Inventory this main item wil be reduced.
    Eg:  In Case of Main Item- Computer (Assume Components - Monitor , Keyboard , CPU & Mouse)
    Price for Computer - $1200.   Component prices individually- $300 , $100, $700, $100 - These prices applicable only when you sell as BOM at Subitem level Pricing Or Seperately )-
    In SO: - Order Computer (System explodes Components to verify,which are the subitems consists in Main Item)
      DEL:-  Components will be copied in Delivery , but not for dispatch (Sch Line Cat:CT has these controls)
    Inv: Only Main item will be displayed for print.
    NOTE:  for your requirement, you can change the Schline Category from CT - CN- which is relevant for delivery with movement type i601 -in SO. Then you can dispatch components & these components will not copied into Invoice ,as they are not relevant for billing.
    If you want CN has to determined automatically, maintain Schline Category determination accordingly.
    Hope it helps,
    Any info, please revert

  • Audigy 2 + Logitech Z680 speakers, only center channel and sub work

    I have an audigy 2 and logitech z680 speakers, and only the center channel and sub are working. I have tried reinstalling drivers, unplugging and replugging everything, i even moved the soundcard to a different pci port. Whenever i try to install any creative things, it tells me that it cannot find any required components. (anything creative). If anyone has had a similar problem or can help, i could use any help i can get. Thanks!
    Also, i recently moved the whole system from school to home, and since then it hasn't been working correctly.
    Thanks

    Ok, so now I tried to play a DVD movie with my DVD-drive. Before I got this new Audigy sound card and SBS 580 speakers, movies would run almost fine, as in the video and sound would be smooth unless there was a great deal of action occurring, in which case it would be slightly choppy. But now, the video seems to change pace, occasionally stopping entirely for a few seconds, then running again, but slowly, then running normal, then becoming choppy, stopping again, and so on. Also, the sound does the same, sounding almost normal one second and choppy the next. But the biggest deal is the fact that I don't hear any speech! I read somewhere that the center channel handles speech in video playback, and without it I can't hear any talking.
    Is the subwoofers center channel broken and should I go get another set with the warranty, or whats the problem?

  • I use my ipod for audible books downloads. In the past I have been able to move books back and forth from library to ipod according to what I was listening to.  I can no longer retreive books in the library. Any suggestions?

    I use  my 6th generation Ipod strictly for Audible downloads.  In the past, I have been able to move titles back and forth from the Ipod and my Itunes library, to control the amount books on the ipod. Recently, an exclamation mark has appeared next to the titles as I try to transfer to the ipod, and the book does not transfer.  Any suggestions on how to regain access to my purchased library? 

    1. You did not get an error message telling you that your iPhoto library was getting full. You got a message telling you that your HD was getting full, right?
    OS X needs about 10 gigs of hard drive space for normal OS operations - things like virtual memory, temporary files and so on.
    Without this space your Mac will slow down as the OS hunts for space on the disk, files will be fragmented, also slowing things down, apps will crash and the risk of data corruption - that is damage to your files, photos, music - increases exponentially.
    Your first priority is to make more space on that HD. Nothing else can be done until you do.
    Purchase an external HD and move your Photos and Music to it. Both iPhoto and iTunes can run perfectly well with the Library on an external disk.
    Your Library has been damaged from being run on an overfull disk.
    How much free space on it now?

Maybe you are looking for

  • How can I use an international credit card when I bought my iPad in china and currently a residence of china?

    I want to purchase apps and because I reside in CHina the options for payment are Chinese banks and yet I hold an international credit card. I want to pay for my apps and unfortunately because I am not a Chinese citizen, I don't hold a local credit c

  • Can anyone see the video at this website?

    Hi folks, I'm using Safari 5.0.3 and I'm trying to watch coverage (live) of the Egyptian protests. When I go to this webpage I can hear the report but I can't see the video. Then a little popup shows up saying there's a plug-in problem. Is there a pl

  • T420i screen brightness issue

    This one is a little hard to explain. I should note that this only happens when I am not plugged in with an AC adapter. On my brand new Thinkpad, my screen's backlight will brighten when there is a lighter image on the screen and dim when there is a

  • Finder crashes whenever a downloaded file gets chosen to "Show In Finder"

    It happens after some files are downloaded, and it doesn't matter what type of files they are. If there is a folder open on the desktop and the downloads window is open, ctrl + click the file, choose "show in finder" and the folders all reset to show

  • PST File Password Recovery

    Dear All,  How can I recover PST file password in Outlook 2003.  Is there any paid tool or some method to recover pst password? Many thanks!