Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Hi guys when I try to create user for my database I always encounter this kind of error.

This is the sequence of task I done.

I manage to create new login using windows authentication of SQL then I use that login to access SQL Server again then I create my database and set the owner of that database to the login that I was created. After creating the database, I try to create new user and assign the login I use but I was halted by this error.

This question came from our site for professional and enthusiast programmers.

1

Isn't all just written in this error mesage? ;) Check user list of this database where you would like to create a new user. One login could be mapped to one user in given database.
–
rscNov 16 '11 at 7:59

how can i do that. when creating database it automatically set the logged user as the owner of the database
–
RobNov 16 '11 at 8:13

my only concern here is to create new schema for my database. do i get wrong about doing it so
–
RobNov 16 '11 at 8:12

Are you doing this to learn or for a real project? I ask because, the type of project someone might higher someone at your experience level to do is one that most likely wouldn't require you to make any users. You may be trying to do more work than is necessary.
–
Brandon MooreNov 16 '11 at 8:22

In other words, don't bother making any users unless you know you need to. There is the default dbo user already there that will automatically get used for everything you need to do without you having to specify it anywhere.
–
Brandon MooreNov 16 '11 at 8:24

I ran into this just now with SQLSERVER 2012 (or actually SQLEXPRESS but I think the principle's the same). I created a connection string and attached an .MDF file to my Visual Studio C# web application project. When I try to run the solution, I get this error:

I'm not that concerned about security right now, this is just a prototype, so I simply want to use my everyday Windows credentials to access the "server" (actually the same notebook), and then log into the database specific to my application.

So having seen the above error message I fire up SSMS and make sure 'PC-NAME\My windows login' is listed among the logins. It is indeed listed, with pretty much every possible role and privilege. I check the application database "DB". Aha! there's no such user, or so it seems. Yet when I try to add user 'PC-NAME\My windows login' to the app database, I now get this error:

The login already has an account under a different user name. (Microsoft SQL Server, Error: 15063)

So now what? I think the app database user 'dbo' is the user in question, but I can't delete that users because, apparently, it's also a schema for the database.