开发者

How to save array of integer numbers in a column in SQL Server 2005

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜