Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2012
    Posts
    119

    Unanswered: kill session from odbc connection

    Hi all,
    I'm developing an ODBC application written in C++ leveraging SQL Server 2014.

    I need to kill a session (I know the session id) from my ODBC connection.
    Is it possible?
    Do you have an example of code that I can try?

    Thanks!

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    If you are an administrator on the SQL Server, then you can use the Transact-SQL KILL command. For instance, if you need to kill SQL Server spid 123 you could use the Transact-SQL command:
    Code:
    KILL 123
    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •