问题描述
我有一个大约有20列的查询,我想将此查询导出到带有列标题的Excel文件中.
I have a query that has approximately 20 columns and I would like to export this to an Excel file with the column headers.
我认为这很容易弄清楚,但是没有运气!我在网上搜索后发现一个建议没有奏效,所以我被困住了.
I thought this would be easy to figure out but no luck! I searched the web and found one suggestion that did not end up working so I am stuck.
推荐答案
通常,我只需在结果网格中单击左上角,进行复制,然后粘贴到Excel中,即可完成此操作.有一个问题,您需要进入选项->查询结果-> SQL Server->结果到网格(或文本,如果您想保存到文件以导入到Excel中)并在复制或保存时打开包含列标题结果.我觉得这很好.
I typically do this by simply click the upper left corner in the results grid, copy, and then paste into Excel. There is one catch, you need to go into options->query results-> SQL Server->results to grid (or text if you want to save to file for import into excel) and turn on include column headers when copying or saving the results. I find this works great.
这篇关于从SQL Server导出到具有列标题的Excel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!