Cause of this error: "The login already has an account under a different user name"  
Author Message
ks2006





PostPosted: Visual Studio Team System - Database Professionals, Cause of this error: "The login already has an account under a different user name" Top

I am getting the following error after importing a database schema (from both SQL 2000 and SQL 2005):

"The login already has an account under a different user name"

The error points to the generated SQL script for the user under the security folder.

Anybody able to explain to me the meaning and cause of this error

Thanks



Visual Studio Team System36  
 
 
Mairead





PostPosted: Visual Studio Team System - Database Professionals, Cause of this error: "The login already has an account under a different user name" Top

Hi

can you provide more information on the user name, is this a standard SQL user that you are trying ot create

mairead

PM, TS Data


 
 
ks2006





PostPosted: Visual Studio Team System - Database Professionals, Cause of this error: "The login already has an account under a different user name" Top

User name is an active directory user (it's of the form DOMAIN\USERID). This is an error that appears in the "Error List" windows in VS 2005 right after a schema import.


 
 
StevenPo





PostPosted: Visual Studio Team System - Database Professionals, Cause of this error: "The login already has an account under a different user name" Top

KS2006 -

Is the user in question a member of the sysadmin role I know that the error will occur when you try to add yourself this way, because the user is the owner of the design-time validation database, and as dbo, they already exist. But I'd only seen this error when someone tries to add themselves as a user, not when they're adding someone else.



 
 
ks2006





PostPosted: Visual Studio Team System - Database Professionals, Cause of this error: "The login already has an account under a different user name" Top

Steve,

You are right. The login ID of the user was mapped to the "dbo" user in the database. That is what was causing the error.

Do you have any suggestion on how to work around this

Thanks


 
 
StevenPo





PostPosted: Visual Studio Team System - Database Professionals, Cause of this error: "The login already has an account under a different user name" Top

The only thing that comes to mind is updating the post-deployment script to add the desired login. Is that a workable solution for you I'll let the team know we've got more people bumping into this issue.

thanks,



 
 
Q1Technology





PostPosted: Visual Studio Team System - Database Professionals, Cause of this error: "The login already has an account under a different user name" Top

I encountered the same codition, but with a different resolution.

SOME-HOW the user group in the database in the restored database was called "SQLAccessGroup {06ab0134-8bbe-40d5-b293-379fe506c4a6}" and it was associated with the login ID "AGF-TEST\SQLAccessGroup {06ab0134-8bbe-40d5-b293-379fe506c4a6}". Subtle difference, but did you catch it The "AGF-Test\" prefix isn't on the User but it is on the Login.

When the install runs the following code it doesn't see the 'AGF-Test\..." user, so it tries to create the user; however, there is already a User Group associated with the login...(puke)...
if not exists (select * from sysusers where name = 'AGF-TEST\SQLAccessGroup {06ab0134-8bbe-40d5-b293-379fe506c4a6}') exec sp_grantdbaccess [AGF-TEST\SQLAccessGroup {06ab0134-8bbe-40d5-b293-379fe506c4a6}]
To remedy the situation in SQL Server 2005 I had to delete the Schema group associated with the bad group, then delete the user in BOTH the MSCRM and METABASE databases. Then I clicked retry and the install completed uneventfully...
Zack Jones ><>
Q1 Technology

 
 
RandomGuy





PostPosted: Visual Studio Team System - Database Professionals, Cause of this error: "The login already has an account under a different user name" Top

Hi,

I deleted ALL the users from my VS DB project (I mean there is no files in the folder Users, also there is no text in pre- and post- deployment scripts)

And despite this fact I'm getting the same error.

I tried to look deeper into the matter and compared the schemas of the project and the DB to which I had unsucessfully tried to deploy it, and this is what I discovered:

For some reasons, during the deployment the VS tries to create a new user which has MY windows account, i.e. it tries to execute lines like so:

IF NOT EXISTS (SELECT * FROM master.dbo.syslogins WHERE loginname = N'DOMAIN-282D649\Login')

CREATE LOGIN [DOMAIN-282D649\Login] FROM WINDOWS

GO

CREATE USER [DOMAIN-282D649\Login] FOR LOGIN [DOMAIN-282D649\Login] WITH DEFAULT_SCHEMA=[dbo]

GRANT CONNECT TO [DOMAIN-282D649\Login]

GO

* DOMAIN - my domain, Login - my login Smile

So, I'm out of ideas as to why on earth it does so, I have not been able to find any settings which would allow me to switch it off. I'm stuck Sad

Could you suggest the way out, please



 
 
Berlingohouse





PostPosted: Visual Studio Team System - Database Professionals, Cause of this error: "The login already has an account under a different user name" Top

I just had at similar problem installing the database for SCCM.

The computer account for the SCCM server had an other login at the SQL server.

I solved the problem using the following commands:

Use Master

Select * from master.sys.server_principals

Drop Login ["OldLoginName"]