Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Remove user from Login

Author  Topic 

mattt
Posting Yak Master

194 Posts

Posted - 2011-06-24 : 11:32:13
Hi,

As part of my current project, I need to map an existing user with an existing login, do some work with that user, and then un-map the user from the login.

Easy enough to find the syntax to do the mapping:

alter user <user> with login = <login>


But I can't work out how to remove the mapping again when I'm finished. Anyone help me out?

Cheers,
Matt

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-06-24 : 11:46:27
Look at the original login and map to that when you have finished?


==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

mattt
Posting Yak Master

194 Posts

Posted - 2011-06-24 : 11:59:18
quote:
Originally posted by nigelrivett

Look at the original login and map to that when you have finished?



I'm not sure what you mean. Excuse my stupidity but can a user only map to one login at once?
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-06-24 : 12:25:10
Yes, your alter statement is moving the user from one login to another. When you have finished move it back to the original login.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -