query multiple database with login...

  • Hello all,

    I have multiple databases on the same server but i need to find the user count on each database on a regular interval.

    How can i achieve this using the sys.databases?

    Thanks,

    Vincent

  • This should get you what you need.

    select DB_NAME(database_id) as DBName, COUNT(database_id) as NumConnections

    From sys.dm_exec_requests

    Group by DB_NAME(database_id)

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

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

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