System Tables

  • Hi,

    I need to write a query that will display the following items:

    DB_Username, Number of Logons, OS_Username and the Return_Code eg.(Successful Logon)

    Does anyone perhaps know where I can get this information from in the system tables?

     

    Regards

    IC

  • Select SUSER_SNAME() AS SECUREUSERNAME, SUSER_SID() AS SECUREUSERID, HOST_NAME() AS HOSTNAME, HOST_ID() AS HOSTID,

    DB_ID() AS DBID, DB_NAME() AS DBNAME... Try this if you are using SQL2k. May be it works in SQL2K5 too...


    Regards,
    Genie Cool

  • Some of that information is available from sys.syslogins. I think the more dynamic stuff, like the number of logons, isn't going to be there. You may need to set up some sort of monitoring scheme to catch that information.

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply