Thursday, October 14, 2010

Change SQL Server Authentication Mode Using TSQL

We can use undocumented procedure xp_regwrite/xp_instance_regwrite, to change the authentication mode form query.


exec master..xp_instance_regwrite N'HKEY_LOCAL_MACHINE',N'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer','LoginMode', N'REG_DWORD', 2

0 or 2 => Mixed Mode

1 => integrated

No comments: