Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 track users

Author  Topic 

ccrespo
Yak Posting Veteran

59 Posts

Posted - 2007-08-31 : 12:06:15
Is there any way for me to track this: Our program uses CAST( SUBSTRING(context_info, 3, 30) AS char(30)) from master..sysprocesses to store user login information. Is there any way to track every sql statement executed for each user in this field?

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-31 : 15:46:28
Trace with profiler?
Go to Top of Page

ccrespo
Yak Posting Veteran

59 Posts

Posted - 2007-08-31 : 15:55:51
I can't find that field in profiler.
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2007-09-04 : 15:49:42
check fn_get_sql using sql_handle column

--------------------
keeping it simple...
Go to Top of Page

ccrespo
Yak Posting Veteran

59 Posts

Posted - 2007-09-04 : 16:20:29
I can't find fn_get_sql from sql_handle.. how exactly do you do this?
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2007-09-04 : 16:26:43
from MS site including additional feature (bug and hotfix) :
http://support.microsoft.com/kb/325607

DECLARE @Handle binary(20)
SELECT @Handle = sql_handle FROM sysprocesses WHERE spid = 52
SELECT * FROM ::fn_get_sql(@Handle)

--------------------
keeping it simple...
Go to Top of Page

ccrespo
Yak Posting Veteran

59 Posts

Posted - 2007-09-04 : 16:32:23
I can't use this in SQL Profiler then. I would have to poll that at a certain interval right?
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2007-09-04 : 16:38:37
I thought you were querying sysprocesses?

If profiler, you have the option to show the text noh? it's a separate column when you set it up.



--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -