Technical Article

Check if SQL Server is running

,

  1. Connect to the SQL Server instance.
  2. Paste this script into SSMS.
  3. Stop and get more coffee. The instance is running if you were able to connect. No need to run this script.
declare @i int;
declare @cmd varchar(max);

select @i = xp_regread('HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\SQL Server\Status');

If @i = 1
  select 'This instance is running';

Rate

3.11 (9)

Share

Share

Rate

3.11 (9)