问题
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.
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.
This is also outlined here:Obtaining Pipe Delimited Results from SQL Server using SSMS
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.
Thanks for your help.
回答1:
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.
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
.
I was using Microsoft SQL Server Management Studio v17.9.1, build number 14.0.17289.0.
来源:https://stackoverflow.com/questions/54853827/custom-delimiter-in-sql-server-set-in-results-to-text-options-doesnt-work