Re: SQL Server 2005: Checking if Login is connected to any database
- From: "Uri Dimant" <urid@xxxxxxxxxxx>
- Date: Wed, 23 Aug 2006 15:07:20 +0300
Hi
BOL says
A login cannot be dropped while it is logged in. A login that owns any
securable, server-level object, or SQL Server Agent job cannot be dropped.
You can drop a login to which database users are mapped; however, this will
create orphaned users. For more information, see Troubleshooting Orphaned
Users.
select * from sys.server_principals
select * from sys.database_principals
select * from sys.user_token
"Sebitti" <sebittionline@xxxxxxxxxxxxxxxxx> wrote in message
news:0AE8D1C4-165B-4115-A2DA-63F0A64C4AC8@xxxxxxxxxxxxxxxx
Hi,
We have an application that allows users to add and drop logins. In Sql
Server 2000 it was not allowed to drop a login that was linked in some
database but in 2005 this is allowed. We need a way to check if login can
really be dropped.
What is the best way to check if a login is linked to any database? Any
stored procedure that does this check? Only way I can think of is to list
all
databases and check their users one by one... i hope there is a quicker
way
to do this.
BR
Johanna Turku
.
- Prev by Date: Re: Encrypted database deployment
- Next by Date: Re: secure query results
- Previous by thread: Encrypted and Decrypted Conn Str....now what? beginner.
- Next by thread: Re: SQL Server 2005: Checking if Login is connected to any databas
- Index(es):
Relevant Pages
|