0

I have a table in SQL Server 2005 with the following properties:

Users (UserID, Username, Password)   where UserID is primary key

I want to save an array of integer numbers in the password attribute in the Users table.

--------------------
 0    1    2    3  
--------------------
1543 6543 7658 8765
--------------------

I plan to save this into the password column.

On the other hand I use pictures instead of texts for password and each picture has a code (4 digit) and a password include 4 picture that produce 16 digit. I want to save these 16 digits (array of Ints) into the Password column

please help me.

thanks

4
  • 2
    seriously, just don't...!! If it's a password, store it as a password (encrypted and salted of course) Commented Dec 26, 2010 at 5:40
  • 2
    of course it must be! You are saving into a column named 'Password'. you wouldn't be storing anything else in there would you? Commented Dec 26, 2010 at 5:46
  • yes it correct but my password is not a password eg. it is Passface Commented Dec 26, 2010 at 7:25
  • on the the other hand i use pictures insted texts for password and each picture has a code (4 digit) and a password include 4 picture that produce 16 dgit. i want to save this 16 digit (array of Ints) to Password Column Commented Dec 26, 2010 at 7:28

1 Answer 1

2

In general arrays are saved in SQL tables as another table, one table row per array element.

But that does not look though like an array of ints, that looks more like 16 byte vector, probably an MD5 digest. Make a VARBINARY(20) column (this way you can switch to SHA1 without changing the column type) and store the byte array as a ... byte array. See SqlBytes for how to manipulate BINARY and VARBINARY columns in the client.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.