Wednesday, 29 April 2015

Querying SQL Server Authentication Mode


/*Fetch SQL Server Authentication Mode

Created By: Adarsh Agrawal

Created Date: 04/29/2015

*/

DECLARE @AuthenticationMode INT 

EXEC master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode', @AuthenticationMode OUTPUT 

SELECT CASE @AuthenticationMode   

            WHEN 1 THEN 'Windows Authentication'  

            WHEN 2 THEN 'Windows and SQL Server Authentication'  

      ELSE 'Unknown' 

END as [Authentication Mode]

No comments:

Post a Comment