Save byte array in sql server

user2155873 picture user2155873 · Mar 20, 2013 · Viewed 63.2k times · Source

Am looking to use an approach in saving passwords that requires using byte array as in this post

So which data type should i use in sql server to save byte array? and how can i pass and retrieve the byte array using SqlCommand?

Answer

Damien_The_Unbeliever picture Damien_The_Unbeliever · Mar 20, 2013

If it's always going to be the same length, then binary(length) would be suitable. If it's going to vary in length, use varbinary(maxlength).

binary and varbinary.

And, as @p.s.w.g says, you pass it from code by placing it into a suitable parameter.