How to migrate all post from User 1 to User 2
Asked by Kgi IT:

![confluence.jpg](/t5/image/serverpage/image-id/45140i30694255BADEF053/image-size/large?v=v2&px=999 "confluence.jpg")Hi Support,

Please help us migrate all current post from user 1 to user 2.

We need to remove the user that is manually created and replace with Active Directory users.

The problem is User 1 has a lot of post already and we need to limit the number of users.

See attached file for more details.

Thanks,

John


Answers:
author: Kgi IT
body: Hi Alexey,

Good Day!

Thank you for the reply,

I have additional problem as both users are not on the same directory.

Please see attached file for more details.

![1.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/45157iA9EFA069A682FF8D/image-size/large?v=v2&px=999 "1.jpg")

![2.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/45158i7D81859FB7AEF241/image-size/large?v=v2&px=999 "2.jpg")

Do get back to me if you have additional information needed.

<br />

Thanks,

John

comments: author: Alexey Matveev
body: Hello,

It actually does not matter, you still need to execute sql queries, which are provided in the document. But you should try first in a test server.


author: Kgi IT
body: Hi,

Good Day!

I have problem on step 11.

<https://confluence.atlassian.com/confkb/how-to-transfer-content-ownership-in-between-users-958450595.html>

    update spacepermissions set permusername = tmp_user_mapping_migration.new_user_key from tmp_user_mapping_migration where spacepermissions.permusername = tmp_user_mapping_migration.old_user_key;

![1.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/45586iFECCE18D5942EEF4/image-size/large?v=v2&px=999 "1.jpg")

Thanks,

John


author: Kgi IT
body: Hi,

Good Day!

I manage to pass the 11 step.

I'm on the 12 Step now.

I encountered another error.

![1.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/45603i6A6217AB52FC070A/image-size/large?v=v2&px=999 "1.jpg")

Thanks,

John


author: Kgi IT
body: UPDATE SPACES set SPACEKEY = '\~'+ newusername, LOWERSPACEKEY = '\~' + newusername FROM tmp_usermigration u WHERE LOWERSPACEKEY = '\~' + u.oldusername;


author: Alexey Matveev
body: I guess, something wrong with the syntaxis. I am not mush into MS SQL Server and I do not have it installed to check it.


author: Kgi IT
body: Hi Alexey.

Good Day!

Thank you for the support.

I manage to resolve the problem.

    update spacepermissions set permusername = tmp_user_mapping_migration.new_user_key from tmp_user_mapping_migration where spacepermissions.permusername = tmp_user_mapping_migration.old_user_key;

Please update the documentation and set the character in**upper case** for tables name and column name.

second issue is;

UPDATE SPACES set SPACEKEY = '\~'+ newusername, LOWERSPACEKEY = '\~' + newusername FROM tmp_usermigration u WHERE LOWERSPACEKEY = '\~' + u.oldusername;

change the \|\| sign to **+** means to concatenate.

You can close the ticket and marked it as resolve.

Thanks,

John


author: Alexey Matveev
body: Hello,

I am a Jira user like you, that is why I can not change documentation.

To close this ticket, just push the Accept Answer button.


author: Alexey Matveev
body: Hello,

Kindly have a look at this KB:

<https://confluence.atlassian.com/confkb/how-to-transfer-content-ownership-in-between-users-958450595.html>


Tags: confluence-server

server