>>declare @Tmp table >>( Id int IDENTITY(1,1) NOT NULL, >> MD5 binary(16) not null >>); >> >>insert into @Tmp (MD5) values (0xB3C54EFB6C02017046905007293650B1); >>insert into @Tmp (MD5) values (0xB3C54EFB6C02017046905007293650B2); >> >>declare @MD5 Binary(16); >>SET @MD5 = 0xB3C54EFB6C02017046905007293650B2; >> >> >>select * from @Tmp where (MD5 = @MD5); >>>
internal static void Go() { // TestAll(); byte[] pp = new byte[] { 1, 2, 3 }; string x = "0x" + ToHex(pp); Console.WriteLine(x); } static string ToHex(byte[] bytes) { int length = bytes.Length; StringBuilder sb = new StringBuilder(length << 1); for (int i = -1; ++i < length; ) { sb.AppendFormat("{0:X2}", bytes[i]); } return sb.ToString(); }