Skip to Content

Finding user in database

Hello Experts,

we are using SAP B1 2007 PL15 here i enable to find which user is in which database. for ex. i had two DBs one is LIVE and another one is TEST here my concern is how to find out which user is login in which database?

Thanks in advance ..

Umamahesh.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 06, 2015 at 01:15 PM

    Hi,

    Run below query in test or Live  DB in query generator

    SELECT distinct T0.[U_NAME], T1.[Action], T1.[ActionBy], T1.[Date], T1.[ClientName], T1.[ClientIP] FROM SBOdemoUS.DBO.OUSR T0  INNER JOIN SBOdemoUS.DBO.USR5 T1 ON T0.USER_CODE = T1.UserCode where T1.[Action] = '[%0]'  and datediff(dd,T1.[Date],getdate()) = 0

    union all

    SELECT distinct T0.[U_NAME], T1.[Action], T1.[ActionBy], T1.[Date], T1.[ClientName], T1.[ClientIP] FROM TEST.DBO.OUSR T0  INNER JOIN TEST.DBO.USR5 T1 ON T0.USER_CODE = T1.UserCode  where T1.[Action] = '[%0]' and datediff(dd,T1.[Date],getdate()) = 0

    Thanks & Regards,

    Nagarajan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi

      use the sp_who or sp_who2 command in the SQL to find out the login to respective database.

      you can find out the database name and host name also.

      Regards,

      tausif

  • avatar image
    Former Member
    Jan 06, 2015 at 12:34 PM
    Add comment
    10|10000 characters needed characters exceeded