Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Appending characters to data

Status
Not open for further replies.

obryant32

IS-IT--Management
Feb 20, 2003
66
US
OK,
I'm extremely new to this so here's what I'd like to do and I'm not sure how. Currently we store usernames and passwords in a table for a particular function. What I'd like to do, is go into that table and add the number "1" to the end of every password based on certain criteria. This will then preent those users from being able to perdform that particular function. However, I could go in and do this manually for each user but that would take a long time. Is there a way, in a script that I can add that number "1" to the end of every passowrd based on my criteria. And then, if I need to turn it back on, go back in and remove that number "1" on the end in another script.

I appreciate any help and please keep in mind how little I know so you may need to dumb it down :)
Thanks
Matt
 
First consider adding a column to the table of passwords to inactivate a password, such as allowed BIT. In the application, only authenticate logins with allowed = 1.

Or
Code:
UPDATE MyLogins SET
  pwd = pwd + '1'
WHERE hair_color = 'black'
and
Code:
UPDATE MyLogins SET
  pwd = SUBSTRING(@pwd, 1, DATALENGTH(@pwd)-1)
WHERE hair_color = 'black'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top