SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Password History Table


Password History Table

Author
Message
Luis Cazares
Luis Cazares
SSC-Forever
SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)

Group: General Forum Members
Points: 43186 Visits: 19859
I know that this might not be constructive, but I had to ask.
Why do you want that security measure to avoid repeated passwords, but you limit your passwords to 10 characters and store them in plain text? Would it be just to give you a false security?

To avoid being useless, I guess that you were after something like this, but remember that keeping your system the way it is now, might cause security/privacy issues:

CREATE TABLE #Password_His
(
playerid int not null,
password nchar(10) not null,
PasswordDate datetime
);

INSERT #Password_His
VALUES( 1, 'Password01', GETDATE() - 11),
( 2, 'Password02', GETDATE() - 10),
( 3, 'Password03', GETDATE() - 9),
( 4, 'Password04', GETDATE() - 8),
( 5, 'Password05', GETDATE() - 7),
( 6, 'Password06', GETDATE() - 6),
( 7, 'Password07', GETDATE() - 5),
( 8, 'Password08', GETDATE() - 4),
( 9, 'Password09', GETDATE() - 3),
( 10, 'Password10', GETDATE() - 2),
( 11, 'Password11', GETDATE() - 1);

DECLARE @Exists bit = 0,
@Password nchar(10) = 'Password04';

SELECT @Exists = 1
FROM (
SELECT TOP 10 [password]
FROM #Password_His
ORDER BY PasswordDate DESC)x
WHERE [password] = @Password;

SELECT @Exists;

GO
DROP TABLE #Password_His;




Luis C.
General Disclaimer:
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?


How to post data/code on a forum to get the best help: Option 1 / Option 2
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search