I found this script for modifying sp_password.
My requirements are that the password must be at least 8 characters long and have a
minimum of 1 numeric character in the 2nd through next-to-last position.
I've got the 8 char long below. Can someone tell me how to do the minimum of 1 numeric character in the 2nd through next-to-last position?
thanks!
declare @position smallint, --
@numCaps smallint, --
@numDigit smallint, --
@charEqual smallint, --
@charLast varchar(1), --
@charError varchar(255) --
--
select @charError = 'Password requirements: Minimum 8 characters long, minimum 1 numeric character in the 2nd through next-to-last position.'
--
select @position = 1, --
@numCaps = 0, --
@numDigit = 0, --
@charEqual = 1, --
@charLast = '' --
--
-- Password equal loginname --
if ( lower(@new) = lower(@loginame) ) --
begin --
raiserror (@charError, 16, 1) --
return (1) --
end --
--
-- Password long enough --
if ( datalength(convert(varchar, @new)) < 8 OR @new IS NULL ) --
begin --
raiserror (@charError, 16, 1) --
return (1) --
end --
--
-- Check syntax of password --
while( @position <= datalength(convert(varchar, @new))) --
begin --
????????????????
end