I am executing a query and stored procedure against MS SQL Server. Both php script and sql server reside on the same server. Sometimes it takes too much time to execute and the PHP script crashes. However SQL Server continues executing the queries in the background.
How can I force SQL Server to stop any queries which take more than X seconds to execute?