I have a need to create a store procedure to reset user password. I know that the script is as followed:
ALTER LOGIN [username] WITH DEFAULT_DATABASE=[db1]
ALTER LOGIN [username] WITH PASSWORD=N'NewPassword' MUST_CHANGE
Would like to have something like
DECLARE @USERNAME VARCHAR(30), @DB VARCHAR(30), @PASSWORD VARCHAR(30)
SET @USERNAME = 'BOB'
SET @DB = 'DB1'
SET @PASSWORD = 'NewPassword'
ALTER LOGIN @USERNAME WITH DEFAULT_DATABASE=@DB
ALTER LOGIN @USERNAME WITH PASSWORD=N'+@PASSWORD+' MUST_CHANGE