Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 alter logins

Author  Topic 

TRACEYSQL
Aged Yak Warrior

594 Posts

Posted - 2008-09-02 : 10:14:19
Trying to set up web page so they can change passwords for a certain database.

This works for a domain\weblogin which will pass in the variables from web page.

However i need to have alter login on the domain\weblogin - which means that if the domain\weblogin does log onto the server that login can then delete logins etc.

I was wondering if i can issue this GRANT ALTER ANY LOGIN TO domain\weblogin

Do the alter below then do
REVOKE ALTER ANY LOGIN TO domain\weblogin.

(But the two statements have to be ran as sa ....)

Any way to do the GRANT ALTER ANY LOGIN for specific logins of a database not the entire system.




CREATE procedure [dbo].[usp_Login_Reset]

@Password nvarchar(20),
@username nvarchar(100)

as

DECLARE @SQLCMD NVARCHAR(500)


Begin

SET @sqlcmd = 'ALTER login ' + quotename(@username) + ' with password = ' + quotename(@password, '''');

EXEC (@sqlcmd);

end
   

- Advertisement -