从图像字段 Sql Server 读取 Xml 字段
我正在尝试更改下面的代码并从图像字段读取
DECLARE @xml XML
SELECT @xml= x FROM OPENROWSET (BULK ''' + @XMLFILE + ''', SINGLE_BLOB) AS T(x)
它如何转换为 Xml 类型?
SELECT @xml= FileField FROM FileListTable (FileField is İmage Field)
I am trying to change the code below and read it from the image field
DECLARE @xml XML
SELECT @xml= x FROM OPENROWSET (BULK ''' + @XMLFILE + ''', SINGLE_BLOB) AS T(x)
How Can I Convert To Xml Type?
SELECT @xml= FileField FROM FileListTable (FileField is İmage Field)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试:
这是否有效,可能取决于 XML 在插入表之前如何转换为 IMAGE 数据类型。 此 db<>fiddle 练习将 XML 插入 IMAGE 列的各种方法,以及有几种方法(好的和坏的)试图把它弄出来。几乎令人惊讶的是,先转换为 VARBINARY(MAX),然后转换为 XML 似乎可以处理所演示的情况。
Try:
Whether this works or not, may depend on how the XML was converted to the IMAGE data type before being inserted into your table. This db<>fiddle exercises various ways of inserting XML into an IMAGE column and several ways (both good and bad) to try to get it out. Almost surprisingly, the cast to VARBINARY(MAX) and then to XML seems to handle the cases demonstrated.