In SQL Server Management Studio (SSMS)/ Object Explorer / Management
you will find the Activity Montior. There is a column that identifies the database and a column the identifies the command. If you click a command a window will open with the details.
In 2005, it is actually pretty easy. I wrote this blog (http://drsql.spaces.live.com/blog/cns!80677FB08B3162E4!900.entry) on the subject, and here is the query:
select der.session_id, der.wait_type, der.wait_time,
der.status as requestStatus,
des.login_name,
cast(db_name(der.database_id) as varchar(30)) as databaseName,
des.program_name,
der.command as commandType,
execText.text as objectText,
case when der.statement_end_offset = -1 then '--see objectText--'
else SUBSTRING(execText.text, der.statement_start_offset/2,
(der.statement_end_offset - der.statement_start_offset)/2)
end AS currentExecutingCommand,
der.open_transaction_count
from sys.dm_exec_sessions des
join sys.dm_exec_requests as der
on der.session_id = des.session_id
cross apply sys.dm_exec_sql_text(der.sql_handle) as execText
where des.session_id <> @@spid --eliminate the current connection
This gives you the entire query, and will show you the statement that is being executed in some cases.
This forum is buggered sometimes it show replies and other times it doesn't If I double posted I appologize. but I tried that and it doesn't seem to show the edits I am making directly to the tables via the Management studio.
Basically I have a table that doesn't have a unique field, and want to change a value in a single column, how do I reference it in an update query
If you're trying to capture a partcular query then it would be a simple task to fire up SQL Profiler, start a new trace, and then perform the action that you want to trace. The command(s) will be displayed in the 'TextData' column.
Have a look at this link for info on getting started with Profiler:
http://www.developer.com/db/article.php/3482216
Chris