Every tidbit of knowledge gleaned over years of working with a product comes at a price and that price is sometimes shame at not having known such slacious info beforehand. So it is with shame I admit that today I learned something I suspect I should have known. I run the risk of criticism of my peers who might send an electronic DUH my way, but for the neophytes of which we all are still in some way, I proffer the following:
When killing a SPID in SQL Server, especially one with an extensive rollback, one may type the following command to get an estimated time to completion for the rollback:
KILL (spid) WITH STATUSONLY
I learned this shamedly just a few weeks ago but it has served me well since, at least on two occasions. And further, it is not possible to kill an extended stored procedure. I can say this from today's experience trying to kill an xp_sendmail command to test a wayward SQL Mail configuration. BOL states also that one cannot kill one's own process. I have to think about that one, buy you can check it out for yourself for the T-SQL KILL command in BOL. Ironically, when running kill with statusonly on a murdered SPID that is an extended stored procedure, the completion is 100% yet, the SPID will not disappear from Current Activity.
Speaking of Current Activity, Try:
sp_who2 active
Sure, everyone to my disgrace may know this, but again...for what it is worth to the few who2 may not.
And...Cntrl+0 will enter NULL values in fields in Enterprise Manager when opening a recordset from a table with OPEN.
And in a command prompt a command piped to CLIP (In Windows Server 2003) will send the results to the clipboard. Try:
DIR (pronounced DUH for my shame) | CLIP
And finally, the one most everyone knows but there is little documentation that I have found, in Query Analyzer, highlighting sections of a query and pressing Execute will only execute the highlighted code.
And finally, I will say that using a script project in SQl Server Management Studio is a nice way of organizing commonly used queries. If you have not tried to create a script project and consolidate your scripts, you should try it.
Time is out....LOST is airing now. Priorities, you know. And speaking of priorites...
tomorrow.