While it is possible to use MS SQL Server as the backend for your Rails application, Windows is hardly the most common (or best) development or deployment platform for Rails.
As such it doesn't make much sense to rely on the SQL Server command line tools (which are Windows specific as far as I know) when it can be avoided. Relying on those commands doesn't work when, say, developing on a Linux box using a remote SQL Server as I do.
This patch makes db:test:purge use pure SQL for recreating the test database instead of requiring osql for the task. It clears the DB connection to the test database prior to dropping it to prevent a "database in use" error.