8192 导出到文件时文本列有限制吗?
我看过 this 问题,本质上是相同的,但 OP 接受了'使用其他工具作为答案。基本上,我试图将数据从表导出到分隔文件,但由于 8192 个字符的限制,输出文本被截断。我找不到任何有效的好方法(至少对我来说)。
如果 SSMS 和 sqlcmd (不确定该限制是否也适用于此。我目前正在尝试)是我唯一的选择,有没有办法解决此限制并转储较高宽度的文本列?
I have looked at this question which is essentially the same but the OP accepted 'using other tools' as an answer. Basically, I am trying to export data from a table to a delimited file but because of the 8192 character limit, the output text is getting truncated. I could not find any good approaches that work (for me at least).
If SSMS
and sqlcmd
(not sure if the limitation applies to this as well. I am trying at the moment) are my only options, is there a way to workaround this limitation and dump text columns of higher widths?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否考虑过使用简单的 PowerShell 脚本或使用 C# 的命令行应用程序?如果它可以
SELECT
所有数据,那么它当然应该能够将其全部写入文件。编辑 2011-08-03
我无法使用 PowerShell 或 sqlcmd 来实现此功能。前者似乎将输出截断为 4000 个字符,后者截断为 256 个字符。然而,我的好老朋友 VBScript 再次证明,新的和闪亮的并不总是最好的……代码写起来要乏味得多,但它有效。另存为 .vbs 文件,对第 2、3 和 6 行(如果需要更多列、数据转换、不同分隔符等,则对第 9 行进行适当更改)。
如果我从我的 PowerShell 专家朋友那里得到关于他们如何处理 > 的任何答案,我会在这里发帖。 4K。
Have you considered using a simple PowerShell script or a command-line app using C#? If it can
SELECT
all of the data then it should certainly be able to write it all to a file.EDIT 2011-08-03
I was unable to get this working with PowerShell or sqlcmd. The former seems to truncate output at 4000 characters and the latter at 256. However my good old friend VBScript once again proved that new and shiny is not always the best... the code is much more tedious to write, but it works. Save as .vbs file, make the appropriate changes to lines 2, 3 and 6 (and 9 if you want more columns, transformation of the data, different delimiters, etc).
I will post back here if I get any answers from my PowerShell guru friends about how they deal with > 4K.