如何将 MS SQL XML 字段迁移到 MySQL
我在 MSSQL 中有一个 XML
字段类型,我想将它们迁移到 MySQL 5,目前所有其他字段都可以使用 MySQL Migration Toolkit
正常运行,但是这个 XML 字段不处理。
有什么建议吗?谢谢
I have a field type of XML
in MSSQL and I would like to migrate them to MySQL 5, currently all other fields are running fine with MySQL Migration Toolkit
, but this XML field is not handled.
Any suggestions? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您不需要
XML
类型为您提供的额外功能(检查格式良好的 XML、架构支持等),只需将 XML 文本存储在LONGTEXT
中>If you don't need the extra features that the
XML
type gives you (checking for well-formed XML, schema support etc), the just store the XML text in aLONGTEXT
有一些关于 LONGTEXT 与 VARCHAR 优点的有趣页面。例如
长文本或 Varchar
在较新的 MYSQL 版本中(5.0 之后) 3) 对于可以安全预测小于 64k 的字段大小,VARCHAR 是首选。虽然许多 XML 文档可能比这长,但它值得考虑。 5.0.3 和之前的版本将 VARCHAR 限制为 0-255,因此 TEXT 类型几乎肯定是更可取的。
关于 BLOB 类型(包括 TEXT 类型)的详细讨论可以在这里找到:
MYSQL 5.1 参考手册,10.4.3 Blob 和文本类型
我想 MEDIUMTEXT 类型(最多 16Mb)足以满足除最详细的 XML 文档之外的所有文档) -通过 LONGTEXT,为每个记录节省一个字节。
There are some interesting pages regarding the benefits of LONGTEXT vs VARCHAR. e.g.
Long text or Varchar
In newer MYSQL builds (after 5.0.3) VARCHAR is much preferred for field sizes you can safely predict will be less than 64k. While many XML documents may be longer than this, its worth consideration. 5.0.3 and prior builds restrict VARCHAR to 0-255 and so a TEXT type is almost certainly preferable.
A good discussion of the BLOB types (including TEXT types) can be found here:
MYSQL 5.1 reference manual, 10.4.3 The Blob and Text Types
I imagine a MEDIUMTEXT type (up to 16Mb) will suffice for all but the most verbose XML documents) - saving you a solitary byte per record over LONGTEXT.