Assign orphan users to a new login

by Allan Svelmøe Hansen January 09, 2009 10:13

If you need to assign an orphan user in MS SQL 2005 - meaning a user without a log in - to a new login, or change the login for a user, simply run the following query:

ALTER USER <userNameWITH login <loginName>  

on the database.
This is a problem which can happen if you for example restore databases to a new server, where you have a user in the database, but no mapped login.

 

Bookmark and Share DotnetKicks dotnetshoutout

Tags: ,

SQL

Comments

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.6.1.0
Theme by Mads Kristensen | Modified by Mooglegiant

About:
Allan Svelmøe Hansen

My real name is Allan Svelmøe Hansen.
I live in Denmark, where I work as a developer for hedal:kruse:brohus using SQL Server and the .NET framework since 2004.
My primary fields of expertise is back-end data integration, database design and optimization.


       View Allan Svelmøe Hansen's profile on LinkedIn     

Disclaimer

The opinions expressed herein are my own personal opinions and thoughts and does not represent my employers view in any way, nor are my results guaranteed for all situations.
Content is presented "as is", with no warranty.