Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Track users who log into a certain db

Status
Not open for further replies.

Bell1991

Programmer
Aug 20, 2003
386
US
Is it possible to track anyone who logs into a certain db without turning loggin on for everyone or running profiler or third part tools?
 
you could roll your own code...
If you want a feature, without using the off the shelf, then start writing code.

If [blue]you have problems[/blue], I want [green]source code[/green] AND [green]error messages[/green], none of this [red]"there was an error crap"[/red]
 
Yes... i would think you could create a database level trigger and a table to put the info into. Of course that's speculation and haven't actually tested anything.

"If I were to wake up with my head sewn to the carpet, I wouldn't be more surprised than I am right now.
 
What i have so far, but can't seem to find the right call to fire the trigger on when someone logs in:
Code:
[COLOR=blue]CREATE TRIGGER[/color blue] trg_Budget_Audit
[COLOR=blue]ON DATABASE [/color blue]
[COLOR=blue]FOR[/color blue] [i]<what to execute on?>[/i]
[COLOR=blue]AS[/color blue]

[COLOR=blue]INSERT INTO[/color blue] Audit(UserName, ComputerName, CnnDate)
[COLOR=blue]SELECT[/color blue] [COLOR=magenta]USER_NAME(), HOST_NAME(), GETDATE()[/color]

"If I were to wake up with my head sewn to the carpet, I wouldn't be more surprised than I am right now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top