Pages

Tuesday, August 14, 2012

Who created the login in SQL Server

How can we find out who has created a particular login in SQL Server


We can get the information by the default trace files in the SQL Server. 

There will be only 5 trace files available so if we want to troubleshoot we have to be quick here, the more we delay archiving of trace files may happen and we will loose the data to troubleshoot

Query to be used:

SELECT TargetLoginName, SessionLoginName, HostName, StartTime
FROM fn_trace_gettable('d:\Program Files\Microsoft SQL Server\MSSQL\log\log_126.trc', default)
where targetloginname is not NULL

Above query should having the file which is shown in your default trace log path.

Get the default trace log path from

Hope the above information helps

thanks