|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, November 19, 2012 9:09 AM
Points: 2,
Visits: 2
|
|
| In SQL Server 2012, I want to remove (programmatically in C# or via SQL command line) a login mapping to a user. I have a login that is mapped to a database user and I want to remove that mapping without removing the login, user or database.
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 2:04 PM
Points: 11,645,
Visits: 27,732
|
|
looks like it cannot be done; my knee jerk reaction was to see if ALTER USER supported WITHOUT LOGIN, which it does not; my next idea was to ALTER USER WITH LOGIN = NULL, which is also not supported.
--syntax errors: ALTER USER SampleUser WITHOUT LOGIN ALTER USER SampleUser WITH LOGIN = NULL
i think it's better to drop and recreate the user without login? then you can alter thema nd remap them to the login?
DROP USER SampleUser CREATE USER SampleUser WITHOUT LOGIN
maybe you could move the user out of it's existing roles so it effectively cannot do anything in the database instead?
Lowell
--There is no spoon, and there's no default ORDER BY in sql server either. Actually, Common Sense is so rare, it should be considered a Superpower. --my son
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, November 19, 2012 9:09 AM
Points: 2,
Visits: 2
|
|
| Thanks. The DROP USER will work for me.
|
|
|
|