Contact Me

Contact Us
For an informal discussion

Everyone's business is different. Our business is software - ask where we can help.
eMail: john at appsolo.com

Assigning users to a SQL database

Posted on Thursday, 22nd July, 2010

Filing this under ‘embarrassing errors’ heading, I’m hopeful that others have stumbled upon the same problem and so view this as a public safety broadcast-like post. In the current project, we’re (too regularly) updating our data model and this means dropping and re-scripting the database. The last step is to add a user with privileges to work on the database. And it’s here that 30 minutes of my life were needlessly wasted so listen up!

image thumb3 Assigning users to a SQL databaseHaving dropped the old database (called, say, dbOne), the user login previously associated (as dbo) still naturally exists – and maintains its dbo status on that (now gone) database. After running the script to re-instate the new version of the database, the user (we call him tax_user) re-asserts its dbo rights on the database. However, when you try to add that user as a ‘New User’ to dbOne I got an error:

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

 

The rationale behind the error message is that that user (tax_user) is already associated with the database. It isn’t obvious that he is since he doesn’t appear in the list of users in the Security folder for that database. When you take a look at tax_user you may see that the default database for him is dbOne and you may be forgiven for thinking that all you need to do is change this. However, it isn’t enough – you have to delve into the User Mapping section and remove the user as dbo on the dbOne. Of course, it might be just easier to recreate tax_user. In any case, once you’re removed any reference to dbOne from tax_user, you’re good to add tax_user as a ‘New User’ for dbOne.

Now go forth and sin no more!

Comments are closed.

latest news

Running a web site hosting SL4 OOB on local host using II express

Posted on Saturday, 4th February, 2012

Free Tools available:
IIS Express free download
Visual Studio 2010 express free download (there might be a licensing issue here)
or Visual Web developer express 2010
SQL Server 2008  Express R2 free download (2010 version is available in RC0 version)
Making sure that IIS Express is installed you can develop against it
So you create your web site and client [...]

Testimonials

Excellent design skills

Posted on Sunday, 2nd May, 2010

We at Taxonomy.ie are happy to be associated with Appsolo and look forward to further work together.

follow me

twitter facebook delicious

AppsoloLtd. VAT No. IE97548691 - Copyright © 2010.