Showing posts with label command. Show all posts
Showing posts with label command. Show all posts

Friday, March 23, 2012

Last TSQL Command Batch

Does anyone know where Enterprise Manager (MSSQL 2000) gets the "Last TSQL Command Batch:" information from that shows when you display the properties for a process listed under current activity/Process Info for a server.

This could be useful for a bespoke system monitoring utility in my system.Google is your friend

http://www.developersdex.com/gurus/code/488.asp

last tsql command

hi, how can i obtain the info of the last tsql command executed?, in the table sysprocess i only have the number of spid
thanks so much...have you tried double-clicking the spid in Enterprise Manager->Management->Current Activity->Process Info?

...might give you what you're looking for...|||hi, yes, but sql save it in someplace? i need to extract it to a table|||Not that I'm aware of, you'd have to run profiler to capture the sql (even then I am not sure you can save it to a table...)|||(even then I am not sure you can save it to a table...)Yes you can though MS recommend you write to a trace file and insert this into a table when you want to analyse. More efficient to write to a file at trace time basically.

HTH|||@.Mvrg76: Why have you opened a new thread?
See http://www.dbforums.com/showthread.php?t=1613810sql

Wednesday, March 21, 2012

Last Query Statement fired into the MSSQL Engine

Hi,

How can you get the Query Statement of the last executed SQL command.

I am not quite sure but I do remember coming across such a command ( maybe an undocumented one).

Thanks for your help and pointers.

My Best wishes for the new year to all the folks in the forum. Wishing you greater days ahead.

Warm Regards,
Ranjit S Hans.

---------------------
Everywhere is a walking distance if you have the time - Steven Wrightdbcc inputbuffer(@.spid)|||You can also use fn_get_sql, but it is a little more awkward.|||Hi Matt/ Jezemine,

Thanks so much for the help .. You have been wonderful all along.

I am looking forward to try out using fn_get_sql sometime soon.

Thanks once again !!

Warm Regards,
Ranjit S Hans
----------------------
Everywhere is a walking distance if you have the time - Steven Wright|||fn_get_sql has a number of benefits over dbcc inputbuffer actually. dbcc cuts off the query returned at 255 chars as I recall. Usually thats enough, unless you have apps out there making ad-hoc sql calls doing a 10-way join. :)