SQL Server >> What databases use this user?

by Aaron [SQL Server MVP] » Sat, 21 Aug 2004 00:37:46 GMT

EXEC sp_helplogins 'jsmith'

--
http://www.aspfaq.com/
(Reverse address to reply.)




"bing" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
> The SQL server logs show 'login failed for user jsmith". We have about 50
> databases. How can I find out quickly what databases use this user?
>
> Thanks,
>
> Bing




SQL Server >> What databases use this user?

by YmluZw » Sat, 21 Aug 2004 01:11:01 GMT


Thanks so much for the heads-up, Aaron. That's just what I was looking for.
Man, I was really amazed by the lightening fast response.

Bing








SQL Server >> What databases use this user?

by QWRhcnJv » Tue, 14 Sep 2004 10:47:17 GMT

I have an extended problem.
Is there any way to track which database the user was trying to login to?
This would be helpful both for security (separating user error from probing)
and debugging.
Specifically I am in the process of debugging a multi-server application
install and trying to figure out whether the applications are sending invalid
credentials verses actual DB permissioning.
Something as simple as:
Login failed for user '%ls' Database '%ls'.











Similar Threads

1. Detach 2000 User Database - Attach as 2005 User Database - SQL Server

2. Database connection issue using SQL schema user account

I have an database connection issue that I cannot resolve.   Here is
the setup.
I created a database in SQL 2005 Express.  The database is owned by a
dbo SQL user account, dboAdmin.   I also created two non-dbo SQL user
accounts, schAdmin1  and schAdmin2, each owning a schema inside the
newly created database.   Both non-dbo user accounts were granted the
db_datareader and db_datawriter roles.  When connecting to the
database in Visual Studio 2005 using a non-dbo user account, I get the
infamous error,

CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file C:
\UnleashYourPower\Database\UnleashYourPower.mdf failed. A database
with the same name exists, or specified file cannot be opened, or it
is located on UNC share.

Below is the connection string

strConn1 = "Data Source=.\SQLEXPRESS; AttachDbFilename=C:\UYP\Database
\UYP.mdf; User ID= schAdmin1; Password = <password>; Connect
Timeout=30; User Instance=False"

The underlying problem is that the non-dbo user accounts do not the
granted privilege to attach the database.  If I manually attach the
database using SQL Server Management Studio Express or if I first
attach the database using the dbo user account inside a connection
string, the above connection string works.  I could grant the two non-
dbo user accounts the dbo role, but this eliminates the need to create
non-dbo schemas.   I will be distributing this database and
application, so I need to attach the database using Visual Basic code.
In summary:  How would you connect to a SQL 2005 Express database in
Visual Studio 2005 using a non-dbo SQL user account if the database is
not attached manually or not attached by the dbo?

3. Using differant SQL database for differant users

4. IIS is using ASPNET and user guest in SQL Server database

5. Unable to create user error when using copy database task - SQL Server DTS

6. backup database while users are using it

Hello there

If i will backup the database now while users are using it right now. can it 
cause damage? 


7. Cannot connect to database using osql with sa user - SQL Server