Hi
I was playing around with a stored procedure and I think I made an endless while loop(I think I forgot to close the cursor)
now it is sending me emails and I don't know how to stop it. How can I kill it?
edit this is what I see when I do what remus told me to do
Sorry I don't know how to output the results nicer.
1,0,2010-07-06 17:00:45.637,background,RESOURCE MONITOR,NULL,NULL,NULL,NULL,0,1,NULL,0,NULL,0,SLEEP_TASK,,0,1,0,NULL,0,0,0,0,257,0x04848118,0,0,0,4096,us_english,mdy,7,0,0,0,0,0,0,0,0,2,-1,0,0,0,1,0,0
2,0,2010-07-06 17:00:45.637,background,LAZY WRITER,NULL,NULL,NULL,NULL,0,1,NULL,0,LAZYWRITER_SLEEP,904,LAZYWRITER_SLEEP,,0,1,0,NULL,0,0,0,0,1,0x0072C3E8,0,0,0,4096,us_english,mdy,7,0,0,0,0,0,0,0,0,2,-1,0,0,0,1,0,0
4,0,2010-07-06 17:00:45.637,background,LOCK MONITOR,NULL,NULL,NULL,NULL,0,1,NULL,0,REQUEST_FOR_DEADLOCK_SEARCH,4570,REQUEST_FOR_DEADLOCK_SEARCH,,0,1,0,NULL,0,0,0,0,1,0x0072C4D8,0,0,0,4096,us_english,mdy,7,0,0,0,0,0,0,0,0,2,-1,0,0,0,1,0,0
5,0,2010-07-06 17:00:45.637,background,SIGNAL HANDLER,NULL,NULL,NULL,NULL,1,1,NULL,0,KSOURCE_WAKEUP,12587720,KSOURCE_WAKEUP,,0,1,0,NULL,0,0,0,0,0,0x002582F8,0,0,0,4096,us_english,mdy,7,0,0,0,0,0,0,0,0,2,-1,0,0,0,1,0,0
6,0,2010-07-06 17:00:45.637,sleeping,TASK MANAGER,NULL,NULL,NULL,NULL,1,1,NULL,0,NULL,0,MISCELLANEOUS,,0,1,0,NULL,0,0,0,0,NULL,0x00000000,0,0,0,4096,us_english,mdy,7,0,0,0,0,0,0,0,0,2,-1,0,0,0,1,0,0
7,0,2010-07-06 17:00:45.637,background,TRACE QUEUE TASK,NULL,NULL,NULL,NULL,1,1,NULL,0,SQLTRACE_BUFFER_FLUSH,3213,SQLTRACE_BUFFER_FLUSH,,0,1,0,NULL,0,0,0,0,1,0x0072C7A8,0,0,0,4096,us_english,mdy,7,0,0,0,0,0,0,0,0,2,-1,0,0,0,1,0,0
9,0,2010-07-06 17:00:45.637,background,BRKR TASK,NULL,NULL,NULL,NULL,1,1,NULL,0,BROKER_TRANSMITTER,12588032,BROKER_TRANSMITTER,,0,1,0,NULL,0,0,0,0,1,0x0072CA78,0,0,0,4096,us_english,mdy,7,1,0,1,0,1,1,1,1,2,-1,0,0,0,1,0,0
11,0,2010-07-06 17:00:45.637,background,TASK MANAGER,NULL,NULL,NULL,NULL,1,1,NULL,0,ONDEMAND_TASK_QUEUE,12590216,ONDEMAND_TASK_QUEUE,,0,1,0,NULL,0,0,0,0,0,0x002583E8,0,0,0,4096,us_english,mdy,7,0,0,0,0,0,0,0,0,2,-1,0,0,0,1,0,0
12,0,2010-07-06 17:00:45.637,background,BRKR EVENT HNDLR,NULL,NULL,NULL,NULL,1,1,NULL,0,BROKER_EVENTHANDLER,337289,BROKER_EVENTHANDLER,,0,1,0,NULL,0,0,1170,0,0,0x002586B8,6,43,154502,4096,us_english,mdy,7,1,0,1,0,1,1,1,1,2,-1,0,0,0,1,0,0
13,0,2010-07-06 17:00:45.637,background,BRKR TASK,NULL,NULL,NULL,NULL,1,1,NULL,0,BROKER_TRANSMITTER,12588017,BROKER_TRANSMITTER,,0,1,0,NULL,0,0,0,0,0,0x002585C8,0,0,0,4096,us_english,mdy,7,1,0,1,0,1,1,1,1,2,-1,0,0,0,1,0,0
14,0,2010-07-06 17:00:45.637,sleeping,TASK MANAGER,NULL,NULL,NULL,NULL,1,1,NULL,0,NULL,0,MISCELLANEOUS,,0,1,0,NULL,0,0,0,0,NULL,0x00000000,0,0,1413,4096,us_english,mdy,7,0,0,0,0,0,0,0,0,2,-1,0,0,0,1,0,0
15,0,2010-07-06 17:00:45.637,sleeping,TASK MANAGER,NULL,NULL,NULL,NULL,1,1,NULL,0,NULL,0,MISCELLANEOUS,,0,1,0,NULL,0,0,0,0,NULL,0x00000000,0,101,11396,4096,us_english,mdy,7,0,0,0,0,0,0,0,0,2,-1,0,0,0,1,0,0
16,0,2010-07-06 17:00:45.637,sleeping,TASK MANAGER,NULL,NULL,NULL,NULL,1,1,NULL,0,NULL,0,MISCELLANEOUS,,0,1,0,NULL,0,0,0,0,NULL,0x00000000,0,146,15318,4096,us_english,mdy,7,0,0,0,0,0,0,0,0,2,-1,0,0,0,1,0,0
17,0,2010-07-06 17:00:45.637,sleeping,TASK MANAGER,NULL,NULL,NULL,NULL,1,1,NULL,0,NULL,0,MISCELLANEOUS,,0,1,0,NULL,0,0,0,0,NULL,0x00000000,0,0,235,4096,us_english,mdy,7,0,0,0,0,0,0,0,0,2,-1,0,0,0,1,0,0
18,0,2010-07-06 17:00:45.637,sleeping,TASK MANAGER,NULL,NULL,NULL,NULL,1,1,NULL,0,NULL,0,MISCELLANEOUS,,0,1,0,NULL,0,0,0,0,NULL,0x00000000,0,0,476,4096,us_english,mdy,7,0,0,0,0,0,0,0,0,2,-1,0,0,0,1,0,0
19,0,2010-07-06 17:00:45.637,sleeping,TASK MANAGER,NULL,NULL,NULL,NULL,1,1,NULL,0,NULL,0,MISCELLANEOUS,,0,1,0,NULL,0,0,0,0,NULL,0x00000000,0,0,711,4096,us_english,mdy,7,0,0,0,0,0,0,0,0,2,-1,0,0,0,1,0,0
20,0,2010-07-06 17:00:45.637,sleeping,TASK MANAGER,NULL,NULL,NULL,NULL,1,1,NULL,0,NULL,0,MISCELLANEOUS,,0,1,0,NULL,0,0,0,0,NULL,0x00000000,0,0,506,4096,us_english,mdy,7,0,0,0,0,0,0,0,0,2,-1,0,0,0,1,0,0
21,0,2010-07-06 17:00:45.637,sleeping,TASK MANAGER,NULL,NULL,NULL,NULL,1,1,NULL,0,NULL,0,MISCELLANEOUS,,0,1,0,NULL,0,0,0,0,NULL,0x00000000,0,0,0,4096,us_english,mdy,7,0,0,0,0,0,0,0,0,2,-1,0,0,0,1,0,0
60,0,2010-07-06 20:30:33.360,running,SELECT,0x020000004D4F6005A3E8119F3DD3297095832ABE63E312F2,0,-1,0x060005004D4F6005B801000F000000000000000000000000,5,1,5758612B-D19E-43EB-B9A5-343B30DCA65C,0,NULL,0,MISCELLANEOUS,,0,1,2034480,0x,0,0,0,1,0,0x002595B8,0,0,99,2147483647,us_english,mdy,7,1,1,1,0,1,1,1,1,2,-1,0,19,0,0,0,0
Edit 2
1 0 2010-07-06 20:38:22.550 background RESOURCE MONITOR NULL NULL NULL NULL 0 1 NULL 0 NULL 0 SLEEP_TASK 0 1 0 NULL 0 0 0 0 257 0x048A8118 0 0 0 4096 us_english mdy 7 0 0 0 0 0 0 0 0 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
2 0 2010-07-06 20:38:22.550 background LAZY WRITER NULL NULL NULL NULL 0 1 NULL 0 LAZYWRITER_SLEEP 561 LAZYWRITER_SLEEP 0 1 0 NULL 0 0 0 0 1 0x0070C3E8 0 0 0 4096 us_english mdy 7 0 0 0 0 0 0 0 0 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
4 0 2010-07-06 20:38:22.550 background LOCK MONITOR NULL NULL NULL NULL 0 1 NULL 0 REQUEST_FOR_DEADLOCK_SEARCH 2792 REQUEST_FOR_DEADLOCK_SEARCH 0 1 0 NULL 0 0 0 0 1 0x0070C4D8 0 0 0 4096 us_english mdy 7 0 0 0 0 0 0 0 0 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
5 0 2010-07-06 20:38:22.550 background SIGNAL HANDLER NULL NULL NULL NULL 1 1 NULL 0 KSOURCE_WAKEUP 282252 KSOURCE_WAKEUP 0 1 0 NULL 0 0 0 0 0 0x004F82F8 0 0 0 4096 us_english mdy 7 0 0 0 0 0 0 0 0 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
6 0 2010-07-06 20:38:22.550 sleeping TASK MANAGER NULL NULL NULL NULL 1 1 NULL 0 NULL 0 MISCELLANEOUS 0 1 0 NULL 0 0 0 0 NULL 0x00000000 0 0 0 4096 us_english mdy 7 0 0 0 0 0 0 0 0 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
7 0 2010-07-06 20:38:22.550 background TRACE QUEUE TASK NULL NULL NULL NULL 1 1 NULL 0 SQLTRACE_BUFFER_FLUSH 3088 SQLTRACE_BUFFER_FLUSH 0 1 0 NULL 0 0 0 0 1 0x0070C7A8 0 0 0 4096 us_english mdy 7 0 0 0 0 0 0 0 0 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
9 0 2010-07-06 20:38:22.550 sleeping TASK MANAGER NULL NULL NULL NULL 1 1 NULL 0 NULL 0 MISCELLANEOUS 0 1 0 NULL 0 0 0 0 NULL 0x00000000 6 7 5360 4096 us_english mdy 7 0 0 0 0 0 0 0 0 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
10 0 2010-07-06 20:38:22.550 background TASK MANAGER NULL NULL NULL NULL 1 1 NULL 0 ONDEMAND_TASK_QUEUE 286683 ONDEMAND_TASK_QUEUE 0 1 0 NULL 0 0 0 0 0 0x004F83E8 0 0 0 4096 us_english mdy 7 0 0 0 0 0 0 0 0 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
12 0 2010-07-06 20:38:22.550 background BRKR EVENT HNDLR NULL NULL NULL NULL 1 1 NULL 0 BROKER_EVENTHANDLER 1326 BROKER_EVENTHANDLER 0 1 0 NULL 0 0 1045 0 0 0x004F86B8 6 277 53717 4096 us_english mdy 7 1 0 1 0 1 1 1 1 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
13 0 2010-07-06 20:38:22.550 sleeping TASK MANAGER NULL NULL NULL NULL 1 1 NULL 0 NULL 0 MISCELLANEOUS 0 1 0 NULL 0 0 0 0 NULL 0x00000000 4 0 2830 4096 us_english mdy 7 0 0 0 0 0 0 0 0 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
14 0 2010-07-06 20:38:22.550 sleeping TASK MANAGER NULL NULL NULL NULL 1 1 NULL 0 NULL 0 MISCELLANEOUS 0 1 0 NULL 0 0 0 0 NULL 0x00000000 0 0 276 4096 us_english mdy 7 0 0 0 0 0 0 0 0 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
15 0 2010-07-06 20:38:22.550 sleeping TASK MANAGER NULL NULL NULL NULL 1 1 NULL 0 NULL 0 MISCELLANEOUS 0 1 0 NULL 0 0 0 0 NULL 0x00000000 0 0 4716 4096 us_english mdy 7 0 0 0 0 0 0 0 0 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
16 0 2010-07-06 20:38:22.550 sleeping TASK MANAGER NULL NULL NULL NULL 1 1 NULL 0 NULL 0 MISCELLANEOUS 0 1 0 NULL 0 0 0 0 NULL 0x00000000 0 0 2346 4096 us_english mdy 7 0 0 0 0 0 0 0 0 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
17 0 2010-07-06 20:38:22.550 background BRKR TASK NULL NULL NULL NULL 1 1 NULL 0 BROKER_TRANSMITTER 282237 BROKER_TRANSMITTER 0 1 0 NULL 0 0 0 0 0 0x004F8898 0 0 0 4096 us_english mdy 7 1 0 1 0 1 1 1 1 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
18 0 2010-07-06 20:38:22.550 background BRKR TASK NULL NULL NULL NULL 1 1 NULL 0 BROKER_TRANSMITTER 282237 BROKER_TRANSMITTER 0 1 0 NULL 0 0 0 0 1 0x0070CC58 0 0 0 4096 us_english mdy 7 1 0 1 0 1 1 1 1 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
19 0 2010-07-06 20:38:22.550 sleeping TASK MANAGER NULL NULL NULL NULL 1 1 NULL 0 NULL 0 MISCELLANEOUS 0 1 0 NULL 0 0 0 0 NULL 0x00000000 0 3 3649 4096 us_english mdy 7 0 0 0 0 0 0 0 0 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
20 0 2010-07-06 20:38:22.550 sleeping TASK MANAGER NULL NULL NULL NULL 1 1 NULL 0 NULL 0 MISCELLANEOUS 0 1 0 NULL 0 0 0 0 NULL 0x00000000 0 0 804 4096 us_english mdy 7 0 0 0 0 0 0 0 0 2 -1 0 0 0 1 0 0 NULL NULL NULL NULL NULL
55 0 2010-07-06 20:43:04.807 running SELECT 0x02000000C11D0A09F92E04D1EE8FD14B7EC06C01E9266CA8 0 -1 0x06000500C11D0A09B881F207000000000000000000000000 5 1 710FE4B3-5EB3-47FD-839C-81B9CD33E56A 0 NULL 0 MISCELLANEOUS 0 1 85928 0x 0 0 0 4 0 0x004F8988 6 0 66 2147483647 us_english mdy 7 1 1 1 0 1 1 1 1 2 -1 0 18 0 0 0 0 NULL NULL NULL 0
Edit 3
This was the stored procedure
I only had one record in the temp table
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[csp_test]
AS
BEGIN
declare @temp2 table (
idx int identity(1,1),
title varchar(max),
body varchar(max))
insert into @temp2 (title, body)
select title, body
from temp
declare @title varchar(max)
declare @body varchar(max)
declare myCursor Cursor for select title, body from @temp2
open myCursor
fetch next from myCursor into @title, @body
while @@fetch_status = 0 begin
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'SqlAlerts',
@recipients = '[email protected]',
@body = 'The stored procedure finished successfully.',
@subject = 'Automated Success Message' ;
end
END