SQL 使用文件内容更新图像字段的最简单方法是什么
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4376087/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 08:30:33 来源:igfitidea点击:
What is the easiest way to update an image field with the content of a file
提问by MarioH
I've a table in MS Sql server with an image field and a file. What is the easiest way to create a T-Sql script that updates the field with the content of the file?
我在 MS Sql 服务器中有一个表,其中包含一个图像字段和一个文件。创建使用文件内容更新字段的 T-Sql 脚本的最简单方法是什么?
回答by Martin Smith
UPDATE YourTable
SET BlobColumn =
(SELECT BulkColumn FROM OPENROWSET(BULK N'C:\YourFile.png', SINGLE_BLOB) AS x)
WHERE ...