SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Script Library
 How to get authentication mode in SQL Server
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

SwePeso
Patron Saint of Lost Yaks

Sweden
29910 Posts

Posted - 06/19/2008 :  11:08:30  Show Profile  Visit SwePeso's Homepage  Reply with Quote
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



E 12°55'05.25"
N 56°04'39.16"

spirit1
Cybernetic Yak Master

Slovenia
11749 Posts

Posted - 06/19/2008 :  11:46:15  Show Profile  Visit spirit1's Homepage  Reply with Quote
this also works:
exec xp_loginconfig 'login mode'

_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
29910 Posts

Posted - 06/19/2008 :  11:52:51  Show Profile  Visit SwePeso's Homepage  Reply with Quote
Great!

Mladen, do you know if the security breach has been fixed?
For some time ago, I could set DefaultLogin to SA and then I got sa security rights for any account I logged into sql server.
login mode had to be integrated.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

spirit1
Cybernetic Yak Master

Slovenia
11749 Posts

Posted - 06/19/2008 :  12:01:10  Show Profile  Visit spirit1's Homepage  Reply with Quote
you could set it via xp_loginconfig?

never heard of that bug

_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
29910 Posts

Posted - 06/19/2008 :  14:02:06  Show Profile  Visit SwePeso's Homepage  Reply with Quote
No, via the registry.
The caveat was that SQL Server service needed to restart first.


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000