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.
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? |
 |
|
ccrespo
Yak Posting Veteran
59 Posts |
Posted - 2007-08-31 : 15:55:51
|
I can't find that field in profiler. |
 |
|
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... |
 |
|
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? |
 |
|
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/325607DECLARE @Handle binary(20)SELECT @Handle = sql_handle FROM sysprocesses WHERE spid = 52SELECT * FROM ::fn_get_sql(@Handle)--------------------keeping it simple... |
 |
|
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? |
 |
|
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... |
 |
|
|
|
|