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 |
|
Mighty Quinn
Starting Member
5 Posts |
Posted - 2008-05-21 : 21:39:59
|
| Hi All,I have a problem with the procedure shown below. When I try saving it I get the following error, can anyone helpMsg 102, Level 15, State 1, Procedure KillPurveyanceProcess, Line 19Incorrect syntax near '@tSPId'.ALTER PROCEDURE [dbo].[KillPurveyanceProcess]AS--SET NOCOUNT ON;DECLARE @tSPId smallint;DECLARE @tblocked smallint;DECLARE my_cursor CURSOR FOR SELECT spid,blocked from sys.sysprocesses where program_name ='PurveyanceImport'and status = 'suspended' and cmd = 'UPDATE'OPEN my_cursor FETCH NEXT FROM my_cursor INTO @tSPId,@tblockedWHILE @@FETCH_STATUS = 0BEGINKill @tSPIdFETCH NEXT FROM my_cursor INTO @tSPId,@tblockedENDCLOSE my_cursor DEALLOCATE my_cursorThanks in AdvanceNeil |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-05-21 : 22:57:19
|
| Kill doesn't take parameter, need dynamic sql for that. |
 |
|
|
Mighty Quinn
Starting Member
5 Posts |
Posted - 2008-05-22 : 01:04:53
|
| Thanks rmiao, I've created the SQL on the fly for the Kill command, the stored proc now saves, I now need to wait to for jobs to meet the select criteria. I will get back to this post on the results.Thanks once, could not find any reference to the need to create the SQL on the fly for the Kill command.Neil |
 |
|
|
|
|
|
|
|