在“结果为文本"中设置的SQL Server中的自定义分隔符选项不起作用 [英] Custom delimiter in SQL Server set in "Results to Text" options doesn't work

查看:47
本文介绍了在“结果为文本"中设置的SQL Server中的自定义分隔符选项不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有兴趣将SQL查询的结果(如 SELECT 语句)保存为SSMS中以管道( | )分隔的文本文件.

I am interested in saving the result of a SQL query, like a SELECT statement, as a pipe (|) delimited text file in SSMS.

我可以使用导出向导来做到这一点.

I can do that using the Export wizard.

但是,似乎有一种更简单的方法,即在 Query Results> SQL Server> Results to Text 下的 Tools> Options 中设置自定义分隔符",如下所示:

However, it seems there's a simpler method by setting a "Custom delimiter" in Tools>Options under Query Results>SQL Server>Results to Text as shown here:

然后,如果我指定文本结果" 文件结果" ,则应该得到管道定界的结果.

Then, if I specify "Results to Text" or "Results to File", I am supposed to get the pipe delimited result.

这也在此处概述:但是,这样做仍然可以得到通常的输出,包括结果到文本"或文件".

But, doing this I still get the usual output with either Results to Text or File.

我不知道我在想什么或做错了什么.

I don't know what I'm missing or doing wrong.

感谢您的帮助.

推荐答案

感谢@AlexYu,答案是简单地应用关闭和打开"技巧.在此设置更改生效之前,需要关闭并重新打开SSMS.

Thanks to @AlexYu, the answer is simply applying the "turning it off and on" trick. Closing and re-opening SSMS is required before the change in this setting takes effect.

顺便说一句,在这种情况下,断开连接并重新连接到SQL Server无效.我已经进行了一些基本的测试,看来这也适用于此处的其他选项,例如,在 Query Results> SQL Server> Grids的结果下.

Incidentally, disconnecting and re-connecting to the SQL server doesn't work in this case. I have done some rudimentary tests and it seems this also applies to other options here, for example under Query Results>SQL Server>Results to Grid.

我使用的是Microsoft SQL Server Management Studio v17.9.1,内部版本号14.0.17289.0.

I was using Microsoft SQL Server Management Studio v17.9.1, build number 14.0.17289.0.

这篇关于在“结果为文本"中设置的SQL Server中的自定义分隔符选项不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆