Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Querying for MSSQL DB UserName & PWD 1

Status
Not open for further replies.

damann

Technical User
Jul 19, 2000
114
US
Hey Guys,

Is there a meta query (hopefully I'm using the right terminology here) in MSSQL that I can use to query and return all user accounts and passwords that has access to a particular database? In the same breath does a query exist that I can use to return all databases on a particular server? If these queries don't exist, is there a way to create/write it from scratch? Please let me know.


Thanks,
Damann
 
You can get the usernames (logins) but the passwords wont help as they are encrypted.

The query would look something like (execute in the database you are intereseted in...

Select sl.name,password from master..sysxlogins sl join sysusers su
on sl.sid = su.sid

 
Hey thanks man, that did work! The pwd returned is binary though, is there a way to decrypt it somehow? Isn't there a stored Procedure to do this? Please let me know...


Thanks,
Damann
 
Nope :)

Basicly it is encrypted.. All you need to do now is figure out the decryption key :)



Rob
 
To find the list of database
Code:
select name
from sysdatabases

If you are working on migrating from one server to another, you don't need to decrypt the passwords to recreate the accounts. You can recreate the accounts using the already encrypted passwords.

What's the end result you are looking for?

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(Not quite so old any more.)
 
BTW, Microsoft very deliberately encrypted the passwords on SQL Server because it was a security breech to leave them unencrypted. Unencrypted pwds would allow just anyone to walk up to a Sysadmin's PC and steal the pwds or hack into the network and take them. That would be bad.

So, MS made sure there was no easy way to grab a hold of them.

Sorry.



Catadmin - MCDBA, MCSA
"If a person is Microsoft Certified, does that mean that Microsoft pays the bills for the funny white jackets that tie in the back???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top