In Dynamics NAV 2009 Service Pack 1 also later Builds on SQL Server 2005, SQL Server 2008 also SQL Server 2008 R2, when a new user is created and synchronised sometimes following error is thrown.
15023, "42000" User, group, or role '<Name>' already exists in the current database.
SQL: CREATE USER [<Name>] FOR LOGIN [<Name>]
Possible Reason of the Error:
In this NAV Version when a new user is created in NAV Database it is also added in Master Database, but when deleting the same User from NAV Client it is not deleted from Master Database. It might also be possible that this user was manually added to Master Database or already existing due to other requirements.
So once you create this user again in NAV it is not checked if the User already exists in Master Database. So this error is thrown by the NAV Client.
To void this error please check if this User exists already in the Master Database, if yes delete the User first from the Master Database and then add the user from NAV Client and this time Synchronisation should work without error.
thank you for your blog entry. In addition to your comments I also had the effect, that lower- and uppercase prevented NAV from finding the SQL user (depending on collation) and some German "Sonderzeichen" in usernames always make trouble.
Thank you Arvind for your post. With this information, I corrected my issue in NAV 2009 R2. For the users that were presenting the error, I deleted them from the Master Database and was immediately able to add them to the Windows Logins in NAV. Thank you for posting this information. Yay.