SQL表中的UPDATE数据类型图像 [英] UPDATE datatype image in SQL-Table
问题描述
我有一个表cSc_Role
和一个列RoleSettings
.
RoleSettings
是数据类型图像.
内容是这样的:0x504B030414000000080000000000E637CA2A4
I've a table cSc_Role
with a column RoleSettings
.
RoleSettings
is datatype image.
The Content is something like this: 0x504B030414000000080000000000E637CA2A4
现在,我需要将此列更新为一行. 像这样:
Now I need to update this column for one row. Like this:
UPDATE cSc_Role
SET RoleSettings = '0x343240000000000E637CA2A430500'
WHERE Naming = 'User X'
但是对于二进制数据,似乎无法使用字符串来完成.
另一个选择是,我可以在一个临时的.bak文件中提供该图像.
然后执行INSERT INTO
.
但是我已经阅读了这种解决方案,只能插入完整的行,而不能只插入列.还是可以只插入带有插入的列?
But with binary data it seems like this is not possible to do it with a string.
The other option is, I can provide the image in a temporary .bak file.
And then do an INSERT INTO
.
But with this solution I've read it is only possible to insert a complete row and not only a column. Or can I insert only a column with insert?
如何在表格中更新或插入一个图像列? 预先感谢.
How can I update or insert one image-column in a table? Thanks in advance.
推荐答案
尝试使用convert to varbinary:
Try to use convert to varbinary:
UPDATE cSc_Role
SET RoleSettings = convert(VARBINARY(MAX),'0x343240000000000E637CA2A430500')
WHERE Naming = 'User X'
这篇关于SQL表中的UPDATE数据类型图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!