Thinking outside the box

Patron Saint of Lost Yaks
posts - 203, comments - 734, trackbacks - 4

My Links

Advertisement

News

Archives

Post Categories

How to get authentication mode in SQL Server

CREATE FUNCTION dbo.fnGetSQLServerAuthenticationMode
(
)
RETURNS INT
AS
 
BEGIN
      DECLARE @InstanceName NVARCHAR(1000),
            @Key NVARCHAR(4000),
            @LoginMode INT
 
      EXEC master..xp_regread N'HKEY_LOCAL_MACHINE',
                        N'Software\Microsoft\Microsoft SQL Server\Instance Names\SQL\',
                        N'MSSQLSERVER',
                        @InstanceName OUTPUT
 
      IF @@ERROR <> 0 OR @InstanceName IS NULL
            RETURN NULL
 
      SET   @Key = N'Software\Microsoft\Microsoft SQL Server\' + @InstanceName + N'\MSSQLServer\'
 
      EXEC master..xp_regread N'HKEY_LOCAL_MACHINE',
                        @Key,
                        N'LoginMode',
                        @LoginMode OUTPUT
 
      RETURN @LoginMode
END

Print | posted on Thursday, June 19, 2008 5:10 PM | Filed Under [ SQL Server 2008 Algorithms Administration SQL Server 2005 SQL Server 2000 ]

Feedback

Gravatar

# re: How to get authentication mode in SQL Server

or you could use xp_loginconfig :)
exec xp_loginconfig 'login mode'
6/19/2008 5:45 PM | Mladen
Comments have been closed on this topic.

Powered by:
Powered By Subtext Powered By ASP.NET