Passing a variable to the Kill command

  • I am trying to pass a variable to the kill command instead of the actual spid. I keep getting a syntax error. I declare the variable, set the variable then pass the variable. Am I doing something wrong?

  • Try using the exec command.

    
    
    declare @pid as int
    set @pid = 50
    exec ('kill ' + @pid)
  • That works. Thank you!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply