Consider that a MS SQL Server instance is executing a long-running query the service is stopped via services.msc or - as it actually happening - a system shutdown triggered by a UPS as the server is in a developing country which experiences rolling power blackouts.
When this happens, the service stays in the 'Stopping' state for some time and CPU and disk I/O remains high for that process.
What happens to the queries that are being run? Are they allowed to complete before the service enters the 'Stopped' state or are they cancelled and rolled back?
Ideally, I am looking for an authoritative source (Microsoft documentation) as the answer as I suspect different behavior depending on a factor unknown to me. i.e. sometimes we see queries roll back, sometimes we see them complete. Perhaps the service makes a call as to how far through the transaction it is and if it is quicker to rollback or complete.
If it makes a difference, this is SQL 2012.
Thanks in advance!