如何以与SQL Server中相同的顺序将列从SQL导入到Excel中? [英] How do I import columns into Excel from SQL in the same order as they are in SQL Server?
本文介绍了如何以与SQL Server中相同的顺序将列从SQL导入到Excel中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我按照以下列顺序在SQL Server上创建了"vwTable"视图:
I created a 'vwTable' view on SQL Server with the following column order:
Shift_id | Client_ip | Machine_Center
但是当我使用Excel中的获取外部数据"选择视图时
but when I select the view using "get external data" from Excel:
SELECT * FROM vwTable
Excel中列的顺序不同;输出为:
The order of the columns in Excel is not the same; the output is:
Machine_Center | Client_ip | Shift_id
来自SSMS:
从Excel:
如何使Excel中的列顺序与SSMS中的列顺序相同?
How can I get the column order to be the same in Excel as it is in SSMS?
推荐答案
-
右键单击EXCEL列标题
right click EXCEL column header
- 转到表=>外部表属性
- 取消选中
"Preserve column sort/filter/layout"
- 刷新Excel
右键单击Excel列标题
right click Excel column header
- 转到表=>外部表属性
- 检查
"Preserve column sort/filter/layout"
- 刷新Excel
Excel中的列顺序现在与SQL视图中的顺序相同.
The order of the columns in Excel are now the same order as they are in the SQL View.
这篇关于如何以与SQL Server中相同的顺序将列从SQL导入到Excel中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文