Save byte array in sql server(在sql server中保存字节数组)
问题描述
我希望使用一种方法来保存需要使用字节数组的密码,如本 发布
Am looking to use an approach in saving passwords that requires using byte array as in this post
那么我应该在 sql server 中使用哪种数据类型来保存字节数组?以及如何使用 SqlCommand 传递和检索字节数组?
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?
推荐答案
如果它总是相同的长度,那么 binary(length) 将是合适的.如果它的长度会有所不同,请使用 varbinary(maxlength).
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).
二进制和 varbinary.
而且,正如@p.s.w.g 所说,您可以通过将其放入合适的参数中来从代码中传递它.
And, as @p.s.w.g says, you pass it from code by placing it into a suitable parameter.
这篇关于在sql server中保存字节数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在sql server中保存字节数组
基础教程推荐
- 是否可以执行按位分组功能? 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- 无法解决整理冲突 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
