SSMS Results to Grid - CRLF not preserved in copy/paste - any better techniques?(SSMS 结果到网格 - CRLF 未保留在复制/粘贴中 - 有更好的技术吗?)
问题描述
当我在网格中有一个结果集时:
When I have a result set in the grid like:
SELECT 'line 1
line 2
line 3'
或
SELECT 'line 1' + CHAR(13) + CHAR(10) + 'line 2' + CHAR(13) + CHAR(10) + 'line 3'
使用嵌入的 CRLF,网格中的显示似乎用空格替换它们(我猜这样它们会显示所有数据).
With embedded CRLF, the display in the grid appears to replace them with spaces (I guess so that they will display all the data).
问题是,如果我正在代码生成脚本,我不能简单地剪切和粘贴它.我必须转换代码以打开光标并打印相关列,以便我可以从文本结果中复制和粘贴它们.
The problem is that if I am code-generating a script, I cannot simply cut and paste this. I have to convert the code to open a cursor and print the relevant columns so that I can copy and paste them from the text results.
是否有任何更简单的解决方法可以在结果网格的复制/粘贴操作中保留 CRLF?
Is there any simpler workaround to preserve the CRLF in a copy/paste operation from the results grid?
网格有用的原因是我目前正在为不同列中的同一对象生成许多脚本 - 一列中的 bcp 输出,另一列中的 xml 格式文件,另一列中的表创建脚本等...
The reason that the grid is helpful is that I am currently generating a number of scripts for the same object in different columns - a bcp out in one column, an xml format file in another, a table create script in another, etc...
推荐答案
此问题已在 中修复SSMS 16.5 build 13.0.16000.28 添加了在复制/保存时保留 CR/LF 的选项 (更多详细信息)(连接错误).
This issue has been fixed in SSMS 16.5 build 13.0.16000.28 with the addition of an option to preserve CR/LF on copy/save (more details) (Connect bug).
- 工具 > 选项
- 展开查询结果 > SQL Server > 结果到网格
- 勾选Retain CR/LF on copy or save
- 重启 SSMS
这将导致 CR、LF 和 CRLF 在您复制单元格时被视为换行符.
This will cause CR, LF, and CRLF to be treated as newlines when you copy a cell.
这篇关于SSMS 结果到网格 - CRLF 未保留在复制/粘贴中 - 有更好的技术吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:SSMS 结果到网格 - CRLF 未保留在复制/粘贴中 - 有更好的技术吗?
基础教程推荐
- 无法解决整理冲突 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- 在 SQL 中连接多个表 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
