我有各种 xml 文档需要存储在数据库列中.这些文档包含对 DTD 的引用,并且 SQL Server 不会导入 xml,因为它存在安全风险.如何在数据库上启用 DTD 支持,以便我插入 xml 内容.
I have various xml documents that I need to store in a database column. The documents contain references to a DTD and SQL Server won't import the xml because it is a security risk. How can I enable DTD support on the database so it will let me insert the xml content.
你必须先CONVERT.
MSDN一个>:
您可以使用以下命令从包含 DTD 的数据文件中导入 XML 数据OPENROWSET(BULK...) 函数,然后指定 CONVERT命令的 SELECT 子句中的选项.的基本语法命令是:
you can import XML data from a data file that contains a DTD by using the OPENROWSET(BULK...) function and then specifying the CONVERT option in the SELECT clause of the command. The basic syntax for the command is:
INSERT ... SELECT CONVERT(...) FROM OPENROWSET(BULK...)
示例:
INSERT T1
SELECT CONVERT(xml, BulkColumn, 2) FROM
OPENROWSET(Bulk 'c:\temp\Dtdfile.xml', SINGLE_BLOB) [rowsetresults];
这篇关于在 Sql Server 中启用 DTD 支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
获取所有产品、类别和元数据的 SQL 查询 woocommSQL query to get all products, categories and meta data woocommerce/wordpress(获取所有产品、类别和元数据的 SQL 查询 woocommerce/wordpre
我可以在不编写 SQL 查询的情况下找出数据库列表Can I figure out a list of databases and the space used by SQL Server instances without writing SQL queries?(我可以在不编写 SQL 查询的情况下
如何创建对 SQL Server 实例的登录?How to create a login to a SQL Server instance?(如何创建对 SQL Server 实例的登录?)
如何通过注册表搜索知道SQL Server的版本和版本How to know the version and edition of SQL Server through registry search(如何通过注册表搜索知道SQL Server的版本和版本)
为什么会出现“数据类型转换错误"?使用 ExWhy do I get a quot;data type conversion errorquot; with ExecuteNonQuery()?(为什么会出现“数据类型转换错误?使用 ExecuteNonQuery()?)
如何将 DataGridView 中的图像显示到 PictureBox?How to show an image from a DataGridView to a PictureBox?(如何将 DataGridView 中的图像显示到 PictureBox?)