cancel
Showing results for 
Search instead for 
Did you mean: 

Finding user in database

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

kothandaraman_nagarajan
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Uma,

Please Check Below Link,

Former Member
0 Kudos

Hello Santosh,

I want to find out how many users are login in each database.. for ex. in TEST db users like a,b,c,d ..... etc users and in live db e,f,g,h users.. i need this scenario ...

Former Member
0 Kudos

Hi,

You can check this information in license administrator also,

Currently Login User Code will get greyed out.