Using Sysxlogins to Retrieve Objects

Richard Waymire answers a reader’s question about using system tables to retrieve login names.

Richard Waymire

August 21, 2001

1 Min Read
ITPro Today logo in a gray background | ITPro Today

What's the easiest way for me to retrieve a list of stored procedures that a named Windows NT login account owns and that Enterprise Manager displays? I want to wrap code around the list, run the code in Query Analyzer, then change the object owner to dbo. Would translating an NT login account to the SID and joining sysxlogins to the sysobjects or sysdatabases system table help?

Master.dbo.sysxlogins exposes the SID-to-name mapping for valid logins. So, you can easily write a join query that uses sysxlogins to retrieve login names, then find matching objects such as stored procedures in a database.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like