November 18, 2008 at 9:26 am
Please post any SQL Query to select the SQL Logins associated with Database User ID's. Is there any system views or it is available only through SSMS GUI?
Thanks.
November 18, 2008 at 9:37 am
SELECT * FROM sys.database_principals
WHERE TYPE = 's'
November 18, 2008 at 9:47 am
November 18, 2008 at 1:52 pm
select db_name(), b.name as username,a.name as login
from master.dbo.syslogins a, sysusers b
where a.sid = b.sid and b.issqluser = 1
The above query was very useful for my scenario. I also added issqluser just to track down by sql login.
tnk y'all.
November 18, 2008 at 10:02 pm
DECLARE @sql varchar(8000)
DECLARE @BAK_PATH VARCHAR(4000)
declare c_bak cursor FAST_FORWARD FOR
select name from sys.databases
OPEN c_bak
FETCH NEXT FROM c_bak INTO @BAK_PATH
WHILE @@FETCH_STATUS = 0
BEGIN
SET @sql = 'sp_helpuser'
PRINT (@SQL)
EXEC(@SQL)
FETCH NEXT FROM c_bak INTO @BAK_PATH
END
CLOSE C_BAK
DEALLOCATE C_BAK
November 18, 2008 at 10:53 pm
steveb (11/18/2008)
SELECT * FROM sys.database_principals
WHERE TYPE = 's'
thanks for knowledge updation
kshitij kumar
kshitij@krayknot.com
www.krayknot.com
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply