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 2000 Forums
 Transact-SQL (2000)
 User Access

Author  Topic 

pratikmehta
Starting Member

2 Posts

Posted - 2006-04-11 : 09:58:21
Hi

I am developing one db export utility now i have a problem i have a user name and i want to search that the user name which i have has rights on which table or tables.

i mean i want a stored procedure in which i pass the username and it will return mw the list of db for which that user has right.




Thanks

Pratik Mehta

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-04-11 : 15:12:00
sp_helplogins

will return that information. Read the specifics in Books Online.


use master
go
sp_addlogin junk, 'junk'
go
exec pubs..sp_grantdbaccess junk
exec northwind..sp_grantdbaccess junk

go
sp_helplogins junk

go

exec pubs..sp_dropuser junk
exec northwind..sp_dropuser junk
exec sp_droplogin junk

output:

LoginName SID DefDBName DefLangName AUser ARemote
--------- ----------------------------------------------------- -------------------- ----- -------
junk 0xC2833AB7AE01E344A2EACA03AC9FDDD3 master us_english yes no

(1 row(s) affected)

LoginName DBName UserName UserOrAlias
--------- ------------------ -------- -----------
junk Northwind junk User
junk pubs junk User


Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -